/*
 * Generated by the Jasper component of Apache Tomcat
 * Version: Apache Tomcat/7.0.19
 * Generated at: 2012-03-19 16:00:07 UTC
 * Note: The last modified time of this file was set to
 *       the last modified time of the source file after
 *       generation to assist with modification tracking.
 */
package org.apache.jsp.roles;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import com.goldhuman.auth.AuthFilter;
import com.goldhuman.service.interfaces.LogInfo;
import com.goldhuman.service.interfaces.GMService;
import com.goldhuman.service.GMServiceImpl;
import org.apache.commons.logging.LogFactory;
import java.io.*;
import java.util.*;
import com.goldhuman.util.*;

public final class deleterole_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static final javax.servlet.jsp.JspFactory _jspxFactory =
          javax.servlet.jsp.JspFactory.getDefaultFactory();

  private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;

  static {
    _jspx_dependants = new java.util.HashMap<java.lang.String,java.lang.Long>(4);
    _jspx_dependants.put("/include/head.jsp", Long.valueOf(1330833145000L));
    _jspx_dependants.put("/include/topheader_nologin.jsp", Long.valueOf(1330837436000L));
    _jspx_dependants.put("/include/footer.jsp", Long.valueOf(1234891144000L));
    _jspx_dependants.put("/include/topheader.jsp", Long.valueOf(1330839661000L));
  }

  private javax.el.ExpressionFactory _el_expressionfactory;
  private org.apache.tomcat.InstanceManager _jsp_instancemanager;

  public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
    return _jspx_dependants;
  }

  public void _jspInit() {
    _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
    _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
  }

  public void _jspDestroy() {
  }

  public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
        throws java.io.IOException, javax.servlet.ServletException {

    final javax.servlet.jsp.PageContext pageContext;
    javax.servlet.http.HttpSession session = null;
    final javax.servlet.ServletContext application;
    final javax.servlet.ServletConfig config;
    javax.servlet.jsp.JspWriter out = null;
    final java.lang.Object page = this;
    javax.servlet.jsp.JspWriter _jspx_out = null;
    javax.servlet.jsp.PageContext _jspx_page_context = null;


    try {
      response.setContentType("text/html; charset=UTF-8");
      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");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");

	boolean showTag = false;
	if(request.getSession().getAttribute("username")!=null) showTag = true;
	

      out.write("\r\n");
      out.write("\r\n");
      out.write("<html>\r\n");
      out.write("<head>\r\n");
      out.write('\r');
      out.write('\n');
      out.write("  \r\n");
      out.write("</head>\r\n");
      out.write("<body>\r\n");
if(showTag)
{
		request.setCharacterEncoding("UTF-8");

	String userid = "";
	String roleid = "";
	String rolename = "";
	String biao = request.getParameter("biao");
	String strMsg = "";
	
	if (biao != null && biao.equals("1")) {
		userid = request.getParameter("userid");
	}
	if (biao != null && biao.equals("2")) {
		roleid = request.getParameter("roleid");
		if (roleid != null && roleid.trim().length() > 0) {
			try {
				int rid = Integer.parseInt(roleid);
				userid = (rid & 0xFFFFFFF0) + "";
			} catch (Exception e) {
				strMsg = "Please enter figures!&nbsp;"+e.getMessage();
			}
		}
	}
	if (biao != null && biao.equals("3")) {
		rolename = request.getParameter("rolename");
		if (rolename != null && rolename.trim().length() > 0) {
			try {
				GMService gs = new GMServiceImpl();
				int tem = gs.getRoleIdByName(rolename, new LogInfo());
				userid = (tem & 0xFFFFFFF0) + "";
			} catch (Exception e) {
				strMsg = "Not!";
			}
		}
	}


      out.write('\r');
      out.write('\n');
      out.write("\n");
      out.write("<table width=\"96%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n");
      out.write(" <tr><td align=\"center\"><img align=\"center\" src=\"/iashadmin/images/pw-header.jpg\"></td></tr>\n");
      out.write("<tr>\n");
      out.write("<td>\n");
      out.write("\t<table width=\"96%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n");
      out.write("\t<tr>\n");
      out.write("\t<td class=\"ver_10_black\" align=\"center\">\n");
      out.write("\t\t<a href=\"/iashadmin/roles/index.jsp\"><img src=\"/iashadmin/images/menu.png\" width=\"712\" height=\"22\" border=\"0\" usemap=\"#Map\" /></a></td>\n");
      out.write("\t</tr>\n");
      out.write("    </table>\n");
      out.write("</td></tr></table><br>\n");
      out.write("\n");
      out.write("<map name=\"Map\" id=\"Map\"><area shape=\"rect\" coords=\"584,5,634,14\" href=\"/iashadmin/logout.jsp\" /><area shape=\"rect\" coords=\"483,4,572,15\" href=\"/iashadmin/index.jsp\" /><area shape=\"rect\" coords=\"419,5,469,14\" href=\"/iashadmin/roles/chat.jsp\" /><area shape=\"rect\" coords=\"339,3,410,16\" href=\"/iashadmin/roles/serverctrl.jsp\" /><area shape=\"rect\" coords=\"267,4,330,16\" href=\"/iashadmin/server/index.jsp\" /><area shape=\"rect\" coords=\"170,4,259,15\" href=\"/iashadmin/roles/manage.jsp\" />\n");
      out.write("  <area shape=\"rect\" coords=\"76,4,157,15\" href=\"/iashadmin/roles/index.jsp\" />\n");
      out.write("</map>\n");
      out.write("  \r\n");
      out.write("<table width=\"800\" border=\"0\" align=\"center\" cellspacing=\"0\">\r\n");
      out.write(" <tr><td colspan=\"2\">&nbsp;</td></tr> \r\n");
      out.write(" <tr>\r\n");
      out.write("   <td colspan=\"2\" class=\"ver_12_black_b\"><center><a href=\"/iweb/roles/manage.jsp\">Opções de Personagens</a> -> Deletar Personagem</center></td></tr> \r\n");
      out.write("<tr><td colspan=\"2\">&nbsp;</td></tr>\r\n");
      out.write("<tr>\r\n");
      out.write("   <td width=\"5%\">&nbsp;</td>\r\n");
      out.write("   <td width=\"95%\" align=\"center\">\r\n");
      out.write("    <form name=\"form1\" action=\"deleterole.jsp\" method=\"post\">\r\n");
      out.write("\t<table width=\"46%\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\">\r\n");
      out.write("\r\n");
      out.write("\t  <tr>\r\n");
      out.write("\t    <td colspan=\"3\" class=\"ver_10_red\">");
      out.print(strMsg);
      out.write("</td>\r\n");
      out.write("\t  </tr>\r\n");
      out.write("\r\n");
      out.write("\t  <tr>\r\n");
      out.write("\t\t<td width=\"7%\"><input type=\"radio\" name=\"biao\" value=\"1\" onClick=\"show(1)\" checked=\"checked\"></td>\r\n");
      out.write("\t\t<td width=\"33%\" class=\"ver_10_black\">ID da Conta:</td>\r\n");
      out.write("\t\t<td width=\"60%\">\r\n");
      out.write("\t\t\t<div id=\"uid\" style=\"display:\">\r\n");
      out.write("\t\t\t  <input type=\"text\" name=\"userid\" value=\"");
      out.print(userid);
      out.write("\" size=\"16\" maxlength=\"10\"  class=\"text_field\"/>\r\n");
      out.write("\t\t\t</div>\r\n");
      out.write("\t\t</td>\r\n");
      out.write("\t   </tr>\r\n");
      out.write("\t   <tr>\r\n");
      out.write("\t\t <td><input type=\"radio\" name=\"biao\" value=\"2\" onClick=\"show(2)\"></td>\r\n");
      out.write("\t\t <td class=\"ver_10_black\">ID do Perso.:</td>\r\n");
      out.write("\t\t <td>\r\n");
      out.write("\t\t   <div id=\"rid\" style=\"display:none\">\r\n");
      out.write("\t\t\t  <input type=\"text\" name=\"roleid\" value=\"");
      out.print(roleid);
      out.write("\" size=\"16\" maxlength=\"10\"  class=\"text_field\"/>\r\n");
      out.write("\t\t\t</div>\r\n");
      out.write("\t\t </td>\r\n");
      out.write("\t\t</tr>\r\n");
      out.write("\t   <tr>\r\n");
      out.write("\t\t <td><input type=\"radio\" name=\"biao\" value=\"3\" onClick=\"show(3)\"></td>\r\n");
      out.write("\t\t <td class=\"ver_10_black\">Nome do Perso.:</td>\r\n");
      out.write("\t\t <td>\r\n");
      out.write("\t\t\t<div id=\"rname\" style=\"display:none\">\r\n");
      out.write("\t\t\t\t<input type=\"text\" name=\"rolename\" value=\"");
      out.print(rolename);
      out.write("\" size=\"16\" maxlength=\"10\" class=\"text_field\" />\r\n");
      out.write("\t\t\t</div>\t\t \r\n");
      out.write("\t\t </td>\r\n");
      out.write("\t\t</tr>\r\n");
      out.write("\t   <tr>\r\n");
      out.write("\t\t <td colspan=\"2\">&nbsp;</td>\r\n");
      out.write("\t\t <td>\r\n");
      out.write("\t\t   <input type=\"submit\" value=\"Deletar...\" class=\"button\"></td>\r\n");
      out.write("\t\t</tr>\r\n");
      out.write("     </table>\r\n");
      out.write("\t</form>\r\n");

		LogInfo info = null;
		int uid = -1;
		GMService gs = new GMServiceImpl();
		if (userid != null && userid.trim().length() > 0) {
			try {
				uid = Integer.parseInt(userid);
			} catch (Exception e) { 
      out.write("\r\n");
      out.write("\t\t\t    <br>\r\n");
      out.write("\t\t\t    <span class=\"ver_10_red\">Digite o ID de Usuario&nbsp;");
      out.print( e.getMessage());
      out.write("</span><br>\r\n");
			    
			}
			
			info = new LogInfo(uid, "", "Delete Role");

			int flag = gs.deleteRole(uid, rolename, info);
			String result = null;
			
			switch (flag) {
				case 0:
					result = "Personagem removido com sucesso!";
					break;

				case 3:
					result = "Personagem não existe.";
					break;

				case 4:
					result = "O personagem não pertence a este usuario.";
					break;

				case -1:
					result = "TimeOut.";
				}

				
      out.write("\r\n");
      out.write("\t<br><br>\r\n");
      out.write("\t<table width=\"80%\" cellspacing=\"1\" cellpadding=\"3\" bgcolor=\"#000000\">\r\n");
      out.write("\t  <tr>\r\n");
      out.write("\t    <td width=\"20%\" class=\"ver_10_white\" align=\"center\">ID da Conta</td>\r\n");
      out.write("\t    <td width=\"30%\" class=\"ver_10_white\" align=\"center\">Personagem</td>\r\n");
      out.write("\t    <td width=\"50%\" class=\"ver_10_white\" align=\"center\">Resultado</td>\r\n");
      out.write("\t  </tr>\r\n");
      out.write("\t  <tr bgcolor=\"#FFFFFF\">\r\n");
      out.write("\t    <td class=\"ver_10_black\">");
      out.print(uid);
      out.write("</td>\r\n");
      out.write("\t    <td class=\"ver_10_black\">");
      out.print(rolename);
      out.write("</td>\r\n");
      out.write("\t    <td class=\"ver_10_black\">");
      out.print(result);
      out.write("</td>\t    \t    \r\n");
      out.write("\t  </tr>\r\n");
      out.write("\t</table>\r\n");
      out.write("   </td>\r\n");
      out.write("</tr>\r\n");
      out.write("</table>\r\n");
      out.write("<br>\r\n");

}} else 
{
      out.write('\r');
      out.write('\n');
      out.write("\n");
      out.write("<table width=\"96%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n");
      out.write(" <tr><td align=\"center\"><img align=\"center\" src=\"/iashadmin/images/pw-header.jpg\"></td></tr>\n");
      out.write("<tr>\n");
      out.write("<td>\n");
      out.write("\t<table width=\"96%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n");
      out.write("\t <tr><td class=\"ver_12_black_b\" colspan=\"7\" align=\"center\"><br><br>\n");
      out.write("\t Oi intruso,voce nao esta logado entao nao pode continuar  :)</td></tr> \n");
      out.write("\t <tr><td colspan=\"7\">&nbsp;</td></tr>\n");
      out.write("\t <tr>\n");
      out.write("\t  <td class=\"ver_10_black\" align=\"center\">\n");
      out.write("\t    Clique aqui para <a href=\"/iashadmin/loginform.jsp\">logar</a>.\n");
      out.write("\t  </td>\n");
      out.write("\t </tr>\n");
      out.write("    </table>\n");
      out.write("</td></tr></table><br>\n");

}
      out.write('\r');
      out.write('\n');
      out.write("<table width=\"96%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n");
      out.write("<tr>\n");
      out.write("\t<td align=\"center\"><img align=\"center\" src=\"/iweb/images/pw-footer.jpg\"></td>\n");
      out.write("</tr>\n");
      out.write("</table>\n");
      out.write("  \r\n");
      out.write("<script language=\"javascript\">\r\n");
      out.write("<!--\r\n");
      out.write("\r\n");
      out.write("    function show(t){\r\n");
      out.write("      if(t==1)\r\n");
      out.write("        document.getElementById(\"uid\").style.display=\"\";\r\n");
      out.write("      else\r\n");
      out.write("        document.getElementById(\"uid\").style.display=\"none\";\r\n");
      out.write("      if(t==2)  \r\n");
      out.write("        document.getElementById(\"rid\").style.display=\"\";\r\n");
      out.write("      else\r\n");
      out.write("        document.getElementById(\"rid\").style.display=\"none\";  \r\n");
      out.write("      if(t==3)\r\n");
      out.write("        document.getElementById(\"rname\").style.display=\"\";\r\n");
      out.write("      else \r\n");
      out.write("        document.getElementById(\"rname\").style.display=\"none\";            \r\n");
      out.write("    \r\n");
      out.write("    }\r\n");
      out.write("\r\n");
      out.write("//-->\r\n");
      out.write("</script>\r\n");
      out.write("</body>\r\n");
      out.write("</html>\r\n");
      out.write("\r\n");
    } catch (java.lang.Throwable t) {
      if (!(t instanceof javax.servlet.jsp.SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try { out.clearBuffer(); } catch (java.io.IOException e) {}
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}
