Commit b6ba74f8 authored by Guus der Kinderen's avatar Guus der Kinderen

Use xml tags instead of programmatic ones.

parent 912419d5
package org.jivesoftware.admin;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTagSupport;
import java.io.IOException;
public class ContentBoxTag extends BodyTagSupport {
private String title;
@Override
public int doEndTag() throws JspException
{
final String body = "<div class=\"jive-contentBoxHeader\">" +
title +
"</div>\n" +
"<div class=\"jive-contentBox\">" +
bodyContent.getString() +
"</div>\n";
try {
pageContext.getOut().write( body );
}
catch (IOException ioe) {
throw new JspException(ioe.getMessage());
}
return super.doEndTag();
}
public String getTitle()
{
return title;
}
public void setTitle( String title )
{
this.title = title;
}
}
package org.jivesoftware.admin;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTagSupport;
import java.io.IOException;
public class InfoboxTag extends BodyTagSupport {
private String type; // success, error, warning
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public int doEndTag() throws JspException {
String body = "<div class=\"jive-"+type+"\">\n" +
" <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n" +
" <tbody>\n" +
" <tr><td class=\"jive-icon\"><img src=\"images/"+type+"-16x16.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"\"/></td>\n" +
" <td class=\"jive-icon-label\">\n" +
bodyContent.getString() +
" </td></tr>\n" +
" </tbody>\n" +
" </table>\n" +
"</div><br>\n";
try {
pageContext.getOut().write( body );
}
catch (IOException ioe) {
throw new JspException(ioe.getMessage());
}
return super.doEndTag();
}
}
...@@ -118,26 +118,6 @@ ...@@ -118,26 +118,6 @@
<rtexprvalue>true</rtexprvalue> <rtexprvalue>true</rtexprvalue>
</attribute> </attribute>
</tag> </tag>
<tag>
<name>contentBox</name>
<tag-class>org.jivesoftware.admin.ContentBoxTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<name>title</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<name>infobox</name>
<tag-class>org.jivesoftware.admin.InfoboxTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<name>type</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag> <tag>
<name>ASN1DER</name> <name>ASN1DER</name>
<tag-class>org.jivesoftware.admin.ASN1DERTag</tag-class> <tag-class>org.jivesoftware.admin.ASN1DERTag</tag-class>
...@@ -148,6 +128,18 @@ ...@@ -148,6 +128,18 @@
<rtexprvalue>true</rtexprvalue> <rtexprvalue>true</rtexprvalue>
</attribute> </attribute>
</tag> </tag>
<tag-file>
<name>contentBox</name>
<path>/WEB-INF/tags/admin/contentBox.tagx</path>
</tag-file>
<tag-file>
<name>infobox</name>
<path>/WEB-INF/tags/admin/infoBox.tagx</path>
</tag-file>
<tag-file>
<name>infoBox</name>
<path>/WEB-INF/tags/admin/infoBox.tagx</path>
</tag-file>
<function> <function>
<name>replaceAll</name> <name>replaceAll</name>
<function-class>org.jivesoftware.admin.JSTLFunctions</function-class> <function-class>org.jivesoftware.admin.JSTLFunctions</function-class>
......
<jsp:root xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:jsp="http://java.sun.com/JSP/Page"
version="2.0">
<jsp:directive.attribute name="title" required="true" />
<div class="jive-contentBoxHeader">
<c:out value="${title}" />
</div>
<div class="jive-contentBox">
<jsp:doBody />
</div>
</jsp:root>
\ No newline at end of file
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
version="2.0">
<jsp:directive.attribute name="type" required="true" />
<div class="jive-${type}">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr>
<td class="jive-icon"><img src="images/${type}-16x16.gif" width="16" height="16" border="0" alt=""/></td>
<td class="jive-icon-label">
<jsp:doBody />
</td>
</tr>
</tbody>
</table>
</div>
<br />
</jsp:root>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment