View Javadoc

1   /*
2    * Copyright 2004-2006 the Seasar Foundation and the Others.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
13   * either express or implied. See the License for the specific language
14   * governing permissions and limitations under the License.
15   */
16  package org.seasar.tuigwaa.plugin.database;
17  
18  import org.seasar.tuigwaa.cms.core.CmsRequest;
19  import org.seasar.tuigwaa.cms.core.CmsResponse;
20  import org.seasar.tuigwaa.plugin.AbstractTgwPlugin;
21  import org.seasar.tuigwaa.plugin.PluginException;
22  import org.seasar.tuigwaa.plugin.PluginRequest;
23  import org.seasar.tuigwaa.system.Constants;
24  import org.seasar.tuigwaa.util.TgwContext;
25  
26  import com.isenshi.util.CharUtil;
27  import com.isenshi.util.HtmlBuffer;
28  
29  /***
30   * @author nishioka
31   */
32  public class TableFeedPlugin extends AbstractTgwPlugin {
33  
34  	public String doHTMLView(CmsRequest req, CmsResponse res,
35  			PluginRequest prequest) throws PluginException {
36  
37  		String[] args = prequest.getArgs();
38  
39  		String pageName = args[0];
40  		String entityDisplayName = args[1];
41  
42  		String filterName = (existArg(args, 2))?args[2]:"";
43  
44  		String siteName = req.getSiteName();
45  		String entityName = getEntity(siteName, entityDisplayName).getName();
46  		String contextPath = TgwContext.getContextPath();
47  
48  		String link = contextPath + "/" + TgwContext.getSiteName()
49  				+ "/tableFeed.do?" + Constants.PARAM_ENTITY_NAME + "="
50  				+ entityName + "&" + Constants.PARAM_ENTITY_FILTER + "="
51  				+ CharUtil.urlEncode(filterName) + "&"
52  				+ Constants.PARAM_PAGENAME + "=" + CharUtil.urlEncode(pageName);
53  
54  		HtmlBuffer buf = new HtmlBuffer();
55  		buf.appendStartTag("a");
56  		buf.appendAttribute("href", link);
57  		buf.appendStartTag("img");
58  
59  		buf.appendAttribute("src", contextPath + "/TGW-RES/img/rss20.gif");
60  		buf.endTag();
61  		buf.endTag();
62  		return buf.toString();
63  	}
64  }