📄 listpath_jsp.java
字号:
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import com.yoyorock.svnadmin.*;
import java.util.*;
import java.net.*;
public final class listpath_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static java.util.Vector _jspx_dependants;
static {
_jspx_dependants = new java.util.Vector(1);
_jspx_dependants.add("/define.jsp");
}
public java.util.List getDependants() {
return _jspx_dependants;
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
JspFactory _jspxFactory = null;
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html; charset=GBK");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n\r\n\r\n\r\n");
out.write('\r');
out.write('\n');
response.setHeader("Cache-Control", "no-store");
response.setHeader("Pragma", "no-cache");
response.setDateHeader("Expires",0);
request.setCharacterEncoding("GBK");
final String RESPOSITORY_ROOT = "C:/test";
out.write('\r');
out.write('\n');
out.write("\r\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\" />\r\n<title>SVNADMIN,权限列表</title>\r\n<style type=\"text/css\">\r\n<!--\r\nbody {\r\n\tmargin-left: 0px;\r\n\tmargin-top: 0px;\r\n\tmargin-right: 0px;\r\n\tmargin-bottom: 0px;\r\n}\r\nbody,td,th {\r\n\tfont-size: 14px;\r\n}\r\n-->\r\n</style></head>\r\n<script language=\"javascript\">\r\nfunction deluser(strUser)\r\n{\r\n if(window.confirm(\"您是否真的要删除用户[\"+strUser+\"]?\"))\r\n {\r\n\twindow.location.href=\"deluser.jsp?user=\"+strUser;\r\n }\r\n}\r\n\r\nfunction deluserpath(strUser,strPath)\r\n{\r\n if(window.confirm(\"您是否真的要删除用户[\"+strUser+\"]在目录[\"+strPath+\"]的权限设置?\"))\r\n {\r\n\treturn true;\r\n }\r\n return false;\r\n}\r\n</script>\r\n<body >\r\n\r\n");
String strLogined;
String strUsername;
String strUserpwd;
String strRepository;
RightControl rightCtrl;
try
{
rightCtrl =(RightControl)session.getAttribute("rightCtrl");
strLogined = (String)session.getAttribute("strLogined");
strUsername = (String)session.getAttribute("strUsername");
strRepository = (String)session.getAttribute("strRepository");
if (null == strLogined)
{
strLogined = "no";
}
if (!strLogined.equals("yes") || null == rightCtrl
|| null == strUsername || null == strRepository)
{
//未登陆
//out.write("strLogined = " + strLogined + "<br>\r\n");
//out.write("strUsername = " + strUsername + "<br>\r\n");
//out.write("strRepository = " + strRepository + "<br>\r\n");
//out.write("rightCtrl = " + rightCtrl.toString() + "<br>\r\n");
response.sendRedirect(response.encodeRedirectURL("index.jsp"));
return;
}
/*
out.println("strRepository =" +strRepository);
if (!rightCtrl.syncFromFiles(RESPOSITORY_ROOT, strRepository))
{
//读仓库文件失败
response.sendRedirect(response.encodeRedirectURL("index.jsp"));
return;
}
*/
if (strUsername.equals(strRepository+"admin"))
{
//管理员,列出所有人的目录,可增加、修改、删除权限,可增加用户
out.write("\r\n<table width=\"100%\" border=\"0\" cellpadding=\"4\" cellspacing=\"1\" bgcolor=\"#6699FF\">\r\n <tr>\r\n <td bgcolor=\"#99CCFF\"><table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n <tr>\r\n <td width=\"27%\" nowrap=\"nowrap\"><strong>SVN权限管理,仓库[");
out.print( strRepository);
out.write("],管理员[");
out.print( strUsername);
out.write("]</strong></td>\r\n <td width=\"73%\" align=\"right\" nowrap=\"nowrap\">[<a href=\"adduser.jsp\">新增用户</a>][<a href=\"changepwd.jsp\">修改密码</a>][<a href=\"logout.jsp\">退出</a>]</td>\r\n </tr>\r\n </table></td>\r\n </tr>\r\n</table>\r\n<br />\r\n");
Set userSet = rightCtrl.getUsersMap().keySet();
for (Iterator iterUser = userSet.iterator(); iterUser.hasNext(); )
{
String strUser = (String) (iterUser.next());
UserInfo ui = rightCtrl.getUserInfo(strUser);
if (null != ui)
{
out.write("\r\n<table width=\"95%\" border=\"0\" align=\"center\" cellpadding=\"4\" cellspacing=\"1\" bgcolor=\"#6699FF\">\r\n <tr>\r\n <td align=\"left\" bgcolor=\"#C4E1FF\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n <tr>\r\n <td width=\"2%\"><img src=\"user.gif\" width=\"16\" height=\"16\" /> </td>\r\n <td width=\"98%\" nowrap=\"nowrap\"><strong>");
out.print(strUser);
out.write("</strong></td>\r\n <td width=\"98%\" align=\"right\" nowrap=\"nowrap\">[<a href=\"javascript:deluser('");
out.print(strUser);
out.write("');\">删除本用户</a>] [<a href=\"addright.jsp?rightuser=");
out.print(strUser);
out.write("\">增加目录权限</a>] </td>\r\n </tr>\r\n </table>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td bgcolor=\"#FFFFFF\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n");
Set rightSet = ui.getRightsMap().keySet();
for (Iterator iterRight = rightSet.iterator(); iterRight.hasNext(); )
{
String strPath = (String) (iterRight.next());
String strRight = (String)ui.getPathRight(strPath);
String strImg = "";
if (strRight.equals("rw"))
strImg = "readwrite.bmp";
else if (strRight.equals("r"))
strImg = "readonly.bmp";
else
strImg = "noaccess.bmp";
out.write("\r\n <tr>\r\n <td><table width=\"98%\" border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"0\">\r\n <tr>\r\n <td width=\"2%\"><img src=\"");
out.print(strImg);
out.write("\" width=\"20\" height=\"20\" /></td>\r\n <td width=\"98%\" nowrap=\"nowrap\">"");
out.print(strPath );
out.write("" = ");
out.print(strRight );
out.write("</td>\r\n <td width=\"98%\" align=\"right\" nowrap=\"nowrap\">[<a href=\"delright.jsp?rightuser=");
out.print(strUser );
out.write("&path=");
out.print(URLEncoder.encode(strPath,"GBK"));
out.write("\">删除</a>]\r\n\t\t\t [<a href=\"addright.jsp?rightuser=");
out.print(strUser );
out.write("&path=");
out.print(URLEncoder.encode(strPath,"GBK"));
out.write("&right=");
out.print(strRight );
out.write("&show=1\">修改</a>]</td>\r\n </tr>\r\n </table></td>\r\n </tr>\r\n");
if (iterRight.hasNext())
{
out.write("\r\n <tr >\r\n\t <td>\r\n\t </td>\r\n </tr>\r\n <tr>\r\n\t <td height=\"1\" bgcolor=\"#CCCCFF\"></td>\r\n </tr>\r\n ");
}
}
out.write("\r\n </table>\r\n </td>\r\n </tr>\r\n</table>\r\n<p></p>\r\n");
}
}
}
else
{
//不是管理员,只列出自己有权限的目录
out.write("\r\n<table width=\"100%\" border=\"0\" cellpadding=\"4\" cellspacing=\"1\" bgcolor=\"#6699FF\">\r\n <tr>\r\n <td bgcolor=\"#99CCFF\"><table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n <tr>\r\n <td width=\"27%\" nowrap=\"nowrap\"><strong>SVN权限管理,仓库[");
out.print( strRepository);
out.write("],普通用户[");
out.print( strUsername);
out.write("]</strong></td>\r\n <td width=\"73%\" align=\"right\" nowrap=\"nowrap\">[<a href=\"changepwd.jsp\">修改密码</a>][<a href=\"logout.jsp\">退出</a>]</td>\r\n </tr>\r\n </table></td>\r\n </tr>\r\n</table>\r\n");
UserInfo ui = rightCtrl.getUserInfo(strUsername);
if (null != ui)
{
out.write("\r\n<table width=\"95%\" border=\"0\" align=\"center\" cellpadding=\"4\" cellspacing=\"1\" bgcolor=\"#6699FF\">\r\n <tr>\r\n <td align=\"left\" bgcolor=\"#C4E1FF\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n <tr>\r\n <td width=\"2%\"><img src=\"user.gif\" width=\"16\" height=\"16\" /> </td>\r\n <td width=\"98%\" nowrap=\"nowrap\"><strong>");
out.print(strUsername);
out.write("</strong></td>\r\n <td width=\"98%\" align=\"right\" nowrap=\"nowrap\"></td>\r\n </tr>\r\n </table>\r\n </td>\r\n </tr>\r\n");
Set keySet = ui.getRightsMap().keySet();
for (Iterator iterator = keySet.iterator(); iterator.hasNext(); )
{
String strPath = (String) (iterator.next());
String strRight = (String)ui.getPathRight(strPath);
out.write("\r\n <tr>\r\n <td bgcolor=\"#FFFFFF\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n <tr>\r\n <td><table width=\"98%\" border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"0\">\r\n <tr>\r\n <td width=\"2%\"><img src=\"toplink_out_05.gif\" width=\"11\" height=\"13\" /></td>\r\n <td width=\"98%\" nowrap=\"nowrap\">"");
out.print(strPath );
out.write("" = ");
out.print(strRight );
out.write("</td>\r\n <td width=\"98%\" align=\"right\" nowrap=\"nowrap\"></td>\r\n </tr>\r\n </table></td>\r\n </tr>\r\n <tr >\r\n <td>\r\n\t\t</td>\r\n </tr>\r\n <tr>\r\n <td height=\"1\" bgcolor=\"#CCCCFF\"></td>\r\n </tr>\r\n\r\n </table>\r\n </td>\r\n </tr>\r\n");
}
out.write("\r\n</table>\r\n<p></p>\r\n");
}
}
}
catch(Exception e)
{
}
out.write("\r\n</body>\r\n</html>\r\n");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
}
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -