📄 _editgroup__jsp.java
字号:
/*
* JSP generated by Resin 2.1.2 (built Tue Jun 11 08:26:56 PDT 2002)
*/
package _admin._forum;
import javax.servlet.*;
import javax.servlet.jsp.*;
import javax.servlet.http.*;
import java.util.*;
import com.coolservlets.forum.*;
import com.coolservlets.forum.util.*;
import com.coolservlets.forum.util.admin.*;
public class _editgroup__jsp extends com.caucho.jsp.JavaPage{
private boolean _caucho_isDead;
public void
_jspService(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException
{
com.caucho.jsp.QPageContext pageContext = (com.caucho.jsp.QPageContext) com.caucho.jsp.QJspFactory.create().getPageContext(this, request, response, null, true, 8192, true);
javax.servlet.jsp.JspWriter out = (javax.servlet.jsp.JspWriter) pageContext.getOut();
javax.servlet.ServletConfig config = getServletConfig();
javax.servlet.Servlet page = this;
javax.servlet.http.HttpSession session = pageContext.getSession();
javax.servlet.ServletContext application = pageContext.getServletContext();
response.setContentType("text/html;charset=gb2312");
request.setCharacterEncoding("GB2312");
try {
pageContext.write(_jsp_string0, 0, _jsp_string0.length);
/**
* $RCSfile: editGroup.jsp,v $
* $Revision: 1.3 $
* $Date: 2000/12/18 02:06:21 $
*/
pageContext.write(_jsp_string0, 0, _jsp_string0.length);
pageContext.write(_jsp_string0, 0, _jsp_string0.length);
pageContext.write(_jsp_string1, 0, _jsp_string1.length);
com.coolservlets.forum.util.admin.AdminBean adminBean;
synchronized (session) {
adminBean = (com.coolservlets.forum.util.admin.AdminBean) session.getValue("adminBean");
if (adminBean == null) {
adminBean = new com.coolservlets.forum.util.admin.AdminBean();
session.putValue("adminBean", adminBean);
}
}
pageContext.write(_jsp_string1, 0, _jsp_string1.length);
try {
pageContext.write(_jsp_string2, 0, _jsp_string2.length);
////////////////////////////////
// Jive authorization check
// check the bean for the existence of an authorization token.
// Its existence proves the user is valid. If it's not found, redirect
// to the login page
Authorization authToken = adminBean.getAuthToken();
if( authToken == null ) {
response.sendRedirect( "login.jsp" );
return;
}
pageContext.write(_jsp_string2, 0, _jsp_string2.length);
////////////////////
// Security check
// make sure the user is authorized to administer users:
ForumFactory forumFactory = ForumFactory.getInstance(authToken);
boolean isSystemAdmin = ((Boolean)session.getValue("jiveAdmin.systemAdmin")).booleanValue();
boolean isGroupAdmin = ((Boolean)session.getValue("jiveAdmin.groupAdmin")).booleanValue();
// redirect to error page if we're not a group admin or a system admin
if( !isGroupAdmin && !isSystemAdmin ) {
request.setAttribute("message","No permission to administer groups");
response.sendRedirect("error.jsp");
return;
}
pageContext.write(_jsp_string2, 0, _jsp_string2.length);
////////////////////
// get parameters
int groupID = ParamUtils.getIntParameter(request,"group",-1);
String newGroupName = ParamUtils.getParameter(request,"groupName");
String newGroupDescription = ParamUtils.getParameter(request,"groupDescription",true);
boolean doEdit = ParamUtils.getBooleanParameter(request,"doEdit");
pageContext.write(_jsp_string1, 0, _jsp_string1.length);
////////////////////
//
boolean noGroupSpecified = (groupID<0);
pageContext.write(_jsp_string1, 0, _jsp_string1.length);
//////////////////////////////////
// global error variables
String errorMessage = "";
boolean errorGroupName = (newGroupName == null);
boolean errorGroupAlreadyExists = false;
boolean errorNoPermissionToEdit = false;
boolean errorGroupNotFound = false;
boolean errors = (noGroupSpecified);
System.err.println( "errors: " + errors );
pageContext.write(_jsp_string3, 0, _jsp_string3.length);
////////////////////////////////////////////////////////////////
// if there are no errors at this point, start the process of
// adding the user
ProfileManager manager = forumFactory.getProfileManager();
Group thisGroup = null;
if( !errors ) {
try {
thisGroup = manager.getGroup(groupID);
} catch( GroupNotFoundException gnfe ) {
errorGroupNotFound = true;
System.err.println( "groupNotFoundException" );
}
}
errors = (errors || (thisGroup==null));
if( !errors && doEdit ) {
// get a profile manager to edit user properties
try {
thisGroup.setName( newGroupName );
if( newGroupDescription != null ) {
thisGroup.setDescription( newGroupDescription );
}
}
catch( UnauthorizedException ue ) {
errorNoPermissionToEdit = true;
}
}
String name = null;
String description = null;
if( !errors ) {
name = thisGroup.getName();
description = thisGroup.getDescription();
}
pageContext.write(_jsp_string1, 0, _jsp_string1.length);
/////////////////////
// overall error check
errors = (errorGroupName || errorGroupAlreadyExists
|| errorNoPermissionToEdit);
pageContext.write(_jsp_string1, 0, _jsp_string1.length);
////////////////////
// set error messages
if( errors ) {
if( errorGroupName ) {
errorMessage = "请指定一个组名!";
}
else if( errorGroupAlreadyExists ) {
errorMessage = "这个组已经存在,请选择一个不同的名称!";
}
else if( errorNoPermissionToEdit ) {
errorMessage = "抱歉,您没有修改的权限!";
}
else if( errorGroupNotFound ) {
errorMessage = "组未找到!";
}
else {
errorMessage = "发生错误!";
}
}
pageContext.write(_jsp_string1, 0, _jsp_string1.length);
//////////////////////////////////////////////////////////////////////
// if a group was edited was successfully created, say so and return (to stop the
// jsp from executing
if( !errors ) {
request.setAttribute("message","Group was edited successfully!");
response.sendRedirect("groups.jsp");
return;
}
pageContext.write(_jsp_string4, 0, _jsp_string4.length);
///////////////////////
// pageTitleInfo variable (used by include/pageTitle.jsp)
String[] pageTitleInfo = { "组:修改组" };
pageContext.write(_jsp_string0, 0, _jsp_string0.length);
///////////////////
// pageTitle include
pageContext.write(_jsp_string0, 0, _jsp_string0.length);
pageContext.write(_jsp_string0, 0, _jsp_string0.length);
pageContext.write(_jsp_string1, 0, _jsp_string1.length);
pageContext.write(_jsp_string0, 0, _jsp_string0.length);
if( pageTitleInfo != null ) {
pageContext.write(_jsp_string5, 0, _jsp_string5.length);
for( int i=0; i<pageTitleInfo.length; i++ ){
pageContext.write(_jsp_string6, 0, _jsp_string6.length);
out.print(( pageTitleInfo[i] ));
pageContext.write(_jsp_string6, 0, _jsp_string6.length);
if( (i+1)<pageTitleInfo.length ) {
pageContext.write(_jsp_string7, 0, _jsp_string7.length);
}
pageContext.write(_jsp_string8, 0, _jsp_string8.length);
}
pageContext.write(_jsp_string9, 0, _jsp_string9.length);
}
pageContext.write(_jsp_string0, 0, _jsp_string0.length);
pageContext.write(_jsp_string10, 0, _jsp_string10.length);
////////////////////
// display a list of groups to edit if no group was specified:
if( noGroupSpecified ) {
String formAction = "edit";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -