package org.apache.jsp.webcontent.birt.pages.layout;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.eclipse.birt.report.resource.BirtResources;
import org.eclipse.birt.report.context.BaseAttributeBean;
import org.eclipse.birt.report.utility.ParameterAccessor;
import org.eclipse.birt.report.presentation.aggregation.IFragment;
import org.eclipse.birt.report.resource.BirtResources;
import org.eclipse.birt.report.utility.ParameterAccessor;
import org.eclipse.birt.report.IBirtConstants;
import org.eclipse.birt.report.session.*;

public final class RequesterFragment_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.List<java.lang.String> _jspx_dependants;

  static {
    _jspx_dependants = new java.util.ArrayList<java.lang.String>(2);
    _jspx_dependants.add("/webcontent/birt/pages/layout/../common/Locale.jsp");
    _jspx_dependants.add("/webcontent/birt/pages/layout/../common/Attributes.jsp");
  }

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

  public java.util.List<java.lang.String> 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;
    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, false, 0, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write('\n');
      org.eclipse.birt.report.presentation.aggregation.IFragment fragment = null;
      fragment = (org.eclipse.birt.report.presentation.aggregation.IFragment) _jspx_page_context.getAttribute("fragment", javax.servlet.jsp.PageContext.REQUEST_SCOPE);
      if (fragment == null){
        throw new java.lang.InstantiationException("bean fragment not found within scope");
      }
      out.write('\n');
      org.eclipse.birt.report.context.BaseAttributeBean attributeBean = null;
      attributeBean = (org.eclipse.birt.report.context.BaseAttributeBean) _jspx_page_context.getAttribute("attributeBean", javax.servlet.jsp.PageContext.REQUEST_SCOPE);
      if (attributeBean == null){
        throw new java.lang.InstantiationException("bean attributeBean not found within scope");
      }
      out.write('\n');
      out.write('\n');

	// base href can be defined in config file for deployment.
	String baseHref = request.getScheme( ) + "://" + request.getServerName( ) + ":" + request.getServerPort( );
	if( !attributeBean.isDesigner( ) )
	{
		String baseURL = ParameterAccessor.getBaseURL( );
		if( baseURL != null )
			baseHref = baseURL;
	}
	baseHref += request.getContextPath( ) + fragment.getJSPRootPath( );

      out.write("\n");
      out.write("\n");
      out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n");
      out.write("<HTML>\n");
      out.write("\t<HEAD>\n");
      out.write("\t\t<TITLE>PARAMETER SELECTION PAGE</TITLE>\n");
      out.write("\t\t<BASE href=\"");
      out.print( baseHref );
      out.write("\" >\n");
      out.write("\t\t\n");
      out.write("\t\t<!-- Mimics Internet Explorer 7, it just works on IE8. -->\n");
      out.write("\t\t<META HTTP-EQUIV=\"X-UA-Compatible\" CONTENT=\"IE=EmulateIE7\">\n");
      out.write("\t\t<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=utf-8\">\n");
      out.write("\t\t<LINK REL=\"stylesheet\" HREF=\"birt/styles/style.css\" TYPE=\"text/css\">\n");
      out.write("\t\t");

		if( attributeBean.isRtl() )
		{
		
      out.write("\n");
      out.write("\t\t<LINK REL=\"stylesheet\" HREF=\"birt/styles/dialogbase_rtl.css\" MEDIA=\"screen\" TYPE=\"text/css\"/>\n");
      out.write("\t\t");

		}
		else
		{
		
      out.write("\n");
      out.write("\t\t<LINK REL=\"stylesheet\" HREF=\"birt/styles/dialogbase.css\" MEDIA=\"screen\" TYPE=\"text/css\"/>\t\n");
      out.write("\t\t");

		}
		
      out.write("\t\t\t\n");
      out.write("\n");
      out.write("\t\t<script type=\"text/javascript\">\n");
      out.write("\t\t\t");

			if( request.getAttribute("SoapURL") != null )
			{
			
      out.write("\n");
      out.write("\t\t\tvar soapURL = \"");
      out.print( (String)request.getAttribute("SoapURL"));
      out.write("\";\n");
      out.write("\t\t\t");

			}
			else
			{
			
      out.write("\n");
      out.write("\t\t\tvar soapURL = document.location.href;\n");
      out.write("\t\t\t");

			}
			
      out.write("\n");
      out.write("\t\t\tvar rtl = ");
      out.print( attributeBean.isRtl( ) );
      out.write(";\n");
      out.write("\t\t</script>\n");
      out.write("\t\t\n");
      out.write("\t\t<SCRIPT SRC=\"birt/ajax/utility/Debug.js\" type=\"text/javascript\"></script>\n");
      out.write("\t\t<script src=\"birt/ajax/lib/prototype.js\" type=\"text/javascript\"></script>\n");
      out.write("\t\t\n");
      out.write("\t\t<!-- Mask -->\n");
      out.write("\t\t<script src=\"birt/ajax/core/Mask.js\" type=\"text/javascript\"></script>\n");
      out.write("\t\t<script src=\"birt/ajax/utility/BrowserUtility.js\" type=\"text/javascript\"></script>\n");
      out.write("\t\t\n");
      out.write("\t\t<!-- Drag and Drop -->\n");
      out.write("\t\t<script src=\"birt/ajax/core/BirtDndManager.js\" type=\"text/javascript\"></script>\n");
      out.write("\t\t\n");
      out.write("\t\t<script src=\"birt/ajax/utility/Constants.js\" type=\"text/javascript\"></script>\n");
      out.write("\t\t<script src=\"birt/ajax/utility/BirtUtility.js\" type=\"text/javascript\"></script>\n");
      out.write("\t\t\n");
      out.write("\t\t<script src=\"birt/ajax/core/BirtEventDispatcher.js\" type=\"text/javascript\"></script>\n");
      out.write("\t\t<script src=\"birt/ajax/core/BirtEvent.js\" type=\"text/javascript\"></script>\n");
      out.write("\t\t\n");
      out.write("\t\t<script src=\"birt/ajax/mh/BirtBaseResponseHandler.js\" type=\"text/javascript\"></script>\n");
      out.write("\t\t<script src=\"birt/ajax/mh/BirtGetUpdatedObjectsResponseHandler.js\" type=\"text/javascript\"></script>\n");
      out.write("\n");
      out.write("\t\t<script src=\"birt/ajax/ui/app/AbstractUIComponent.js\" type=\"text/javascript\"></script>\n");
      out.write("\t\t<script src=\"birt/ajax/ui/app/BirtProgressBar.js\" type=\"text/javascript\"></script>\n");
      out.write("\n");
      out.write(" \t\t<script src=\"birt/ajax/ui/report/AbstractReportComponent.js\" type=\"text/javascript\"></script>\n");
      out.write(" \t\t<script src=\"birt/ajax/ui/report/AbstractBaseReportDocument.js\" type=\"text/javascript\"></script>\n");
      out.write("\t\t<script src=\"birt/ajax/ui/report/BirtReportDocument.js\" type=\"text/javascript\"></script>\n");
      out.write("\n");
      out.write("\t\t<script src=\"birt/ajax/ui/dialog/AbstractBaseDialog.js\" type=\"text/javascript\"></script>\n");
      out.write("\t\t<script src=\"birt/ajax/ui/dialog/AbstractParameterDialog.js\" type=\"text/javascript\"></script>\n");
      out.write("\t\t<script src=\"birt/ajax/ui/dialog/BirtParameterDialog.js\" type=\"text/javascript\"></script>\n");
      out.write("\t\t<script src=\"birt/ajax/ui/dialog/AbstractExceptionDialog.js\" type=\"text/javascript\"></script>\n");
      out.write("\t\t<script src=\"birt/ajax/ui/dialog/BirtExceptionDialog.js\" type=\"text/javascript\"></script>\n");
      out.write("\t\t\n");
      out.write("\t\t<SCRIPT SRC=\"birt/ajax/utility/BirtPosition.js\" type=\"text/javascript\"></script>\n");
      out.write("\n");
      out.write("\t\t<SCRIPT SRC=\"birt/ajax/core/BirtCommunicationManager.js\" type=\"text/javascript\"></script>\n");
      out.write("\t\t<SCRIPT SRC=\"birt/ajax/core/BirtSoapRequest.js\" type=\"text/javascript\"></script>\n");
      out.write("\t\t<SCRIPT SRC=\"birt/ajax/core/BirtSoapResponse.js\" type=\"text/javascript\"></script>\n");
      out.write("\t\t\t\t\n");
      out.write("\t</HEAD>\n");
      out.write("\n");
      out.write("\t<BODY CLASS=\"BirtViewer_Body\" onload=\"Javascript:init()\" SCROLL=\"no\" LEFTMARGIN='0px' STYLE='overflow:hidden'>\n");
      out.write("\t\t");

		if( attributeBean.isRtl() )
		{
		
      out.write("\n");
      out.write("\t\t<DIV DIR=\"rtl\">\n");
      out.write("\t\t");

		}
		
      out.write("\n");
      out.write("\t\t<!-- Header section -->\n");
      out.write("\t\t<TABLE ID='layout' CELLSPACING='0' CELLPADDING='0' STYLE='width:100%;height:100%'>\n");
      out.write("\t\t");

			if ( fragment != null )
			{
				fragment.callBack( request, response );
			}
		
      out.write("\n");
      out.write("\t\t</TABLE>\n");
      out.write("\t\t");

		if( attributeBean.isRtl() )
		{
		
      out.write("\n");
      out.write("\t\t</DIV>\n");
      out.write("\t\t");

		}
		
      out.write("\n");
      out.write("\t</BODY>\n");
      out.write("\t\n");
      out.write("\t");
      out.write('\n');
      out.write('\n');
      out.write("\n");
      out.write("<script type=\"text/javascript\">\n");
      out.write("// <![CDATA[\t\n");
      out.write("\t// Error msgs\n");
      out.write("\tConstants.error.invalidPageRange = '");
      out.print( BirtResources.getJavaScriptMessage( "birt.viewer.dialog.page.error.invalidpagerange" ));
      out.write("';\n");
      out.write("\tConstants.error.parameterRequired = '");
      out.print( BirtResources.getJavaScriptMessage( "birt.viewer.error.parameterrequired" ));
      out.write("';\n");
      out.write("\tConstants.error.parameterNotAllowBlank = '");
      out.print( BirtResources.getJavaScriptMessage( "birt.viewer.error.parameternotallowblank" ));
      out.write("';\n");
      out.write("\tConstants.error.parameterNotSelected = '");
      out.print( BirtResources.getJavaScriptMessage( "birt.viewer.error.parameternotselected" ));
      out.write("';\n");
      out.write("\tConstants.error.invalidPageNumber = '");
      out.print( BirtResources.getJavaScriptMessage( "birt.viewer.navbar.error.blankpagenum" ));
      out.write("';\n");
      out.write("\tConstants.error.unknownError = '");
      out.print( BirtResources.getJavaScriptMessage( "birt.viewer.error.unknownerror" ));
      out.write("';\n");
      out.write("\tConstants.error.generateReportFirst = '");
      out.print( BirtResources.getJavaScriptMessage( "birt.viewer.error.generatereportfirst" ));
      out.write("';\n");
      out.write("\tConstants.error.printPreviewAlreadyOpen = '");
      out.print( BirtResources.getJavaScriptMessage( "birt.viewer.dialog.print.printpreviewalreadyopen" ));
      out.write("';\n");
      out.write("\tConstants.error.confirmCancelTask = '");
      out.print( BirtResources.getJavaScriptMessage( "birt.viewer.progressbar.confirmcanceltask" ));
      out.write("';\n");
      out.write("// ]]>\n");
      out.write("</script>\n");
      out.write('	');
      out.write('\n');
      out.write('	');
      out.write('\n');
      out.write('\n');
      out.write("\n");
      out.write("<script type=\"text/javascript\">\n");
      out.write("// <![CDATA[\n");
      out.write("            \n");
      out.write("    Constants.nullValue = '");
      out.print( IBirtConstants.NULL_VALUE );
      out.write("';\n");
      out.write("    \n");
      out.write("\t// Request attributes\n");
      out.write("\tif ( !Constants.request )\n");
      out.write("\t{\n");
      out.write("\t\tConstants.request = {};\n");
      out.write("\t}\n");
      out.write("\tConstants.request.format = '");
      out.print( ParameterAccessor.getFormat(request) );
      out.write("';\n");
      out.write("\tConstants.request.rtl = ");
      out.print( ParameterAccessor.isRtl( request ) );
      out.write(";\n");
      out.write("\tConstants.request.isDesigner = ");
      out.print( ParameterAccessor.isDesigner() );
      out.write(";\n");
      out.write("\tConstants.request.servletPath = \"");
      out.print( request.getAttribute( "ServletPath" ) );
      out.write("\".substr(1);\n");
      out.write("\t");
  IViewingSession viewingSession = ViewingSessionUtil.getSession(request);
		String subSessionId = null;
		if ( viewingSession != null )
		{
			subSessionId = viewingSession.getId();
		}
      out.write("\n");
      out.write("\tConstants.viewingSessionId = ");
      out.print( subSessionId!=null?"\"" + subSessionId + "\"":"null" );
      out.write(";\t\n");
      out.write("// ]]>\n");
      out.write("</script>\n");
      out.write("\t\n");
      out.write("\t\n");
      out.write("\t<script type=\"text/javascript\">\n");
      out.write("\t// <![CDATA[\n");
      out.write("\t\tvar hasSVGSupport = false;\n");
      out.write("\t\tvar useVBMethod = false;\n");
      out.write("\t\tif ( navigator.mimeTypes != null && navigator.mimeTypes.length > 0 )\n");
      out.write("\t\t{\n");
      out.write("\t\t    if ( navigator.mimeTypes[\"image/svg+xml\"] != null )\n");
      out.write("\t\t    {\n");
      out.write("\t\t        hasSVGSupport = true;\n");
      out.write("\t\t    }\n");
      out.write("\t\t}\n");
      out.write("\t\telse\n");
      out.write("\t\t{\n");
      out.write("\t\t    useVBMethod = true;\n");
      out.write("\t\t}\n");
      out.write("\t\t\n");
      out.write("\t// ]]>\n");
      out.write("\t</script>\n");
      out.write("\t\n");
      out.write("\t<SCRIPT TYPE=\"text/vbscript\">\n");
      out.write("\t\tOn Error Resume Next\n");
      out.write("\t\tIf useVBMethod = true Then\n");
      out.write("\t\t    hasSVGSupport = IsObject(CreateObject(\"Adobe.SVGCtl\"))\n");
      out.write("\t\tEnd If\n");
      out.write("\t</SCRIPT>\n");
      out.write("\n");
      out.write("\t<SCRIPT TYPE=\"text/javascript\">\t\t\n");
      out.write("\t\tvar Mask =  new Mask( false );\n");
      out.write("\t\tvar BrowserUtility = new BrowserUtility( );\n");
      out.write("\t\tvar DragDrop = new BirtDndManager( );\n");
      out.write("\n");
      out.write("\t\tvar birtProgressBar = new BirtProgressBar( 'progressBar' );\n");
      out.write("\t\tvar birtReportDocument = new BirtReportDocument( \"Document\" );\n");
      out.write("\n");
      out.write("\t\tvar parameterMode;\n");
      out.write("\t\tif ( Constants.request.servletPath == Constants.SERVLET_PARAMETER )\n");
      out.write("\t\t{\n");
      out.write("\t\t\tparameterMode = Constants.SERVLET_PARAMETER;\n");
      out.write("\t\t}\n");
      out.write("\t\telse\n");
      out.write("\t\t{\n");
      out.write("\t\t\tparameterMode = Constants.SERVLET_PREVIEW;\n");
      out.write("\t\t}\n");
      out.write("\t\t\n");
      out.write("\t\tvar birtParameterDialog = new BirtParameterDialog( 'parameterDialog', parameterMode );\n");
      out.write("\t\tvar birtExceptionDialog = new BirtExceptionDialog( 'exceptionDialog' );\n");
      out.write("\t\t\n");
      out.write("\t\tfunction init( )\n");
      out.write("\t\t{\t\t\t\t\t\n");
      out.write("\t\t\tsoapURL = birtUtility.initSessionId( soapURL );\n");
      out.write("\t\t\tbirtParameterDialog.__cb_bind( );\n");
      out.write("\t\t}\n");
      out.write("\t\t\n");
      out.write("\t</SCRIPT>\n");
      out.write("</HTML>\n");
      out.write("\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);
    }
  }
}
