/*
 * Generated by the Jasper component of Apache Tomcat
 * Version: Apache Tomcat/7.0.19
 * Generated at: 2012-03-29 06:32:53 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 java.lang.*;
import java.io.*;
import protocol.*;
import com.goldhuman.auth.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.goldhuman.util.*;

public final class saverolexml_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(1332996282000L));
    _jspx_dependants.put("/include/footer.jsp", Long.valueOf(1332996547000L));
    _jspx_dependants.put("/include/topheader.jsp", Long.valueOf(1332995893000L));
  }

  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");

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

      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)
{
	int roleid = Integer.parseInt(request.getParameter("roleid"));
	String xmlstring = request.getParameter("rolexml");

	boolean success = false;
	try 
	{
		XmlRole.Role role = XmlRole.fromXML( xmlstring.getBytes("UTF-8") );
		role.base.id = roleid;
		success = XmlRole.putRoleToDB( roleid, role );

		Runtime.getRuntime().exec("/bin/mkdir -p /var/spool/rolexml/incoming");
		(new FileOutputStream("/var/spool/rolexml/incoming/"+roleid+"_"+(success?"ok":"fail")+"_"+System.currentTimeMillis()/1000+".xml")).write(xmlstring.getBytes("UTF-8"));
	}
	catch (Exception e) 
	{ 
		out.println(e.toString()); 
		return; 
	}

      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=\"http://1.bp.blogspot.com/-4IDvG58kMzY/Tgc7-L4wb8I/AAAAAAAACUw/5V7s9qBKIVQ/s1600/header102610genesisclas.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=\"100%\" height=\"350\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#FFFFFF\">\r\n");
      out.write("\t<tr>\r\n");
      out.write("\t\t<td>\r\n");
      out.write("\t\t\t<table width=\"30%\" height=\"200\" align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#FFFFFF\">\r\n");
      out.write("\t\t\t\t<tr>\r\n");
      out.write("\t\t\t\t\t<td height=\"350\">");

						if( success )
							out.print( "<center>Alterado com sucesso!</center>" );
						else
							out.print( "<center>Erro!</center>" );
      out.write("\r\n");
      out.write("\t\t\t\t\t</td>\r\n");
      out.write("\t\t\t\t</tr>\r\n");
      out.write("\t\t\t</table>\r\n");
      out.write("\t\t</td>\r\n");
      out.write("\t</tr>\r\n");
      out.write("</table>");

} 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=\"http://1.bp.blogspot.com/-4IDvG58kMzY/Tgc7-L4wb8I/AAAAAAAACUw/5V7s9qBKIVQ/s1600/header102610genesisclas.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 Administrador, Efetue login para 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=\"\"></td>\n");
      out.write("</tr>\n");
      out.write("</table>\n");
      out.write("\r\n");
      out.write("</body>\r\n");
      out.write("</html> \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);
    }
  }
}
