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

Marcus Popetz marcus at roundpeg.com
Thu Jun 8 23:29:48 CEST 2006


At 12:02 PM 6/5/2006, Marcus Popetz wrote:
>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.


I worked around this by creating my own add/edit/delete buttons based on 
what they were doing for theirs...cept I don't use javascript to handle the 
submitting.

This solves the multiple edit links showing even when you want to skip the 
element, and it also solves the "no new button" when you first start out 
because the new button gets printed with the first loop of content load.

Heres' the basics:

Basically, I created my own edit/delete/add buttons, each in their own 
form, and print them only when I want to see them. Here's how:

3 forms, add, edit, delete.

on the add form, you'll need to change the "newlink" to whatever is 
appropriate for your system...go ahead and display their edit links and 
steal their "newlink" value if you don't want to figure it out by staring 
at the url encoded version.

All forms: You'll also want to change the backlink and closelink values of 
the forms to be something appropriate as well..ie: where to come back to.

At the top of the page:

the add form:
<form name="form_directedit_-1846939088" id="form_directedit_-1846939088" 
method="post" action="/system/workplace/editors/editor.jsp" 
class="ocms_nomargin" target="_top">
<input type="hidden" name="resource" value="/news/news_0003.html">
<input type="hidden" name="directedit" value="true">
<input type="hidden" name="elementlanguage" value="en">
<input type="hidden" name="elementname" value="null">
<input type="hidden" name="backlink" value="/news/listBySection.jsp">
<input type="hidden" name="newlink" 
value="allInFolderDateReleasedDesc%7C%2Fnews%2Fnews_%24%7Bnumber%7D.html%7CAAU_News"> 

<input type="hidden" name="closelink">
<input type="hidden" name="redirect" value="true">
<input type="hidden" name="editortitle" value="Editing (new resource)">
<input name="Submit" type="submit" value="Add New" border="0">
</form>


and then in the content load loop, the edit/delete link forms:
note, i use a count variable to make the form names unique...not sure if 
that's necessary or not.   I'm guessing not.


<form name="form_directedit_<%=count%>_delete" 
id="form_directedit_-1846939088" method="post" 
action="/system/workplace/commons/delete.jsp" class="ocms_nomargin" 
target="_top">
<input type="hidden" name="resource" value="<cms:contentshow 
element="${opencms.filename}" />">
<input type="hidden" name="directedit" value="true">
<input type="hidden" name="elementlanguage" value="en">


<input type="hidden" name="elementname" value="null">
<input type="hidden" name="backlink" value="/news/listBySection.jsp">
<input type="hidden" name="newlink" 
value="allInFolderDateReleasedDesc%7C%2Fnews%2Fnews_%24%7Bnumber%7D.html%7CAAU_News"> 

<input type="hidden" name="closelink" value="/news/listBySection.jsp">
<input type="hidden" name="redirect" value="true">
<input type="hidden" name="editortitle" value="Deleting (resource)">
<input name="Submit" type="submit" value="Delete" border="0">
</form>

<form name="form_directedit_<%=count%>_edit" method="post" 
action="/system/workplace/editors/editor.jsp" class="ocms_nomargin" 
target="_top">
<input type="hidden" name="resource" value="<cms:contentshow 
element="${opencms.filename}" />">
<input type="hidden" name="directedit" value="true">
<input type="hidden" name="elementlanguage" value="en">

<input type="hidden" name="elementname" value="null">
<input type="hidden" name="closelink" value="/news/listBySection.jsp">
<input type="hidden" name="newlink">
<input type="hidden" name="backlink" value="/news/listBySection.jsp">
<input type="hidden" name="redirect" value="true">
<input type="hidden" name="editortitle">
<input name="Submit" type="submit" value="Edit" border="0">
</form>

Hope this gets someone else out of a bind.

-mp 




More information about the opencms-dev mailing list