package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.apache.jasper.runtime.*;
import com.opensymphony.module.user.UserManager;
import java.util.Collection;
import java.util.Iterator;
import com.opensymphony.module.user.User;
import java.net.URLEncoder;
public class users_jsp extends HttpJspBase {
private static java.util.Vector _jspx_includes;
static {
_jspx_includes = new java.util.Vector(1);
_jspx_includes.add("/manager/nav.jsp");
}
public java.util.List getIncludes() {
return _jspx_includes;
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
JspFactory _jspxFactory = null;
javax.servlet.jsp.PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
try {
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html;ISO-8859-1");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n\r\n");
UserManager um = UserManager.getInstance();
if (request.getParameter("adduser") != null)
{
User newuser = um.createUser(request.getParameter("name"));
newuser.setPassword(request.getParameter("password"));
newuser.setEmail(request.getParameter("email"));
}
else if (request.getParameter("deluser") != null)
{
User removeuser = um.getUser(request.getParameter("deluser"));
removeuser.remove();
}
out.write("\r\n\r\n");
out.write("<h1>Users");
out.write("</h1>\r\n");
out.write("<hr>\r\n\r\n");
out.write("<ol>\r\n");
Collection users = um.getUsers();
for (Iterator iterator = users.iterator(); iterator.hasNext();)
{
User user = (User) iterator.next();
out.write("\r\n\t\t");
out.write("<li>");
out.print( user.getName() );
out.write(" (");
out.print( user.getEmail() );
out.write(") [");
out.write("<a href=\"viewuser.jsp?name=");
out.print( URLEncoder.encode(user.getName()) );
out.write("\">View");
out.write("</a> | ");
out.write("<a href=\"users.jsp?deluser=");
out.print( URLEncoder.encode(user.getName()) );
out.write("\">Del");
out.write("</a>]");
out.write("</li>\r\n\t\t");
}
out.write("\r\n");
out.write("</ol>\r\n\r\n");
out.write("<hr>\r\n\r\n");
out.write("<form action=\"users.jsp\">\r\n");
out.write("<b>Add User");
out.write("</b>");
out.write("<br>\r\nName: ");
out.write("<input type=\"text\" name=\"name\">");
out.write("<br>\r\nPassword: ");
out.write("<input type=\"password\" name=\"password\">");
out.write("<br>\r\nEmail: ");
out.write("<input type=\"text\" name=\"email\">");
out.write("<br>\r\n");
out.write("<input type=\"submit\" name=\"adduser\" value=\"Add User\">\r\n");
out.write("</form>\r\n\r\n");
out.write("<hr>\r\n");
out.write("<a href=\"default.jsp\">Home");
out.write("</a> |\r\n");
out.write("<a href=\"users.jsp\">Users");
out.write("</a> |\r\n");
out.write("<a href=\"groups.jsp\">Groups");
out.write("</a>\r\n");
out.write("\r\n");
} catch (Throwable t) {
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (pageContext != null) pageContext.handlePageException(t);
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
}
}
}