fix #129
This commit is contained in:
parent
6972a887dc
commit
8f555f261e
4 changed files with 30 additions and 2 deletions
|
@ -22,6 +22,7 @@ import java.io.UnsupportedEncodingException;
|
|||
import java.net.URLDecoder;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
@ -39,11 +40,13 @@ import jp.sf.fess.helper.UserAgentHelper.UserAgentType;
|
|||
import jp.sf.fess.util.ResourceUtil;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.codelibs.core.CoreLibConstants;
|
||||
import org.codelibs.core.util.DynamicProperties;
|
||||
import org.codelibs.core.util.StringUtil;
|
||||
import org.seasar.framework.util.URLUtil;
|
||||
import org.seasar.robot.util.CharUtil;
|
||||
import org.seasar.struts.taglib.S2Functions;
|
||||
import org.seasar.struts.util.MessageResourcesUtil;
|
||||
import org.seasar.struts.util.RequestUtil;
|
||||
import org.seasar.struts.util.ServletContextUtil;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -53,6 +56,7 @@ import com.github.jknack.handlebars.Context;
|
|||
import com.github.jknack.handlebars.Handlebars;
|
||||
import com.github.jknack.handlebars.Template;
|
||||
import com.github.jknack.handlebars.io.FileTemplateLoader;
|
||||
import com.ibm.icu.text.SimpleDateFormat;
|
||||
|
||||
public class ViewHelper implements Serializable {
|
||||
|
||||
|
@ -415,6 +419,27 @@ public class ViewHelper implements Serializable {
|
|||
ResourceUtil.getViewTemplatePath(StringUtil.EMPTY)));
|
||||
final Handlebars handlebars = new Handlebars(loader);
|
||||
|
||||
Locale locale = RequestUtil.getRequest().getLocale();
|
||||
if (locale == null) {
|
||||
locale = Locale.ENGLISH;
|
||||
}
|
||||
String url = (String) doc.get("url");
|
||||
if (url == null) {
|
||||
url = MessageResourcesUtil.getMessage(locale,
|
||||
"labels.search_unknown");
|
||||
}
|
||||
Object created = doc.get("created");
|
||||
if (created instanceof Date) {
|
||||
final SimpleDateFormat sdf = new SimpleDateFormat(
|
||||
CoreLibConstants.DATE_FORMAT_ISO_8601_EXTEND);
|
||||
created = sdf.format((Date) created);
|
||||
} else {
|
||||
created = MessageResourcesUtil.getMessage(locale,
|
||||
"labels.search_unknown");
|
||||
}
|
||||
doc.put("cacheMsg", MessageResourcesUtil.getMessage(locale,
|
||||
"labels.search_cache_msg", url, created));
|
||||
|
||||
try {
|
||||
final Template template = handlebars.compile(cacheTemplateName);
|
||||
final Context hbsContext = Context.newContext(doc);
|
||||
|
|
|
@ -430,7 +430,8 @@ labels.index_help=Help
|
|||
labels.search_options=Search Options
|
||||
labels.search_options_close=Close
|
||||
labels.search_options_clear=Clear
|
||||
|
||||
labels.search_cache_msg=This is a cache of {0}. It is a snapshot of the page at {1}.
|
||||
labels.search_unknown=Unknown
|
||||
|
||||
# view/footer.jsp
|
||||
labels.footer_back_to_top=Back to top
|
||||
|
|
|
@ -430,6 +430,8 @@ labels.index_help=\u30d8\u30eb\u30d7
|
|||
labels.search_options=\u691c\u7d22\u30aa\u30d7\u30b7\u30e7\u30f3
|
||||
labels.search_options_close=\u9589\u3058\u308b
|
||||
labels.search_options_clear=\u30af\u30ea\u30a2
|
||||
labels.search_cache_msg=\u3053\u306e\u30da\u30fc\u30b8\u306f {0} \u306e\u30ad\u30e3\u30c3\u30b7\u30e5\u3067\u3059\u3002{1} \u306b\u5b58\u5728\u3057\u3066\u3044\u305f\u30da\u30fc\u30b8\u306e\u30b9\u30ca\u30c3\u30d7\u30b7\u30e7\u30c3\u30c8\u3067\u3059\u3002
|
||||
labels.search_unknown=\u4e0d\u660e
|
||||
|
||||
# view/footer.jsp
|
||||
labels.footer_back_to_top=\u4e0a\u90e8\u3078\u79fb\u52d5
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<base href="{{url}}">
|
||||
<div style="border:1px solid #999;margin:5px -1px;padding:0;">
|
||||
<div style="margin:5px 15px;padding:5px;text-align:left;">This content is cached in Fess.</div>
|
||||
<div style="color:#000;background:#ddd;border:1px solid #666;margin:10px 15px;padding:5px;text-align:left;">{{cacheMsg}}</div>
|
||||
</div>
|
||||
{{{cache}}}
|
||||
|
|
Loading…
Add table
Reference in a new issue