?? manageh.java
字號(hào):
package com.laoer.bbscs.web.action;
import com.laoer.bbscs.web.form.*;
import com.laoer.bbscs.web.servlet.*;
import com.laoer.bbscs.bean.*;
import com.laoer.bbscs.sys.*;
import com.laoer.comm.util.*;
import org.apache.struts.action.*;
import javax.servlet.http.*;
import java.util.*;
/**
* <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 Manageh
extends BaseAction {
public ActionForward execute(ActionMapping actionMapping,
ActionForm actionForm,
HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse) {
ActionErrors errors = new ActionErrors();
ManageForm form = (ManageForm) actionForm;
UserCheck uc = this.getUserCheck(httpServletRequest, httpServletResponse,
form.getBid());
if (uc.isGuest()) {
errors.add("error.pleaselogin", new ActionError("error.pleaselogin"));
saveErrors(httpServletRequest, errors);
//return actionMapping.findForward("login");
return SysUtil.getPassLogin(actionMapping);
}
if (uc.getBs() == null) {
errors.add("error.baordsno", new ActionError("error.baordsno"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
if (!uc.isCanPostNotNeedExp()) {
errors.add("error.purviewerror", new ActionError("error.purviewerror"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
if (form.getAction().equals("list")) {
List bulist = this.getBlackUserService().findBlackUserList( (short) 0, 0,
form.getBid());
httpServletRequest.setAttribute("bulist", bulist);
form.setYear(Util.getYear());
form.setMonth(Util.getMonth());
form.setDay(Util.getDay());
httpServletRequest.setAttribute("manageForm", form);
form.setBulletin(uc.getBs().getBulletin());
form.setAction("bull");
httpServletRequest.setAttribute("boardsForm", form);
httpServletRequest.setAttribute("caninuser",
Util.notNull(uc.getBs().getUserCanIn()));
httpServletRequest.setAttribute("bid", String.valueOf(form.getBid()));
return actionMapping.findForward("manageh");
}
if (form.getAction().equals("add")) {
UserInfo buuser = this.getUserInfoService().findUserInfoByUserName(form.
getBlackUserName());
if (buuser == null) {
errors.add("error.user.nouser", new ActionError("error.user.nouser"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
if (this.getBlackUserService().findBlackUserByUserName(form.
getBlackUserName(), (short) 0, 0, form.getBid()) != null) {
errors.add("error.blackuser.exist",
new ActionError("error.blackuser.exist"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
BlackUser bu = new BlackUser();
bu.setAddName(uc.getUsername());
bu.setAtBoard(0);
bu.setAtBoards(form.getBid());
bu.setAtSite( (short) 0);
bu.setOutTime(Util.Date2Long(form.getYear(), form.getMonth(), form.getDay()));
bu.setReason(form.getReason());
bu.setUserID(buuser.getId().longValue());
bu.setUserName(form.getBlackUserName());
bu = this.getBlackUserService().saveBlackUser(bu);
if (bu == null) {
errors.add("error.blackuser.add", new ActionError("error.blackuser.add"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
ActionForward f = new ActionForward("/manageh" + Constant.FILEPREFIX +
"?action=list&bid=" +
form.getBid(), true);
return f;
}
if (form.getAction().equals("del")) {
BlackUser bu = this.getBlackUserService().findBlackUserByUserName(form.
getBlackUserName(), (short) 0, 0, form.getBid());
if (bu != null) {
this.getBlackUserService().removeBlackUser(bu);
}
ActionForward f = new ActionForward("/manageh" + Constant.FILEPREFIX +
"?action=list&bid=" +
form.getBid(), true);
return f;
}
if (form.getAction().equals("bull")) {
if (! (uc.isSuperAdmin() || uc.isBmaster() || uc.isMainMaster())) {
errors.add("error.purviewerror1", new ActionError("error.purviewerror1"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
Boards bs = uc.getBs();
bs.setBulletin(form.getBulletin());
bs = getBoardsService().saveBoards(bs);
if (bs != null) {
getBoardList().getBoardsHm().put(bs.getId(), bs);
}
ActionForward f = new ActionForward("/manageh" + Constant.FILEPREFIX +
"?action=list&bid=" +
form.getBid(), true);
return f;
}
if (form.getAction().equals("addcanin")) {
if (! (uc.isSuperAdmin() || uc.isBmaster() || uc.isMainMaster())) {
errors.add("error.purviewerror1", new ActionError("error.purviewerror1"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
UserInfo caninuser = this.getUserInfoService().findUserInfoByUserName(
form.getCanInUserName());
if (caninuser == null) {
errors.add("error.user.nouser", new ActionError("error.user.nouser"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
Boards bs = uc.getBs();
if ( ("," +
Util.notNull(bs.getUserCanIn())).indexOf("," +
form.getCanInUserName() + ",") !=
-1) {
errors.add("error.reg.name1", new ActionError("error.reg.name1"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
bs.setUserCanIn(bs.getUserCanIn() + form.getCanInUserName() + ",");
bs = getBoardsService().saveBoards(bs);
if (bs != null) {
getBoardList().getBoardsHm().put(bs.getId(), bs);
}
ActionForward f = new ActionForward("/manageh" + Constant.FILEPREFIX +
"?action=list&bid=" +
form.getBid(), true);
return f;
}
if (form.getAction().equals("delcanin")) {
if (! (uc.isSuperAdmin() || uc.isBmaster() || uc.isMainMaster())) {
errors.add("error.purviewerror1", new ActionError("error.purviewerror1"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
Boards bs = uc.getBs();
String caninuser = Util.notNull(bs.getUserCanIn());
if ( ("," + caninuser).indexOf("," + form.getCanInUserName() + ",") != -1) {
caninuser = Util.replace(caninuser, form.getCanInUserName() + ",", "");
}
bs.setUserCanIn(caninuser);
bs = getBoardsService().saveBoards(bs);
if (bs != null) {
getBoardList().getBoardsHm().put(bs.getId(), bs);
}
ActionForward f = new ActionForward("/manageh" + Constant.FILEPREFIX +
"?action=list&bid=" +
form.getBid(), true);
return f;
}
return actionMapping.findForward("error");
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -