package com.laoer.bbscs.web.tag;
import javax.servlet.jsp.tagext.TagSupport;
import javax.servlet.jsp.*;
import javax.servlet.http.*;
import org.apache.struts.util.RequestUtils;
import org.apache.struts.util.ResponseUtils;
import com.laoer.bbscs.bean.*;
import com.laoer.bbscs.sys.*;
import com.laoer.bbscs.web.servlet.*;
import com.laoer.bbscs.web.form.*;
import com.laoer.comm.util.*;
//import org.springframework.web.context.WebApplicationContext;
//import org.springframework.web.context.support.WebApplicationContextUtils;
import java.util.*;
import java.io.*;
/**
* <p>Title: TianYi BBS</p>
* <p>Description: TianYi BBS System</p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: LAOER.COM/TIANYISOFT.NET</p>
* @author laoer
* @version 6.0
*/
public class ForumTag
extends TagSupport {
private String scope = null;
private String type = null;
private String name = null;
private String property = null;
private String userCheck = null;
private String page;
private String inpages;
private String totalnum;
private String img;
private String userInfo;
public ForumTag() {
}
public String getScope() {
return scope;
}
public void setScope(String scope) {
this.scope = scope;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getProperty() {
return property;
}
public void setProperty(String property) {
this.property = property;
}
public String getUserCheck() {
return userCheck;
}
public void setUserCheck(String userCheck) {
this.userCheck = userCheck;
}
public int doStartTag() throws JspException {
return (SKIP_BODY);
}
public int doEndTag() throws JspException {
HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
if (scope == null) {
scope = "request";
}
if (userCheck == null) {
userCheck = "uc";
}
UserCheck uc = (UserCheck) RequestUtils.lookup(pageContext, userCheck,
scope);
//String output = "";
if (type.equals("return")) {
StringBuffer sb = new StringBuffer();
sb.append("[");
sb.append("<a href='forum");
sb.append(Constant.FILEPREFIX);
sb.append("?bid=");
sb.append(uc.getBid());
sb.append("&page=");
sb.append(page);
sb.append("'>");
sb.append(Constant.MESSAGE.getMessage(request.getLocale(), "bbscs.back"));
sb.append("</a>");
sb.append("]");
ResponseUtils.write(pageContext, sb.toString());
return (SKIP_BODY);
}
if (type.equals("wastereturn")) {
StringBuffer sb = new StringBuffer();
sb.append("[");
sb.append("<a href='manage");
sb.append(Constant.FILEPREFIX);
sb.append("?action=w&bid=");
sb.append(uc.getBid());
sb.append("&page=");
sb.append(page);
sb.append("'>");
sb.append(Constant.MESSAGE.getMessage(request.getLocale(), "bbscs.back"));
sb.append("</a>");
sb.append("]");
ResponseUtils.write(pageContext, sb.toString());
return (SKIP_BODY);
}
if (type.equals("auditingreturn")) {
StringBuffer sb = new StringBuffer();
sb.append("[");
sb.append("<a href='manage");
sb.append(Constant.FILEPREFIX);
sb.append("?action=a&bid=");
sb.append(uc.getBid());
sb.append("&page=");
sb.append(page);
sb.append("'>");
sb.append(Constant.MESSAGE.getMessage(request.getLocale(), "bbscs.back"));
sb.append("</a>");
sb.append("]");
ResponseUtils.write(pageContext, sb.toString());
return (SKIP_BODY);
}
if (type.equals("subs")) {
if (!uc.isGuest()) {
String mainid = (String) RequestUtils.lookup(pageContext, name, scope);
StringBuffer sb = new StringBuffer();
sb.append("[<a href='subscibe");
sb.append(Constant.FILEPREFIX);
sb.append("?action=add&bid=");
sb.append(uc.getBid());
sb.append("&postID=");
sb.append(mainid);
sb.append("'>");
sb.append(Constant.MESSAGE.getMessage(request.getLocale(),
"forum.subscibe"));
sb.append("</a>]");
ResponseUtils.write(pageContext, sb.toString());
}
return (SKIP_BODY);
}
if (type.equals("face")) {
Object value =
RequestUtils.lookup(pageContext, name, property, null);
/*
Object value =
RequestUtils.lookup(pageContext, name, null);*/
if (value != null) {
//Forum forum = (Forum) value;
StringBuffer sb = new StringBuffer();
sb.append("<img src='images/");
if ( ( (Short) value).shortValue() != 0) {
sb.append( ( (Short) value).shortValue());
}
else {
sb.append("vote");
}
/*
if (forum.getFace() != 0) {
sb.append(forum.getFace());
}
else {
sb.append("vote");
}*/
sb.append(".gif' align='absmiddle'>");
ResponseUtils.write(pageContext, sb.toString());
return this.SKIP_BODY;
}
//return (SKIP_BODY);
}
if (type.equals("forumtitle")) {
Object value =
RequestUtils.lookup(pageContext, name, null);
/*
Object pagevalue =
RequestUtils.lookup(pageContext, page, scope);*/
if (value != null) {
Forum forum = (Forum) value;
if (page == null) {
page = "1";
}
StringBuffer sb = new StringBuffer();
sb.append("<span class=\"bt\"><a href='read");
sb.append(Constant.FILEPREFIX);
sb.append("?bid=");
sb.append(forum.getBoardID());
sb.append("&id=");
sb.append(forum.getId2());
sb.append("&page=");
sb.append(page);
sb.append("'>");
if (forum.getIsVote() == 1) {
sb.append("[");
sb.append(Constant.MESSAGE.getMessage(request.getLocale(),
"post.vote"));
sb.append("]");
}
//sb.append(forum.getTitle());
sb.append(ResponseUtils.filter(forum.getTitle()));
sb.append("</a></span>");
sb.append(SysUtil.getPostPageBreakStr("read" + Constant.FILEPREFIX +
"?bid=" + forum.getBoardID() +
"&id=" + forum.getId().longValue() +
"&page=" + page + "&inpages=",
forum.getReNum() + 1,
uc.getPostPerNum()));
if (forum.getIsTop() != 0) {
sb.append(" <span class='FONT2'>");
sb.append(Constant.MESSAGE.getMessage(request.getLocale(),
"forum.totop"));
sb.append("</span>");
}
if (forum.getIsLock() != 0) {
sb.append(" <span class='FONT2'>");
sb.append(Constant.MESSAGE.getMessage(request.getLocale(),
"forum.lock"));
sb.append("</span>");
}
if (forum.getHavePic() != 0) {
sb.append(" <span class='FONT2'>");
sb.append(Constant.MESSAGE.getMessage(request.getLocale(),
"forum.havepic"));
sb.append("</span>");
}
if (forum.getElite() != 0) {
sb.append(" <span class='FONT2'>");
sb.append(Constant.ME
- 1
- 2
前往页