1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.seasar.tuigwaa.plugin.basic;
17
18 import org.seasar.tuigwaa.cms.core.CmsRequest;
19 import org.seasar.tuigwaa.cms.core.CmsResponse;
20 import org.seasar.tuigwaa.cms.core.Resource;
21 import org.seasar.tuigwaa.cms.core.wiki.WikiContext;
22 import org.seasar.tuigwaa.plugin.AbstractPlugin;
23 import org.seasar.tuigwaa.plugin.PluginException;
24 import org.seasar.tuigwaa.plugin.PluginRequest;
25
26 import com.isenshi.util.HtmlBuffer;
27
28 /***
29 * @author someda
30 */
31 public class PagePlugin extends AbstractPlugin {
32
33 public String doHTMLView(CmsRequest request, CmsResponse response,
34 PluginRequest prequest) throws PluginException {
35
36 String name = prequest.getName();
37 Resource resource = request.getPage().getResource();
38
39 HtmlBuffer buf = new HtmlBuffer();
40
41 if (name.equals("page")) {
42 buf.appendBody(resource.getPageName());
43 } else if (name.equals("fpage")) {
44 buf.appendBody(resource.getPath());
45 } else if ("pageinfo".equals(name)) {
46 String mainPagePath = request.getMainPagePath();
47 WikiContext ctx = getConfiguration().getWikiContext();
48 resource = ctx.getResource(request, mainPagePath);
49
50 if (resource != null) {
51 buf.appendStartTag("div");
52 buf.appendAttribute("id", "pageinfo");
53 buf.appendBody(getMessage("pageinfo.version") + ":"
54 + resource.getVersion());
55 buf.appendBr();
56 buf.appendBody(getMessage("pageinfo.creation.date") + ":"
57 + resource.getCreationDate());
58 buf.appendBr();
59 buf.appendBody(getMessage("pageinfo.creation.user") + ":"
60 + resource.getCreationUser());
61 buf.appendBr();
62 buf.appendBody(getMessage("pageinfo.update.date") + ":"
63 + resource.getModificationDate());
64 buf.appendBr();
65 buf.appendBody(getMessage("pageinfo.update.user") + ":"
66 + resource.getModificationUser());
67 buf.appendBr();
68 buf.endTag();
69 }
70 }
71 return buf.toString();
72 }
73
74 }