Kawai Wiki

Compare Revisions

Ignore whitespace Rev 142 → Rev 143

/trunk/src/main/java/org/kawai/model/Language.java
116,4 → 116,8
public static List<Language> all() {
return LANGUAGES;
}
public static void clear() {
LANGUAGES.clear();
}
}
/trunk/src/main/java/org/kawai/AppManager.java
131,6 → 131,8
@Override
public void loadLocales() {
Language.clear();
if (!props.has("languages")) {
Language l = new Language(1, "English", "en");
/trunk/src/main/java/org/kawai/tag/kcode/Image.java
New file
0,0 → 1,34
package org.kawai.tag.kcode;
 
import java.util.Map;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
 
public class Image implements KCode {
@Override
public String getTag() {
return "img";
}
@Override
public boolean hasBody() {
return false;
}
@Override
public String process(PageContext pageContext, Map<String, String> attributes, String body) throws JspException {
if (body != null) throw new JspException("contextPath tag cannot have a body!");
String filename = attributes.get("file");
if (filename == null) throw new JspException("file attribute is mandatory!");
HttpServletRequest req = (HttpServletRequest) pageContext.getRequest();
String cp = req.getContextPath();
return "<img src=\"" + cp + "/uploads/images/" + filename + "\" border=\"0\" />";
}
}
/trunk/src/main/webapp/WEB-INF/conf/default/appManager.properties
6,7 → 6,7
db.script = WEB-INF/db/kawai.sql
 
# kCodes Tags
kcodes = Code, ContextPath, PageLink
kcodes = Code, ContextPath, PageLink, Image
 
# Languages supported
languages = [ ["English", "en", "flag_usa.gif"] , ["Portuguese", "pt", "flag_brazil.gif"] ]