diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3823824 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +target/ +nb-configuration.xml +.settings/ +.classpath +*.class \ No newline at end of file diff --git a/.project b/.project new file mode 100644 index 0000000..29338d5 --- /dev/null +++ b/.project @@ -0,0 +1,31 @@ + + + mirana-birt + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.jdt.core.javanature + org.eclipse.wst.jsdt.core.jsNature + + diff --git a/WebContent/CancelTask.jsp b/WebContent/CancelTask.jsp new file mode 100644 index 0000000..23ea014 --- /dev/null +++ b/WebContent/CancelTask.jsp @@ -0,0 +1,49 @@ +<%----------------------------------------------------------------------------- + Copyright (c) 2004 Actuate Corporation and others. + All rights reserved. This program and the accompanying materials + are made available under the terms of the Eclipse Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Contributors: + Actuate Corporation - Initial implementation. +-----------------------------------------------------------------------------%> +<%@ page contentType="text/html; charset=utf-8" %> +<%@ page session="false" buffer="none" %> +<%@ page import="org.eclipse.birt.report.utility.BirtUtility, + org.eclipse.birt.report.IBirtConstants, + org.eclipse.birt.report.resource.BirtResources" %> + +<%----------------------------------------------------------------------------- + Cancel Task +-----------------------------------------------------------------------------%> + + + + + <%= BirtResources.getMessage( "birt.viewer.title.message" )%> + + + " TYPE="text/css"> + + <% + String taskid = request.getParameter( IBirtConstants.OPRAND_TASKID ); + try + { + BirtUtility.cancelTask( request, taskid ); + } + catch( Exception e ) + { + e.printStackTrace( ); + } + %> + + + + + +
+ <%= BirtResources.getMessage( "birt.viewer.message.taskcanceled" )%> +
+ + \ No newline at end of file diff --git a/WebContent/META-INF/MANIFEST.MF b/WebContent/META-INF/MANIFEST.MF new file mode 100644 index 0000000..254272e --- /dev/null +++ b/WebContent/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/WebContent/WEB-INF/jrun.web.xml b/WebContent/WEB-INF/jrun.web.xml new file mode 100644 index 0000000..68dcc50 --- /dev/null +++ b/WebContent/WEB-INF/jrun.web.xml @@ -0,0 +1,6 @@ + + + false + UTF-8 + false + diff --git a/WebContent/WEB-INF/lib/axis-ant.jar b/WebContent/WEB-INF/lib/axis-ant.jar new file mode 100644 index 0000000..17527ff Binary files /dev/null and b/WebContent/WEB-INF/lib/axis-ant.jar differ diff --git a/WebContent/WEB-INF/lib/axis.jar b/WebContent/WEB-INF/lib/axis.jar new file mode 100644 index 0000000..20b09a5 Binary files /dev/null and b/WebContent/WEB-INF/lib/axis.jar differ diff --git a/WebContent/WEB-INF/lib/chartengineapi.jar b/WebContent/WEB-INF/lib/chartengineapi.jar new file mode 100644 index 0000000..f02a24e Binary files /dev/null and b/WebContent/WEB-INF/lib/chartengineapi.jar differ diff --git a/WebContent/WEB-INF/lib/chartexamplescoreapi.jar b/WebContent/WEB-INF/lib/chartexamplescoreapi.jar new file mode 100644 index 0000000..ddc185c Binary files /dev/null and b/WebContent/WEB-INF/lib/chartexamplescoreapi.jar differ diff --git a/WebContent/WEB-INF/lib/chartitemapi.jar b/WebContent/WEB-INF/lib/chartitemapi.jar new file mode 100644 index 0000000..9920768 Binary files /dev/null and b/WebContent/WEB-INF/lib/chartitemapi.jar differ diff --git a/WebContent/WEB-INF/lib/com.ibm.icu_56.1.0.v201601250100.jar b/WebContent/WEB-INF/lib/com.ibm.icu_56.1.0.v201601250100.jar new file mode 100644 index 0000000..8fc9c93 Binary files /dev/null and b/WebContent/WEB-INF/lib/com.ibm.icu_56.1.0.v201601250100.jar differ diff --git a/WebContent/WEB-INF/lib/com.lowagie.text_2.1.7.v201004222200.jar b/WebContent/WEB-INF/lib/com.lowagie.text_2.1.7.v201004222200.jar new file mode 100644 index 0000000..abff4b8 Binary files /dev/null and b/WebContent/WEB-INF/lib/com.lowagie.text_2.1.7.v201004222200.jar differ diff --git a/WebContent/WEB-INF/lib/commons-cli-1.0.jar b/WebContent/WEB-INF/lib/commons-cli-1.0.jar new file mode 100644 index 0000000..22a004e Binary files /dev/null and b/WebContent/WEB-INF/lib/commons-cli-1.0.jar differ diff --git a/WebContent/WEB-INF/lib/commons-discovery-0.2.jar b/WebContent/WEB-INF/lib/commons-discovery-0.2.jar new file mode 100644 index 0000000..b885548 Binary files /dev/null and b/WebContent/WEB-INF/lib/commons-discovery-0.2.jar differ diff --git a/WebContent/WEB-INF/lib/coreapi.jar b/WebContent/WEB-INF/lib/coreapi.jar new file mode 100644 index 0000000..793c705 Binary files /dev/null and b/WebContent/WEB-INF/lib/coreapi.jar differ diff --git a/WebContent/WEB-INF/lib/crosstabcoreapi.jar b/WebContent/WEB-INF/lib/crosstabcoreapi.jar new file mode 100644 index 0000000..a39cfc9 Binary files /dev/null and b/WebContent/WEB-INF/lib/crosstabcoreapi.jar differ diff --git a/WebContent/WEB-INF/lib/dataadapterapi.jar b/WebContent/WEB-INF/lib/dataadapterapi.jar new file mode 100644 index 0000000..42fad6e Binary files /dev/null and b/WebContent/WEB-INF/lib/dataadapterapi.jar differ diff --git a/WebContent/WEB-INF/lib/dataaggregationapi.jar b/WebContent/WEB-INF/lib/dataaggregationapi.jar new file mode 100644 index 0000000..0dcca82 Binary files /dev/null and b/WebContent/WEB-INF/lib/dataaggregationapi.jar differ diff --git a/WebContent/WEB-INF/lib/dataextraction.jar b/WebContent/WEB-INF/lib/dataextraction.jar new file mode 100644 index 0000000..9b12437 Binary files /dev/null and b/WebContent/WEB-INF/lib/dataextraction.jar differ diff --git a/WebContent/WEB-INF/lib/dteapi.jar b/WebContent/WEB-INF/lib/dteapi.jar new file mode 100644 index 0000000..0c8e6d7 Binary files /dev/null and b/WebContent/WEB-INF/lib/dteapi.jar differ diff --git a/WebContent/WEB-INF/lib/emitterconfig.jar b/WebContent/WEB-INF/lib/emitterconfig.jar new file mode 100644 index 0000000..60b42fe Binary files /dev/null and b/WebContent/WEB-INF/lib/emitterconfig.jar differ diff --git a/WebContent/WEB-INF/lib/engineapi.jar b/WebContent/WEB-INF/lib/engineapi.jar new file mode 100644 index 0000000..518cfae Binary files /dev/null and b/WebContent/WEB-INF/lib/engineapi.jar differ diff --git a/WebContent/WEB-INF/lib/flute.jar b/WebContent/WEB-INF/lib/flute.jar new file mode 100644 index 0000000..39a55d4 Binary files /dev/null and b/WebContent/WEB-INF/lib/flute.jar differ diff --git a/WebContent/WEB-INF/lib/javax.wsdl_1.5.1.v201012040544.jar b/WebContent/WEB-INF/lib/javax.wsdl_1.5.1.v201012040544.jar new file mode 100644 index 0000000..9005073 Binary files /dev/null and b/WebContent/WEB-INF/lib/javax.wsdl_1.5.1.v201012040544.jar differ diff --git a/WebContent/WEB-INF/lib/javax.xml.stream_1.0.1.v201004272200.jar b/WebContent/WEB-INF/lib/javax.xml.stream_1.0.1.v201004272200.jar new file mode 100644 index 0000000..be044e4 Binary files /dev/null and b/WebContent/WEB-INF/lib/javax.xml.stream_1.0.1.v201004272200.jar differ diff --git a/WebContent/WEB-INF/lib/javax.xml_1.3.4.v201005080400.jar b/WebContent/WEB-INF/lib/javax.xml_1.3.4.v201005080400.jar new file mode 100644 index 0000000..99ce4a7 Binary files /dev/null and b/WebContent/WEB-INF/lib/javax.xml_1.3.4.v201005080400.jar differ diff --git a/WebContent/WEB-INF/lib/jaxrpc.jar b/WebContent/WEB-INF/lib/jaxrpc.jar new file mode 100644 index 0000000..a2c13d9 Binary files /dev/null and b/WebContent/WEB-INF/lib/jaxrpc.jar differ diff --git a/WebContent/WEB-INF/lib/js.jar b/WebContent/WEB-INF/lib/js.jar new file mode 100644 index 0000000..832f668 Binary files /dev/null and b/WebContent/WEB-INF/lib/js.jar differ diff --git a/WebContent/WEB-INF/lib/jsp.jar b/WebContent/WEB-INF/lib/jsp.jar new file mode 100644 index 0000000..52fb012 Binary files /dev/null and b/WebContent/WEB-INF/lib/jsp.jar differ diff --git a/WebContent/WEB-INF/lib/modelapi.jar b/WebContent/WEB-INF/lib/modelapi.jar new file mode 100644 index 0000000..8014067 Binary files /dev/null and b/WebContent/WEB-INF/lib/modelapi.jar differ diff --git a/WebContent/WEB-INF/lib/modelodaapi.jar b/WebContent/WEB-INF/lib/modelodaapi.jar new file mode 100644 index 0000000..c968679 Binary files /dev/null and b/WebContent/WEB-INF/lib/modelodaapi.jar differ diff --git a/WebContent/WEB-INF/lib/net.sourceforge.lpg.lpgjavaruntime_1.1.0.v201004271650.jar b/WebContent/WEB-INF/lib/net.sourceforge.lpg.lpgjavaruntime_1.1.0.v201004271650.jar new file mode 100644 index 0000000..45a07ce Binary files /dev/null and b/WebContent/WEB-INF/lib/net.sourceforge.lpg.lpgjavaruntime_1.1.0.v201004271650.jar differ diff --git a/WebContent/WEB-INF/lib/odaconnectivity.jar b/WebContent/WEB-INF/lib/odaconnectivity.jar new file mode 100644 index 0000000..c295b7a Binary files /dev/null and b/WebContent/WEB-INF/lib/odaconnectivity.jar differ diff --git a/WebContent/WEB-INF/lib/odadesignapi.jar b/WebContent/WEB-INF/lib/odadesignapi.jar new file mode 100644 index 0000000..0c9a469 Binary files /dev/null and b/WebContent/WEB-INF/lib/odadesignapi.jar differ diff --git a/WebContent/WEB-INF/lib/org.apache.batik.bridge_1.6.0.v201011041432.jar b/WebContent/WEB-INF/lib/org.apache.batik.bridge_1.6.0.v201011041432.jar new file mode 100644 index 0000000..d14e24f Binary files /dev/null and b/WebContent/WEB-INF/lib/org.apache.batik.bridge_1.6.0.v201011041432.jar differ diff --git a/WebContent/WEB-INF/lib/org.apache.batik.css_1.6.0.v201011041432.jar b/WebContent/WEB-INF/lib/org.apache.batik.css_1.6.0.v201011041432.jar new file mode 100644 index 0000000..217a91b Binary files /dev/null and b/WebContent/WEB-INF/lib/org.apache.batik.css_1.6.0.v201011041432.jar differ diff --git a/WebContent/WEB-INF/lib/org.apache.batik.dom.svg_1.6.0.v201011041432.jar b/WebContent/WEB-INF/lib/org.apache.batik.dom.svg_1.6.0.v201011041432.jar new file mode 100644 index 0000000..2cc4fb3 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.apache.batik.dom.svg_1.6.0.v201011041432.jar differ diff --git a/WebContent/WEB-INF/lib/org.apache.batik.dom_1.6.1.v201505192100.jar b/WebContent/WEB-INF/lib/org.apache.batik.dom_1.6.1.v201505192100.jar new file mode 100644 index 0000000..1570ffe Binary files /dev/null and b/WebContent/WEB-INF/lib/org.apache.batik.dom_1.6.1.v201505192100.jar differ diff --git a/WebContent/WEB-INF/lib/org.apache.batik.ext.awt_1.6.0.v201011041432.jar b/WebContent/WEB-INF/lib/org.apache.batik.ext.awt_1.6.0.v201011041432.jar new file mode 100644 index 0000000..4a5b4d7 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.apache.batik.ext.awt_1.6.0.v201011041432.jar differ diff --git a/WebContent/WEB-INF/lib/org.apache.batik.parser_1.6.0.v201011041432.jar b/WebContent/WEB-INF/lib/org.apache.batik.parser_1.6.0.v201011041432.jar new file mode 100644 index 0000000..f260c7b Binary files /dev/null and b/WebContent/WEB-INF/lib/org.apache.batik.parser_1.6.0.v201011041432.jar differ diff --git a/WebContent/WEB-INF/lib/org.apache.batik.pdf_1.6.0.v201105071520.jar b/WebContent/WEB-INF/lib/org.apache.batik.pdf_1.6.0.v201105071520.jar new file mode 100644 index 0000000..9953eb3 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.apache.batik.pdf_1.6.0.v201105071520.jar differ diff --git a/WebContent/WEB-INF/lib/org.apache.batik.svggen_1.6.0.v201011041432.jar b/WebContent/WEB-INF/lib/org.apache.batik.svggen_1.6.0.v201011041432.jar new file mode 100644 index 0000000..b9bf20c Binary files /dev/null and b/WebContent/WEB-INF/lib/org.apache.batik.svggen_1.6.0.v201011041432.jar differ diff --git a/WebContent/WEB-INF/lib/org.apache.batik.transcoder_1.6.0.v201011041432.jar b/WebContent/WEB-INF/lib/org.apache.batik.transcoder_1.6.0.v201011041432.jar new file mode 100644 index 0000000..6c6666e Binary files /dev/null and b/WebContent/WEB-INF/lib/org.apache.batik.transcoder_1.6.0.v201011041432.jar differ diff --git a/WebContent/WEB-INF/lib/org.apache.batik.util.gui_1.6.0.v201011041432.jar b/WebContent/WEB-INF/lib/org.apache.batik.util.gui_1.6.0.v201011041432.jar new file mode 100644 index 0000000..f462e69 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.apache.batik.util.gui_1.6.0.v201011041432.jar differ diff --git a/WebContent/WEB-INF/lib/org.apache.batik.util_1.6.0.v201011041432.jar b/WebContent/WEB-INF/lib/org.apache.batik.util_1.6.0.v201011041432.jar new file mode 100644 index 0000000..1e9423c Binary files /dev/null and b/WebContent/WEB-INF/lib/org.apache.batik.util_1.6.0.v201011041432.jar differ diff --git a/WebContent/WEB-INF/lib/org.apache.batik.xml_1.6.0.v201011041432.jar b/WebContent/WEB-INF/lib/org.apache.batik.xml_1.6.0.v201011041432.jar new file mode 100644 index 0000000..e5bc288 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.apache.batik.xml_1.6.0.v201011041432.jar differ diff --git a/WebContent/WEB-INF/lib/org.apache.commons.codec_1.6.0.v201305230611.jar b/WebContent/WEB-INF/lib/org.apache.commons.codec_1.6.0.v201305230611.jar new file mode 100644 index 0000000..ce274ef Binary files /dev/null and b/WebContent/WEB-INF/lib/org.apache.commons.codec_1.6.0.v201305230611.jar differ diff --git a/WebContent/WEB-INF/lib/org.apache.commons.logging_1.1.1.v201101211721.jar b/WebContent/WEB-INF/lib/org.apache.commons.logging_1.1.1.v201101211721.jar new file mode 100644 index 0000000..5d51990 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.apache.commons.logging_1.1.1.v201101211721.jar differ diff --git a/WebContent/WEB-INF/lib/org.apache.derby_10.11.1.1_v201605202053.jar b/WebContent/WEB-INF/lib/org.apache.derby_10.11.1.1_v201605202053.jar new file mode 100644 index 0000000..7ffe568 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.apache.derby_10.11.1.1_v201605202053.jar differ diff --git a/WebContent/WEB-INF/lib/org.apache.lucene.core_3.5.0.v20120725-1805.jar b/WebContent/WEB-INF/lib/org.apache.lucene.core_3.5.0.v20120725-1805.jar new file mode 100644 index 0000000..f1c0b69 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.apache.lucene.core_3.5.0.v20120725-1805.jar differ diff --git a/WebContent/WEB-INF/lib/org.apache.poi_3.9.0.v201405241750.jar b/WebContent/WEB-INF/lib/org.apache.poi_3.9.0.v201405241750.jar new file mode 100644 index 0000000..1271594 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.apache.poi_3.9.0.v201405241750.jar differ diff --git a/WebContent/WEB-INF/lib/org.apache.xerces_2.9.0.v201101211617.jar b/WebContent/WEB-INF/lib/org.apache.xerces_2.9.0.v201101211617.jar new file mode 100644 index 0000000..e254ee1 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.apache.xerces_2.9.0.v201101211617.jar differ diff --git a/WebContent/WEB-INF/lib/org.apache.xml.resolver_1.2.0.v201005080400.jar b/WebContent/WEB-INF/lib/org.apache.xml.resolver_1.2.0.v201005080400.jar new file mode 100644 index 0000000..b2a446a Binary files /dev/null and b/WebContent/WEB-INF/lib/org.apache.xml.resolver_1.2.0.v201005080400.jar differ diff --git a/WebContent/WEB-INF/lib/org.apache.xml.serializer_2.7.1.v201005080400.jar b/WebContent/WEB-INF/lib/org.apache.xml.serializer_2.7.1.v201005080400.jar new file mode 100644 index 0000000..a91907d Binary files /dev/null and b/WebContent/WEB-INF/lib/org.apache.xml.serializer_2.7.1.v201005080400.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.birt.axis.overlay_4.6.0.v201606072122.jar b/WebContent/WEB-INF/lib/org.eclipse.birt.axis.overlay_4.6.0.v201606072122.jar new file mode 100644 index 0000000..0f5a25c Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.birt.axis.overlay_4.6.0.v201606072122.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.birt.runtime_4.6.0-20160607.jar b/WebContent/WEB-INF/lib/org.eclipse.birt.runtime_4.6.0-20160607.jar new file mode 100644 index 0000000..a0c0222 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.birt.runtime_4.6.0-20160607.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.core.contenttype_3.5.100.v20160418-1621.jar b/WebContent/WEB-INF/lib/org.eclipse.core.contenttype_3.5.100.v20160418-1621.jar new file mode 100644 index 0000000..c192f63 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.core.contenttype_3.5.100.v20160418-1621.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.core.expressions_3.5.100.v20160418-1621.jar b/WebContent/WEB-INF/lib/org.eclipse.core.expressions_3.5.100.v20160418-1621.jar new file mode 100644 index 0000000..363c017 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.core.expressions_3.5.100.v20160418-1621.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.core.filesystem_1.6.0.v20160503-1608.jar b/WebContent/WEB-INF/lib/org.eclipse.core.filesystem_1.6.0.v20160503-1608.jar new file mode 100644 index 0000000..bdbefd8 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.core.filesystem_1.6.0.v20160503-1608.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.core.jobs_3.8.0.v20160509-0411.jar b/WebContent/WEB-INF/lib/org.eclipse.core.jobs_3.8.0.v20160509-0411.jar new file mode 100644 index 0000000..8bc8cfe Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.core.jobs_3.8.0.v20160509-0411.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.core.resources_3.11.0.v20160503-1608.jar b/WebContent/WEB-INF/lib/org.eclipse.core.resources_3.11.0.v20160503-1608.jar new file mode 100644 index 0000000..11e64a3 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.core.resources_3.11.0.v20160503-1608.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.core.runtime_3.12.0.v20160606-1342.jar b/WebContent/WEB-INF/lib/org.eclipse.core.runtime_3.12.0.v20160606-1342.jar new file mode 100644 index 0000000..938f7c8 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.core.runtime_3.12.0.v20160606-1342.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.apache.derby.dbdefinition_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.apache.derby.dbdefinition_1.1.0.201603142002.jar new file mode 100644 index 0000000..9f14deb Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.apache.derby.dbdefinition_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.apache.derby_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.apache.derby_1.1.0.201603142002.jar new file mode 100644 index 0000000..cdd1a19 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.apache.derby_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.console.profile_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.console.profile_1.1.0.201603142002.jar new file mode 100644 index 0000000..008eada Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.console.profile_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.db.generic_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.db.generic_1.1.0.201603142002.jar new file mode 100644 index 0000000..c73116f Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.db.generic_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.dbdefinition.genericJDBC_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.dbdefinition.genericJDBC_1.1.0.201603142002.jar new file mode 100644 index 0000000..8e253d4 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.dbdefinition.genericJDBC_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.oda.consumer_3.3.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.oda.consumer_3.3.0.201603142002.jar new file mode 100644 index 0000000..944b8fb Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.oda.consumer_3.3.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.oda.design_3.4.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.oda.design_3.4.0.201603142002.jar new file mode 100644 index 0000000..e245ec0 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.oda.design_3.4.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.oda.flatfile_3.2.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.oda.flatfile_3.2.0.201603142002.jar new file mode 100644 index 0000000..41ceaf9 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.oda.flatfile_3.2.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.oda.profile_3.3.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.oda.profile_3.3.0.201603142002.jar new file mode 100644 index 0000000..8c27d1e Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.oda.profile_3.3.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.oda_3.5.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.oda_3.5.0.201603142002.jar new file mode 100644 index 0000000..c319bca Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.oda_3.5.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.sqm.core_1.3.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.sqm.core_1.3.0.201603142002.jar new file mode 100644 index 0000000..b877a54 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity.sqm.core_1.3.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity_1.13.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity_1.13.0.201603142002.jar new file mode 100644 index 0000000..99322ff Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.connectivity_1.13.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.hsqldb.dbdefinition_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.hsqldb.dbdefinition_1.1.0.201603142002.jar new file mode 100644 index 0000000..9642f24 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.hsqldb.dbdefinition_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.hsqldb_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.hsqldb_1.1.0.201603142002.jar new file mode 100644 index 0000000..c0f2a2e Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.hsqldb_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.ibm.db2.iseries.dbdefinition_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.ibm.db2.iseries.dbdefinition_1.1.0.201603142002.jar new file mode 100644 index 0000000..9170685 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.ibm.db2.iseries.dbdefinition_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.ibm.db2.iseries_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.ibm.db2.iseries_1.1.0.201603142002.jar new file mode 100644 index 0000000..dcd30fa Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.ibm.db2.iseries_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.ibm.db2.luw.dbdefinition_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.ibm.db2.luw.dbdefinition_1.1.0.201603142002.jar new file mode 100644 index 0000000..271289a Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.ibm.db2.luw.dbdefinition_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.ibm.db2.luw_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.ibm.db2.luw_1.1.0.201603142002.jar new file mode 100644 index 0000000..ad8b4ac Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.ibm.db2.luw_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.ibm.db2.zseries.dbdefinition_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.ibm.db2.zseries.dbdefinition_1.1.0.201603142002.jar new file mode 100644 index 0000000..3e12164 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.ibm.db2.zseries.dbdefinition_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.ibm.db2.zseries_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.ibm.db2.zseries_1.1.0.201603142002.jar new file mode 100644 index 0000000..a236f09 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.ibm.db2.zseries_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.ibm.db2_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.ibm.db2_1.1.0.201603142002.jar new file mode 100644 index 0000000..cf75167 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.ibm.db2_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.ibm.informix.dbdefinition_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.ibm.informix.dbdefinition_1.1.0.201603142002.jar new file mode 100644 index 0000000..c81dfa3 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.ibm.informix.dbdefinition_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.ibm.informix_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.ibm.informix_1.1.0.201603142002.jar new file mode 100644 index 0000000..7ced26d Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.ibm.informix_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.ibm_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.ibm_1.1.0.201603142002.jar new file mode 100644 index 0000000..2173770 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.ibm_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.msft.sqlserver.dbdefinition_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.msft.sqlserver.dbdefinition_1.1.0.201603142002.jar new file mode 100644 index 0000000..5da345c Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.msft.sqlserver.dbdefinition_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.msft.sqlserver_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.msft.sqlserver_1.1.0.201603142002.jar new file mode 100644 index 0000000..f2e6a00 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.msft.sqlserver_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.mysql.dbdefinition_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.mysql.dbdefinition_1.1.0.201603142002.jar new file mode 100644 index 0000000..f2ca8f0 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.mysql.dbdefinition_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.mysql_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.mysql_1.1.0.201603142002.jar new file mode 100644 index 0000000..cc04d03 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.mysql_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.oda.ws_1.3.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.oda.ws_1.3.0.201603142002.jar new file mode 100644 index 0000000..cd5f1e7 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.oda.ws_1.3.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.oda.xml_1.3.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.oda.xml_1.3.0.201603142002.jar new file mode 100644 index 0000000..6bbfc76 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.oda.xml_1.3.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.oracle.dbdefinition_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.oracle.dbdefinition_1.1.0.201603142002.jar new file mode 100644 index 0000000..761bfc7 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.oracle.dbdefinition_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.oracle_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.oracle_1.1.0.201603142002.jar new file mode 100644 index 0000000..f4e6aac Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.oracle_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.postgresql.dbdefinition_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.postgresql.dbdefinition_1.1.0.201603142002.jar new file mode 100644 index 0000000..3a8ebbf Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.postgresql.dbdefinition_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.postgresql_1.2.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.postgresql_1.2.0.201603142002.jar new file mode 100644 index 0000000..e26deae Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.postgresql_1.2.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.sap.maxdb.dbdefinition_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.sap.maxdb.dbdefinition_1.1.0.201603142002.jar new file mode 100644 index 0000000..962aaf8 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.sap.maxdb.dbdefinition_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.sap.maxdb_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.sap.maxdb_1.1.0.201603142002.jar new file mode 100644 index 0000000..a1d9775 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.enablement.sap.maxdb_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.modelbase.dbdefinition_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.modelbase.dbdefinition_1.1.0.201603142002.jar new file mode 100644 index 0000000..5648fec Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.modelbase.dbdefinition_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.modelbase.derby_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.modelbase.derby_1.1.0.201603142002.jar new file mode 100644 index 0000000..0defe9e Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.modelbase.derby_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.modelbase.sql.query_1.2.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.modelbase.sql.query_1.2.0.201603142002.jar new file mode 100644 index 0000000..a2389b4 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.modelbase.sql.query_1.2.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.modelbase.sql_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.modelbase.sql_1.1.0.201603142002.jar new file mode 100644 index 0000000..b985961 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.modelbase.sql_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.sqltools.data.core_1.3.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.sqltools.data.core_1.3.0.201603142002.jar new file mode 100644 index 0000000..b475206 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.sqltools.data.core_1.3.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.sqltools.parsers.sql.lexer_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.sqltools.parsers.sql.lexer_1.1.0.201603142002.jar new file mode 100644 index 0000000..32a8a28 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.sqltools.parsers.sql.lexer_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.sqltools.parsers.sql.query_1.3.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.sqltools.parsers.sql.query_1.3.0.201603142002.jar new file mode 100644 index 0000000..f2a9257 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.sqltools.parsers.sql.query_1.3.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.sqltools.parsers.sql_1.1.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.sqltools.parsers.sql_1.1.0.201603142002.jar new file mode 100644 index 0000000..e3692ff Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.sqltools.parsers.sql_1.1.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.datatools.sqltools.result_1.2.0.201603142002.jar b/WebContent/WEB-INF/lib/org.eclipse.datatools.sqltools.result_1.2.0.201603142002.jar new file mode 100644 index 0000000..e0c4635 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.datatools.sqltools.result_1.2.0.201603142002.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.emf.common_2.12.0.v20160420-0247.jar b/WebContent/WEB-INF/lib/org.eclipse.emf.common_2.12.0.v20160420-0247.jar new file mode 100644 index 0000000..752bcac Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.emf.common_2.12.0.v20160420-0247.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.emf.ecore.change_2.11.0.v20160420-0247.jar b/WebContent/WEB-INF/lib/org.eclipse.emf.ecore.change_2.11.0.v20160420-0247.jar new file mode 100644 index 0000000..a8f8c8b Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.emf.ecore.change_2.11.0.v20160420-0247.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.emf.ecore.xmi_2.12.0.v20160420-0247.jar b/WebContent/WEB-INF/lib/org.eclipse.emf.ecore.xmi_2.12.0.v20160420-0247.jar new file mode 100644 index 0000000..89e6f33 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.emf.ecore.xmi_2.12.0.v20160420-0247.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.emf.ecore_2.12.0.v20160420-0247.jar b/WebContent/WEB-INF/lib/org.eclipse.emf.ecore_2.12.0.v20160420-0247.jar new file mode 100644 index 0000000..34179a3 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.emf.ecore_2.12.0.v20160420-0247.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.equinox.app_1.3.400.v20150715-1528.jar b/WebContent/WEB-INF/lib/org.eclipse.equinox.app_1.3.400.v20150715-1528.jar new file mode 100644 index 0000000..ddd85e1 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.equinox.app_1.3.400.v20150715-1528.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.equinox.common_3.8.0.v20160509-1230.jar b/WebContent/WEB-INF/lib/org.eclipse.equinox.common_3.8.0.v20160509-1230.jar new file mode 100644 index 0000000..1ae6426 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.equinox.common_3.8.0.v20160509-1230.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.equinox.preferences_3.6.0.v20160120-1756.jar b/WebContent/WEB-INF/lib/org.eclipse.equinox.preferences_3.6.0.v20160120-1756.jar new file mode 100644 index 0000000..df7b498 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.equinox.preferences_3.6.0.v20160120-1756.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.equinox.registry_3.6.100.v20160223-2218.jar b/WebContent/WEB-INF/lib/org.eclipse.equinox.registry_3.6.100.v20160223-2218.jar new file mode 100644 index 0000000..0a01fb6 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.equinox.registry_3.6.100.v20160223-2218.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.help_3.7.0.v20160602-1307.jar b/WebContent/WEB-INF/lib/org.eclipse.help_3.7.0.v20160602-1307.jar new file mode 100644 index 0000000..fbc3f3d Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.help_3.7.0.v20160602-1307.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.orbit.mongodb_2.10.1.v20130422-1135.jar b/WebContent/WEB-INF/lib/org.eclipse.orbit.mongodb_2.10.1.v20130422-1135.jar new file mode 100644 index 0000000..ed934d2 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.orbit.mongodb_2.10.1.v20130422-1135.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.osgi.services_3.5.100.v20160504-1419.jar b/WebContent/WEB-INF/lib/org.eclipse.osgi.services_3.5.100.v20160504-1419.jar new file mode 100644 index 0000000..6bd6f47 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.osgi.services_3.5.100.v20160504-1419.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.osgi_3.11.0.v20160603-1336.jar b/WebContent/WEB-INF/lib/org.eclipse.osgi_3.11.0.v20160603-1336.jar new file mode 100644 index 0000000..644050e Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.osgi_3.11.0.v20160603-1336.jar differ diff --git a/WebContent/WEB-INF/lib/org.eclipse.update.configurator_3.3.400.v20160506-0750.jar b/WebContent/WEB-INF/lib/org.eclipse.update.configurator_3.3.400.v20160506-0750.jar new file mode 100644 index 0000000..efd11f6 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.eclipse.update.configurator_3.3.400.v20160506-0750.jar differ diff --git a/WebContent/WEB-INF/lib/org.mozilla.javascript_1.7.5.v201504281450.jar b/WebContent/WEB-INF/lib/org.mozilla.javascript_1.7.5.v201504281450.jar new file mode 100644 index 0000000..832f668 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.mozilla.javascript_1.7.5.v201504281450.jar differ diff --git a/WebContent/WEB-INF/lib/org.w3c.css.sac_1.3.1.v200903091627.jar b/WebContent/WEB-INF/lib/org.w3c.css.sac_1.3.1.v200903091627.jar new file mode 100644 index 0000000..3e31d40 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.w3c.css.sac_1.3.1.v200903091627.jar differ diff --git a/WebContent/WEB-INF/lib/org.w3c.dom.events_3.0.0.draft20060413_v201105210656.jar b/WebContent/WEB-INF/lib/org.w3c.dom.events_3.0.0.draft20060413_v201105210656.jar new file mode 100644 index 0000000..51daf18 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.w3c.dom.events_3.0.0.draft20060413_v201105210656.jar differ diff --git a/WebContent/WEB-INF/lib/org.w3c.dom.smil_1.0.1.v200903091627.jar b/WebContent/WEB-INF/lib/org.w3c.dom.smil_1.0.1.v200903091627.jar new file mode 100644 index 0000000..1bb1c40 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.w3c.dom.smil_1.0.1.v200903091627.jar differ diff --git a/WebContent/WEB-INF/lib/org.w3c.dom.svg_1.1.0.v201011041433.jar b/WebContent/WEB-INF/lib/org.w3c.dom.svg_1.1.0.v201011041433.jar new file mode 100644 index 0000000..f870ac3 Binary files /dev/null and b/WebContent/WEB-INF/lib/org.w3c.dom.svg_1.1.0.v201011041433.jar differ diff --git a/WebContent/WEB-INF/lib/saaj.jar b/WebContent/WEB-INF/lib/saaj.jar new file mode 100644 index 0000000..4ea696e Binary files /dev/null and b/WebContent/WEB-INF/lib/saaj.jar differ diff --git a/WebContent/WEB-INF/lib/scriptapi.jar b/WebContent/WEB-INF/lib/scriptapi.jar new file mode 100644 index 0000000..228db7b Binary files /dev/null and b/WebContent/WEB-INF/lib/scriptapi.jar differ diff --git a/WebContent/WEB-INF/lib/viewservlets.jar b/WebContent/WEB-INF/lib/viewservlets.jar new file mode 100644 index 0000000..2cee2da Binary files /dev/null and b/WebContent/WEB-INF/lib/viewservlets.jar differ diff --git a/WebContent/WEB-INF/server-config.wsdd b/WebContent/WEB-INF/server-config.wsdd new file mode 100644 index 0000000..93b5672 --- /dev/null +++ b/WebContent/WEB-INF/server-config.wsdd @@ -0,0 +1,952 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +http://schemas.eclipse.org/birt + + + + + + + http://xml.apache.org/axis/wsdd/ + + + + + + + + + + + + + + + + + + + + diff --git a/WebContent/WEB-INF/tlds/birt.tld b/WebContent/WEB-INF/tlds/birt.tld new file mode 100644 index 0000000..1893d6b --- /dev/null +++ b/WebContent/WEB-INF/tlds/birt.tld @@ -0,0 +1,1157 @@ + + + + 1.0 + 1.2 + BIRT Tag Library + http://www.eclipse.org/birt/taglibs/birt.tld + + This Tag Library makes user develope JSP with BIRT Viewer component easily. + + + + + + + viewer + org.eclipse.birt.report.taglib.ViewerTag + JSP + + The viewer tag is to specify how to import and control BIRT Report Viewer into JSP page. + This tag will use Ajax framework to retrieve report content. + + + + id + true + true + + Specifies the current viewer id. It should be unique. + It can contain number,letter or underline. + + + + + pattern + false + true + + Specifies which servlet pattern to be used to preview report. + Default value is frameset. + ( frameset or run ) + + + + + baseURL + false + true + + Specifies base URL of BIRT viewer. + Default to the current context. + + + + + title + false + true + + Specifies the report title displayed at the top. + + + + + isHostPage + false + true + + Specifies whether the viewer occupies the whole page. + Default to false. + + + + + scrolling + false + true + + Sets the IFrame style "scrolling ". + If isHostPage is true, ignore this attribute. + ( auto | yes | no ) + + + + + position + false + true + + Sets the style "position" of report container. + If isHostPage is true, ignore this attribute. + ( static | absolute | fixed | relative ) + + + + + style + false + true + + Sets the style of report container. + If isHostPage is true, ignore this attribute. + + + + + height + false + true + + Sets the height of report container in pixels. + If isHostPage is true, ignore this attribute. + + + + + width + false + true + + Sets the width of report container in pixels. + If isHostPage is true, ignore this attribute. + + + + + top + false + true + + Sets the top of report container in pixels. + If isHostPage is true, ignore this attribute. + + + + + left + false + true + + Sets the left of report container in pixels. + If isHostPage is true, ignore this attribute. + + + + + frameborder + false + true + + Specifies whether displays the iframe border. + Default to no. + If isHostPage is true, ignore this attribute. + ( Yes | No ) + + + + + reportDesign + false + true + + Specifies the report design file name. + ( Absolute path, relative path or URL ) + + + + + reportDocument + false + true + + Specifies the report document file name. + Noted: only support "file:" URL format. + ( Absolute path, relative path or URL ) + + + + + reportletId + false + true + + Specifies the instance id of reportlet. + The "reportDocument" attribute should be required. + Noted: frameset pattern doesn't support reportlet. + + + + + bookmark + false + true + + Specifies the targeted bookmark name. + + + + + locale + false + true + + Specifies the Locale information. + + + + + timeZone + false + true + + Specifies a time zone id. For example: "America/Los_Angeles" or "GMT+1" or "GMT+01:00". + + + + + svg + false + true + + Specifies whether supports the SVG output format or not. + + + + + format + false + true + + Specifies the output format of report. + + + + + emitterId + false + true + + Specifies the emitter id for the report output. + + + + + pageOverflow + false + true + + Specifies the page overflow setting for the PDF format. + One of the following values: + 0 for "auto", 1 for "actual size", 2 for "fit to page". + + + + + rtl + false + true + + Specifies whether supports rtl page or not. + + + + + pageNum + false + true + + Specifies output page number when render document file. + + + + + pageRange + false + true + + Specifies page range when render document file. + + + + + resourceFolder + false + true + + Specifies the referenced resource folder. + Default value is defined in web.xml. + + + + + forceOverwriteDocument + false + true + + Specifies whether forces to overwrite the generated document. + If allowPageBreak is false,ignore this attribute. + Default value is defined in web.xml. + + + + + showTitle + false + true + + Specifies whether shows the report title. + Default to true. + + + + + showToolBar + false + true + + Specifies whether shows the toolbar. + Default to true. + + + + + showNavigationBar + false + true + + Specifies whether shows the Navigation Bar. + If allowPageBreak is false,ignore this attribute. + Default to true. + + + + + showParameterPage + false + true + + Specifies whether show the parameter dialog or not. + Default to true. + + + + + isReportlet + false + true + + Specifies whether render reportlet by bookmark. + Default to false. + + + + + + + + + + report + org.eclipse.birt.report.taglib.ReportTag + JSP + + The report tag can provide fast report preview without Ajax framework. + The report content can be output to web browser directly. + + + + id + true + true + + Specifies the current viewer id. It should be unique. + It can contain number,letter or underline. + + + + + baseURL + false + true + + Specifies base URL of BIRT viewer. + Default to the current context. + If report container is DIV, ignore this attribute. + + + + + isHostPage + false + true + + Specifies whether the viewer occupies the whole page. + Default to false. + + + + + scrolling + false + true + + Sets the DIV/IFrame style "scrolling ". + If isHostPage is true, ignore this attribute. + ( auto | yes | no ) + + + + + position + false + true + + Sets the style "position" of report container. + If isHostPage is true, ignore this attribute. + ( static | absolute | fixed | relative ) + + + + + style + false + true + + Sets the style of report container. + If isHostPage is true, ignore this attribute. + + + + + height + false + true + + Sets the height of report container in pixels. + If isHostPage is true, ignore this attribute. + + + + + width + false + true + + Sets the width of report container in pixels. + If isHostPage is true, ignore this attribute. + + + + + top + false + true + + Sets the top of report container in pixels. + If isHostPage is true, ignore this attribute. + + + + + left + false + true + + Sets the left of report container in pixels. + If isHostPage is true, ignore this attribute. + + + + + frameborder + false + true + + Specifies whether displays the iframe border. + Available when user IFrame. + Default to no. + ( Yes | No ) + + + + + reportDesign + false + true + + Specifies the report design file name. + ( Absolute path, relative path or URL ) + + + + + reportDocument + false + true + + Specifies the report document file name. + Noted: only support "file:" URL format. + ( Absolute path, relative path or URL ) + + + + + reportletId + false + true + + Specifies the instance id of reportlet. + The "reportDocument" attribute should be required. + + + + + bookmark + false + true + + Specifies the targeted bookmark name. + + + + + locale + false + true + + Specifies the Locale information. + + + + + timeZone + false + true + + Specifies a time zone id. For example: "America/Los_Angeles" or "GMT+1" or "GMT+01:00". + + + + + svg + false + true + + Specifies whether supports the SVG output format or not. + + + + + format + false + true + + Specifies the output format of report. + + + + + emitterId + false + true + + Specifies the emitter id for the report output. + + + + + pageOverflow + false + true + + Specifies the page overflow setting for the PDF format. + One of the following values: + 0 for "auto", 1 for "actual size", 2 for "fit to page". + + + + + rtl + false + true + + Specifies whether supports rtl page or not. + + + + + showParameterPage + false + true + + Specifies whether show the parameter dialog or not. + Default to true. + If report container is DIV, ignore this attribute. + + + + + resourceFolder + false + true + + Specifies the referenced resource folder. + Default value is defined in web.xml. + + + + + reportContainer + false + true + + Specifies iframe or div as report container. + Default to iframe. + ( iframe | div ) + + + + + pageNum + false + true + + Specifies output page number when render document file. + + + + + pageRange + false + true + + Specifies page range when render document file. + + + + + isReportlet + false + true + + Specifies whether render reportlet by bookmark. + Default to false. + + + + + + + + + + param + org.eclipse.birt.report.taglib.ParamTag + JSP + + The param tag specifies the parameters defined in report design file. + + + name + true + true + + Specifies the report parameter name. + + + + pattern + false + true + + Specifies the report parameter pattern format. + + + + value + false + true + + Specifies the report parameter value. If doesn't set, value is null. + + + + displayText + false + true + + Specifies the report parameter display text. + + + + delim + false + true + + Specifies the delimiter for multiple values. + Defaults to pipe "|". + + + + isLocale + false + true + + Specifies whether the report parameter value is a locale/format related string. + + + + + + + + + value + org.eclipse.birt.report.taglib.ParamValueTag + JSP + + The param value tag specifies multiple values for a given param tag. + + + value + false + true + + Specifies the report parameter value. If doesn't set, value is null. + + + + displayText + false + true + + Specifies the report parameter display text. + + + + + + + + + parameterPage + org.eclipse.birt.report.taglib.RequesterTag + JSP + + The parameterPage tag can help developers to display BIRT parameter page or create a user-defined parameter page. + This tag can collect these parameters and submit to BIRT servlet to handle request. + + + + id + true + true + + Specifies the parameter page id.It should be unique. + It can contain number,letter or underline. + + + + + name + false + true + + Specifies the parameter page name. + If attribute 'isCustom' is true, this name should be required and unique. + + + + + isCustom + false + true + + Specifies whether uses the user-defined parameter page. + If false, use the BIRT parameter dialog. + Default to false. + + + + + title + false + true + + Specifies the report title displayed at the top. + + + + + baseURL + false + true + + Specifies base URL of BIRT viewer. + Default to the current context. + + + + + scrolling + false + true + + Sets the DIV/IFrame style "scrolling ". + ( auto | yes | no ) + + + + + position + false + true + + Sets the style "position" of parameter page. + ( static | absolute | fixed | relative ) + + + + + style + false + true + + Sets the style of parameter page. + + + + + height + false + true + + Sets the height of parameter page in pixels. + + + + + width + false + true + + Sets the width of parameter page in pixels. + + + + + top + false + true + + Sets the top of parameter page in pixels. + + + + + left + false + true + + Sets the left of parameter page in pixels. + + + + + frameborder + false + true + + Specifies whether displays the iframe border. + Default to no. + If set "isCustom" to true, ignore this attribute. + ( Yes | No ) + + + + + reportDesign + false + true + + Specifies the report design file name. + ( Absolute path, relative path or URL ) + + + + + reportDocument + false + true + + Specifies the report document file name. + Noted: only support "file:" URL format. + ( Absolute path, relative path or URL ) + + + + + reportletId + false + true + + Specifies the instance id of reportlet. + The "reportDocument" attribute should be required. + Noted: frameset pattern doesn't support reportlet. + + + + + pattern + false + true + + Specifies the servlet pattern for request submit. + BIRT supports three patterns: frameset, run and preview. + Can refer to the user-defined servlet pattern. + Default to frameset. + + + + + target + false + true + + Specifies the target window for request submit. + + + + + bookmark + false + true + + Specifies the targeted bookmark name. + + + + + locale + false + true + + Specifies the Locale information. + + + + + timeZone + false + true + + Specifies a time zone id. For example: "America/Los_Angeles" or "GMT+1" or "GMT+01:00". + + + + + svg + false + true + + Specifies whether supports the SVG output format or not. + + + + + format + false + true + + Specifies the output format of report. + + + + + emitterId + false + true + + Specifies the emitter id for the report output. + + + + + pageOverflow + false + true + + Specifies the page overflow setting for the PDF format. + One of the following values: + 0 for "auto", 1 for "actual size", 2 for "fit to page". + + + + + rtl + false + true + + Specifies whether supports rtl page or not. + + + + + resourceFolder + false + true + + Specifies the referenced resource folder. + Default value is defined in web.xml. + + + + + forceOverwriteDocument + false + true + + Specifies whether forces to overwrite the generated document. + If allowPageBreak is false,ignore this attribute. + Default value is defined in web.xml. + + + + + showTitle + false + true + + Specifies whether shows the report title. + Default to true. + + + + + showToolBar + false + true + + Specifies whether shows the toolbar. + Default to true. + + + + + showNavigationBar + false + true + + Specifies whether shows the Navigation Bar. + If allowPageBreak is false,ignore this attribute. + Default to true. + + + + + isReportlet + false + true + + Specifies whether render reportlet by bookmark. + Default to false. + + + + + + + + + + paramDef + org.eclipse.birt.report.taglib.ParamDefTag + JSP + + The param tag is used to generate html code for defined parameter in ParameterPage tag. + + + id + true + true + + Specifies the id of parameter control.It should be unique. + It can contain number,letter or underline. + + + + name + true + true + + Specifies the report parameter name. + + + + pattern + false + true + + Specifies the report parameter pattern format. + It is used to parse defined parameter value string. + + + + value + false + true + + Specifies the report parameter value. If doesn't set, use default value. + + + + displayText + false + true + + Specifies the report parameter display text. + + + + isLocale + false + true + + Specifies whether the report parameter value is a locale/format related string. + It is used to parse defined parameter value string. + + + + title + false + true + + Specifies the title attribute of parameter control. + + + + cssClass + false + true + + Specifies the css class attribute of parameter control. + + + + style + false + true + + Specifies the parameter control style. + + + + \ No newline at end of file diff --git a/WebContent/WEB-INF/viewer.properties b/WebContent/WEB-INF/viewer.properties new file mode 100644 index 0000000..1afbc7c --- /dev/null +++ b/WebContent/WEB-INF/viewer.properties @@ -0,0 +1,94 @@ +############################################################################### +# Copyright (c) 2004 Actuate Corporation. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Actuate Corporation - initial API and implementation +############################################################################### + +# configurable variable for JSP base href. Please uncomment the below line. +#base_url=http://127.0.0.1:8080 + +# [EXTENSION SETTING] +viewer.extension.html=html +viewer.extension.pdf=pdf +viewer.extension.postscript=ps +viewer.extension.doc=doc +viewer.extension.xls=xls +viewer.extension.ppt=ppt +viewer.extension.ods=ods +viewer.extension.odt=odt +viewer.extension.odp=odp +viewer.extension.docx=docx +viewer.extension.pptx=pptx +viewer.extension.xlsx=xlsx +viewer.extension.xls_spudsoft=xls + +# [OUTPUT FORMAT LABEL NAME] +viewer.label.html=HTML +viewer.label.pdf=PDF +viewer.label.postscript=PostScript +viewer.label.doc=Word +viewer.label.xls=Excel +viewer.label.ppt=PowerPoint +viewer.label.ods=OpenDocument Spreadsheet +viewer.label.odt=OpenDocument Text +viewer.label.odp=OpenDocument Presentation +viewer.label.docx=DOCX +viewer.label.pptx=PPTX +viewer.label.xlsx=XLSX +viewer.label.xls_spudsoft=Spudsoft Excel + +# [CSV SEPARATOR] +viewer.sep.0=, +viewer.sep.1=; +viewer.sep.2=: +viewer.sep.3=| +viewer.sep.4=\t + +# [VIEWING SESSION CONFIGURATION] +# The BIRT viewing session is a sub-session of the HTTP session. +# An HTTP session can have multiple BIRT viewing sessions. +# Each time a new viewer is opened, a new viewing session is created. +# The following parameters are used to configure the viewing session +# management. +# If the matching HTTP session expires, all the viewing sessions +# attached to it will expire as well. + +# Timeout value in seconds after which a viewing session will expire. +# The value 0 means that a session will never expire, and the cached files +# will never be cleant unless the belonging HTTP session expires. +viewer.session.timeout=0 + +# Defines a session count threshold after which the cleanup process +# will try to clean up expired sessions. +viewer.session.minimumThreshold=20 + +# Load factor to recalculate the minimum threshold value based on the remaining +# session count after cleanup. +viewer.session.loadFactor=0.75 + +# Maximum number of simultaneous viewing sessions that can be open at the +# same time, to prevent cache overflowing through multiple requests. +# A value of 0 means no limit. +viewer.session.maximumSessionCount=0 + +# Behavior that must be used once the maximum session count is reached +# (if different than 0): +# - A value of 0 will use the "Discard new session" policy that will show +# an error message for all the newer sessions. +# - A value of 1 will use the "Discard the oldest session" policy that will +# try to discard the oldest session, even if it has not expired yet. +# Note that "busy" sessions (for example downloading results) won't be +# cleant by this mechanism. +viewer.session.maximumSessionCountPolicy=1 + +# [LOGGERS] +# "logger."+class=level +# if no level is specified or the text "DEFAULT", +# then the default level from the web.xml will be used +logger.org.eclipse.datatools.connectivity.oda=DEFAULT +logger.org.eclipse.datatools.enablement.oda=DEFAULT diff --git a/WebContent/WEB-INF/web-template.xml b/WebContent/WEB-INF/web-template.xml new file mode 100644 index 0000000..e96af0a --- /dev/null +++ b/WebContent/WEB-INF/web-template.xml @@ -0,0 +1,246 @@ + + + + + Eclipse BIRT Report Viewer + + + + BIRT_VIEWER_LOCALE + en-US + + + + + BIRT_VIEWER_TIMEZONE + + + + + + BIRT_VIEWER_WORKING_FOLDER + + + + + + BIRT_VIEWER_DOCUMENT_FOLDER + ${birt.viewer.working.path}/documents + + + + + WORKING_FOLDER_ACCESS_ONLY + true + + + + + URL_REPORT_PATH_POLICY + domain + + + + + BIRT_VIEWER_IMAGE_DIR + ${birt.viewer.working.path}/report/images + + + + + BIRT_VIEWER_LOG_DIR + ${birt.viewer.working.path}/logs + + + + + BIRT_VIEWER_LOG_LEVEL + WARNING + + + + + BIRT_VIEWER_SCRIPTLIB_DIR + + + + + + BIRT_RESOURCE_PATH + + + + + + BIRT_VIEWER_MAX_ROWS + + + + + + BIRT_VIEWER_MAX_CUBE_ROWLEVELS + + + + BIRT_VIEWER_MAX_CUBE_COLUMNLEVELS + + + + + + BIRT_VIEWER_CUBE_MEMORY_SIZE + + + + + + BIRT_VIEWER_CONFIG_FILE + WEB-INF/viewer.properties + + + + + BIRT_VIEWER_PRINT_SERVERSIDE + ON + + + + + HTML_ENABLE_AGENTSTYLE_ENGINE + true + + + + + BIRT_FILENAME_GENERATOR_CLASS + org.eclipse.birt.report.utility.filename.DefaultFilenameGenerator + + + + + ViewerFilter + org.eclipse.birt.report.filter.ViewerFilter + + + ViewerFilter + ViewerServlet + + + ViewerFilter + EngineServlet + + + + + org.eclipse.birt.report.listener.ViewerServletContextListener + + + + + org.eclipse.birt.report.listener.ViewerHttpSessionListener + + + + + ViewerServlet + org.eclipse.birt.report.servlet.ViewerServlet + + + + + EngineServlet + org.eclipse.birt.report.servlet.BirtEngineServlet + + + @generated@ + + + ViewerServlet + /frameset + + + + ViewerServlet + /run + + + + EngineServlet + /preview + + + + EngineServlet + /download + + + + EngineServlet + /parameter + + + + EngineServlet + /document + + + + EngineServlet + /output + + + + EngineServlet + /extract + + + + + /birt.tld + /WEB-INF/tlds/birt.tld + + + diff --git a/WebContent/WEB-INF/web-viewer.xml b/WebContent/WEB-INF/web-viewer.xml new file mode 100644 index 0000000..d296799 --- /dev/null +++ b/WebContent/WEB-INF/web-viewer.xml @@ -0,0 +1,242 @@ + + + + + Eclipse BIRT Report Viewer + + + + BIRT_VIEWER_LOCALE + en-US + + + + + BIRT_VIEWER_TIMEZONE + + + + + + BIRT_VIEWER_WORKING_FOLDER + + + + + + BIRT_VIEWER_DOCUMENT_FOLDER + ${birt.viewer.working.path}/documents + + + + + WORKING_FOLDER_ACCESS_ONLY + false + + + + + URL_REPORT_PATH_POLICY + domain + + + + + BIRT_VIEWER_IMAGE_DIR + ${birt.viewer.working.path}/report/images + + + + + BIRT_VIEWER_LOG_DIR + ${birt.viewer.working.path}/logs + + + + + BIRT_VIEWER_LOG_LEVEL + WARNING + + + + + BIRT_VIEWER_SCRIPTLIB_DIR + + + + + + BIRT_RESOURCE_PATH + + + + + + BIRT_VIEWER_MAX_ROWS + + + + + + BIRT_VIEWER_MAX_CUBE_ROWLEVELS + + + + BIRT_VIEWER_MAX_CUBE_COLUMNLEVELS + + + + + + BIRT_VIEWER_CUBE_MEMORY_SIZE + + + + + + BIRT_VIEWER_CONFIG_FILE + WEB-INF/viewer.properties + + + + + BIRT_VIEWER_PRINT_SERVERSIDE + ON + + + + + HTML_ENABLE_AGENTSTYLE_ENGINE + true + + + + + BIRT_FILENAME_GENERATOR_CLASS + org.eclipse.birt.report.utility.filename.DefaultFilenameGenerator + + + + + ViewerFilter + org.eclipse.birt.report.filter.ViewerFilter + + + ViewerFilter + ViewerServlet + + + ViewerFilter + EngineServlet + + + + + org.eclipse.birt.report.listener.ViewerServletContextListener + + + + + org.eclipse.birt.report.listener.ViewerHttpSessionListener + + + + + ViewerServlet + org.eclipse.birt.report.servlet.ViewerServlet + + + + + EngineServlet + org.eclipse.birt.report.servlet.BirtEngineServlet + + + + ViewerServlet + /frameset + + + + ViewerServlet + /run + + + + EngineServlet + /preview + + + + EngineServlet + /download + + + + EngineServlet + /parameter + + + + EngineServlet + /document + + + + EngineServlet + /output + + + + EngineServlet + /extract + + + + + /birt.tld + /WEB-INF/tlds/birt.tld + + + diff --git a/WebContent/WEB-INF/web-war.xml b/WebContent/WEB-INF/web-war.xml new file mode 100644 index 0000000..bd4d085 --- /dev/null +++ b/WebContent/WEB-INF/web-war.xml @@ -0,0 +1,242 @@ + + + + + Eclipse BIRT Report Viewer + + + + BIRT_VIEWER_LOCALE + en-US + + + + + BIRT_VIEWER_TIMEZONE + + + + + + BIRT_VIEWER_WORKING_FOLDER + + + + + + BIRT_VIEWER_DOCUMENT_FOLDER + ${birt.viewer.working.path}/documents + + + + + WORKING_FOLDER_ACCESS_ONLY + true + + + + + URL_REPORT_PATH_POLICY + domain + + + + + BIRT_VIEWER_IMAGE_DIR + ${birt.viewer.working.path}/report/images + + + + + BIRT_VIEWER_LOG_DIR + ${birt.viewer.working.path}/logs + + + + + BIRT_VIEWER_LOG_LEVEL + WARNING + + + + + BIRT_VIEWER_SCRIPTLIB_DIR + + + + + + BIRT_RESOURCE_PATH + + + + + + BIRT_VIEWER_MAX_ROWS + + + + + + BIRT_VIEWER_MAX_CUBE_ROWLEVELS + + + + BIRT_VIEWER_MAX_CUBE_COLUMNLEVELS + + + + + + BIRT_VIEWER_CUBE_MEMORY_SIZE + + + + + + BIRT_VIEWER_CONFIG_FILE + WEB-INF/viewer.properties + + + + + BIRT_VIEWER_PRINT_SERVERSIDE + ON + + + + + HTML_ENABLE_AGENTSTYLE_ENGINE + true + + + + + BIRT_FILENAME_GENERATOR_CLASS + org.eclipse.birt.report.utility.filename.DefaultFilenameGenerator + + + + + ViewerFilter + org.eclipse.birt.report.filter.ViewerFilter + + + ViewerFilter + ViewerServlet + + + ViewerFilter + EngineServlet + + + + + org.eclipse.birt.report.listener.ViewerServletContextListener + + + + + org.eclipse.birt.report.listener.ViewerHttpSessionListener + + + + + ViewerServlet + org.eclipse.birt.report.servlet.ViewerServlet + + + + + EngineServlet + org.eclipse.birt.report.servlet.BirtEngineServlet + + + + ViewerServlet + /frameset + + + + ViewerServlet + /run + + + + EngineServlet + /preview + + + + EngineServlet + /download + + + + EngineServlet + /parameter + + + + EngineServlet + /document + + + + EngineServlet + /output + + + + EngineServlet + /extract + + + + + /birt.tld + /WEB-INF/tlds/birt.tld + + + diff --git a/WebContent/WEB-INF/web.xml b/WebContent/WEB-INF/web.xml new file mode 100644 index 0000000..40bc42a --- /dev/null +++ b/WebContent/WEB-INF/web.xml @@ -0,0 +1,249 @@ + + + + Mirina + Mirina报表系统 + + + + + BIRT_VIEWER_LOCALE + en-US + + + + + BIRT_VIEWER_TIMEZONE + + + + + + BIRT_VIEWER_WORKING_FOLDER + + + + + + BIRT_VIEWER_DOCUMENT_FOLDER + ${birt.viewer.working.path}/documents + + + + + WORKING_FOLDER_ACCESS_ONLY + true + + + + + URL_REPORT_PATH_POLICY + domain + + + + + BIRT_VIEWER_IMAGE_DIR + ${birt.viewer.working.path}/report/images + + + + + BIRT_VIEWER_LOG_DIR + ${birt.viewer.working.path}/logs + + + + + BIRT_VIEWER_LOG_LEVEL + WARNING + + + + + BIRT_VIEWER_SCRIPTLIB_DIR + + + + + + BIRT_RESOURCE_PATH + + + + + + BIRT_VIEWER_MAX_ROWS + + + + + + BIRT_VIEWER_MAX_CUBE_ROWLEVELS + + + + BIRT_VIEWER_MAX_CUBE_COLUMNLEVELS + + + + + + BIRT_VIEWER_CUBE_MEMORY_SIZE + + + + + + BIRT_VIEWER_CONFIG_FILE + WEB-INF/viewer.properties + + + + + BIRT_VIEWER_PRINT_SERVERSIDE + ON + + + + + HTML_ENABLE_AGENTSTYLE_ENGINE + true + + + + + BIRT_FILENAME_GENERATOR_CLASS + org.eclipse.birt.report.utility.filename.DefaultFilenameGenerator + + + + + ViewerFilter + org.eclipse.birt.report.filter.ViewerFilter + + + ViewerFilter + ViewerServlet + + + ViewerFilter + EngineServlet + + + + + org.eclipse.birt.report.listener.ViewerServletContextListener + + + + + org.eclipse.birt.report.listener.ViewerHttpSessionListener + + + + + ViewerServlet + org.eclipse.birt.report.servlet.ViewerServlet + + + + + EngineServlet + org.eclipse.birt.report.servlet.BirtEngineServlet + + + + ViewerServlet + /frameset + + + + ViewerServlet + /run + + + + EngineServlet + /preview + + + + EngineServlet + /download + + + + EngineServlet + /parameter + + + + EngineServlet + /document + + + + EngineServlet + /output + + + + EngineServlet + /extract + + + + + /birt.tld + /WEB-INF/tlds/birt.tld + + + + + index.jsp + + + \ No newline at end of file diff --git a/WebContent/WEB-INF/web_deploy.xml b/WebContent/WEB-INF/web_deploy.xml new file mode 100644 index 0000000..b1164f3 --- /dev/null +++ b/WebContent/WEB-INF/web_deploy.xml @@ -0,0 +1,244 @@ + + + + + Eclipse BIRT Report Viewer + + + + BIRT_VIEWER_LOCALE + en-US + + + + + BIRT_VIEWER_TIMEZONE + + + + + + BIRT_VIEWER_WORKING_FOLDER + + + + + + BIRT_VIEWER_DOCUMENT_FOLDER + + + + + + WORKING_FOLDER_ACCESS_ONLY + true + + + + + URL_REPORT_PATH_POLICY + domain + + + + + BIRT_VIEWER_IMAGE_DIR + + + + + + BIRT_VIEWER_LOG_DIR + + + + + + BIRT_VIEWER_LOG_LEVEL + WARNING + + + + + BIRT_VIEWER_SCRIPTLIB_DIR + + + + + + BIRT_RESOURCE_PATH + + + + + + BIRT_VIEWER_MAX_ROWS + + + + + + BIRT_VIEWER_MAX_CUBE_ROWLEVELS + + + + BIRT_VIEWER_MAX_CUBE_COLUMNLEVELS + + + + + + BIRT_VIEWER_CUBE_MEMORY_SIZE + + + + + + BIRT_VIEWER_CONFIG_FILE + WEB-INF/viewer.properties + + + + + BIRT_VIEWER_PRINT_SERVERSIDE + ON + + + + + HTML_ENABLE_AGENTSTYLE_ENGINE + true + + + + + BIRT_FILENAME_GENERATOR_CLASS + org.eclipse.birt.report.utility.filename.DefaultFilenameGenerator + + + + + ViewerFilter + org.eclipse.birt.report.filter.ViewerFilter + + + ViewerFilter + ViewerServlet + + + ViewerFilter + EngineServlet + + + + + org.eclipse.birt.report.listener.ViewerServletContextListener + + + + + org.eclipse.birt.report.listener.ViewerHttpSessionListener + + + + + ViewerServlet + org.eclipse.birt.report.servlet.ViewerServlet + + + + + EngineServlet + org.eclipse.birt.report.servlet.BirtEngineServlet + + + + ViewerServlet + /frameset + + + + ViewerServlet + /run + + + + EngineServlet + /preview + + + + EngineServlet + /download + + + + EngineServlet + /parameter + + + + EngineServlet + /document + + + + EngineServlet + /output + + + + EngineServlet + /extract + + + + + /birt.tld + /WEB-INF/tlds/birt.tld + + + diff --git a/WebContent/WEB-INF/weblogic.xml b/WebContent/WEB-INF/weblogic.xml new file mode 100644 index 0000000..4bf3f4f --- /dev/null +++ b/WebContent/WEB-INF/weblogic.xml @@ -0,0 +1,10 @@ + + + + + + true + + diff --git a/WebContent/index.jsp b/WebContent/index.jsp new file mode 100644 index 0000000..3807987 --- /dev/null +++ b/WebContent/index.jsp @@ -0,0 +1,92 @@ + + + + Eclipse BIRT Home + + + + + <% + String javaVersion = System.getProperty("java.version"); + String viewerVersion = "4.5.0"; + String engineVersion = "4.5.0"; + %> + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ BIRT viewer has been installed.

  +

+ Idea +
 
+ +

Thank you for your choosing BIRT (Business Intelligence Reporting Tool).

+

Viewer Version : <%= viewerVersion %>

+

Engine Version: <%= engineVersion %>

+ <% + String javaVersionMessage = javaVersion; + + // check Java version + String[] versionParts = javaVersion.split("\\."); + int majorVersion = 0; + int minorVersion = 0; + try + { + majorVersion = Integer.parseInt(versionParts[0]); + minorVersion = Integer.parseInt(versionParts[1]); + if ( majorVersion < 1 || ( majorVersion == 1 && minorVersion < 5 ) ) + { + javaVersionMessage = "" + javaVersion + " (WARNING: BIRT " + viewerVersion + " only supports JRE versions >= 1.5)"; + } + } + catch (NumberFormatException e) + { + + } + %> +

JRE version: <%= javaVersionMessage %>

+

">View Example +

+ + diff --git a/WebContent/logs/readme.txt b/WebContent/logs/readme.txt new file mode 100644 index 0000000..4987263 --- /dev/null +++ b/WebContent/logs/readme.txt @@ -0,0 +1 @@ +The default directory to place BIRT runtime log files. diff --git a/WebContent/report/images/readme.txt b/WebContent/report/images/readme.txt new file mode 100644 index 0000000..5f0edcd --- /dev/null +++ b/WebContent/report/images/readme.txt @@ -0,0 +1 @@ +The default directory to place BIRT runtime image files. diff --git a/WebContent/scriptlib/readme.txt b/WebContent/scriptlib/readme.txt new file mode 100644 index 0000000..cb9c7d8 --- /dev/null +++ b/WebContent/scriptlib/readme.txt @@ -0,0 +1 @@ +The default directory to place BIRT script lib files. diff --git a/WebContent/test.rptdesign b/WebContent/test.rptdesign new file mode 100644 index 0000000..a7d4c26 --- /dev/null +++ b/WebContent/test.rptdesign @@ -0,0 +1,105 @@ + + + + Bertie the Platypus + Eclipse BIRT Designer Version 1.0.0 Build <20050405-1230> + in + Not a very interesting report, just a "Hello World" with a param. + Sample report used to test the BIRT viewer. + + + sample + aaa + + + + + Sample Parameter + false + string + false + true + false + text-box + false + false + + + + + + + 100% + + + + xx-large + bold + center + + + + + + + + + + 100% + + + + + + html + new Date()]]> + + + + right + + page-number + + + + + + + + + + html + Congratulations! +

+If you can see this report, it means that the BIRT viewer is installed correctly. +

]]>
+
+ + 100% + + 1.354in + + + 5.083in + + + + + + + + + + params["sample"] + params["sample"] + + + params["sample"] + + + + + +
diff --git a/WebContent/webcontent/birt/ajax/core/BirtCommunicationManager.js b/WebContent/webcontent/birt/ajax/core/BirtCommunicationManager.js new file mode 100644 index 0000000..ed0ec28 --- /dev/null +++ b/WebContent/webcontent/birt/ajax/core/BirtCommunicationManager.js @@ -0,0 +1,121 @@ +/****************************************************************************** + * Copyright (c) 2004 Actuate Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Actuate Corporation - Initial implementation. + *****************************************************************************/ + +/** + * BirtCommunicationManager + * ... + */ +BirtCommunicationManager = Class.create( ); + +BirtCommunicationManager.prototype = +{ + __active : false, + + /** + * Initialization routine required by "ProtoType" lib. + * + * @return, void + */ + initialize: function( ) + { + }, + + /** + * Make xml http request. + * + * return, void + */ + connect: function( ) + { + var xmlDoc = birtSoapRequest.__xml_document; + + if( xmlDoc ) + { + debug( birtSoapRequest.prettyPrintXML(xmlDoc), true); + if ( BrowserUtility.isSafari || BrowserUtility.isFirefox3 ) + { + // WORKAROUND: sending the XML DOM doesn't replace the + // ampersands properly but the XMLSerializer does. + xmlDoc = (new XMLSerializer()).serializeToString(xmlDoc); + } + } + + if ( !birtSoapRequest.getURL( ) ) return; + + //activate delay message manager; + this.__active = true; + birtProgressBar.__start( ); + + //workaround for Bugzilla Bug 144598. Add request header "Connection" as "keep-alive" + var myAjax = new Ajax.Request( birtSoapRequest.getURL( ), { method: 'post', postBody: xmlDoc, + contentType: 'text/xml; charset=UTF-8', + onSuccess: this.responseHandler, onFailure: this.invalidResponseHandler, + requestHeaders: ['SOAPAction', '""', 'request-type', 'SOAP', 'Connection', 'keep-alive' ] } ); + birtSoapRequest.reset( ); + }, + + /** + * Callback function triggered when reponse is ready, status is 200. + * + * @request, httpXmlRequest instance + * @return, void + */ + responseHandler: function( request ) + { + if ( isDebugging( ) ) + { + debug(request.responseText, true); + debug(birtSoapRequest.prettyPrintXML(request.responseXML.documentElement), true); + } + + if ( request.responseXML && request.responseXML.documentElement ) + { + birtSoapResponse.process( request.responseXML.documentElement ); + } + + birtCommunicationManager.postProcess( ); + //todo handle responseText + }, + + /** + * Callback function triggered when reponse is ready status is not 200. + * Process any http (non-200) errors. Note this is not exception from + * server side. + * + * @request, httpXmlRequest instance + * @return, void + */ + invalidResponseHandler: function( request ) + { + debug("invalid response"); + + if ( request.responseXML && request.responseXML.documentElement ) + { + birtSoapResponse.process( request.responseXML.documentElement ); + } + + birtCommunicationManager.postProcess( ); + }, + + /** + * Post process after finish processing the response. + * + * @return, void + */ + postProcess: function( ) + { + //deactivate delay message manager + birtProgressBar.__stop( ); + this.__active = false; + } +} + +var birtCommunicationManager = new BirtCommunicationManager( ); \ No newline at end of file diff --git a/WebContent/webcontent/birt/ajax/core/BirtDndManager.js b/WebContent/webcontent/birt/ajax/core/BirtDndManager.js new file mode 100644 index 0000000..6d5daf7 --- /dev/null +++ b/WebContent/webcontent/birt/ajax/core/BirtDndManager.js @@ -0,0 +1,331 @@ +/****************************************************************************** + * Copyright (c) 2004 Actuate Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Actuate Corporation - Initial implementation. + *****************************************************************************/ + +BirtDndManager = function( ) { + + //An item is dragging +this.isDragging = false; + +}; + +BirtDndManager.prototype = { + + __dropTargetManager: null, //PRIVATE - extending classes must use accessor method + + __mousemoveHandlerFunction: null, + + __dropHandlerFunction: null, + + currentDropTarget: null, //Element that is the current valid drop target + + currentDragElement: null, //Element that is currently being dragged + + + /** + Extending classes should use this method to set the drop target manager if + custom drop behavior is desired + @param {DropTargetManager} + */ + setDropTargetManager: function( dTargetManager) + { + this.__dropTargetManager = dTargetManager; + }, + + /** + Drop targets call this method to register as accepting "dragType" items + */ + addAssociation: function(dragType, targetHtmlId, target) + { + if(this.__dropTargetManager == null) + { + throw new WRError("BirtDndManager", "DropTargetManager not set"); + } + this.__dropTargetManager.addAssociation(dragType, targetHtmlId, target); + }, + + /** + Delete an association when the corresponding html element is removed + @param dragType + @param dropTargetId id attribute of html element to remove + */ + deleteAssociation: function(dragType, htmlId) + { + if(this.__dropTargetManager == null) + { + throw new WRError("BirtDndManager", "DropTargetManager not set"); + } + this.__dropTargetManager.deleteAssociation(dragType, htmlId); + }, + + /** + startDrag redefines itself the first time it is called based on the desired type of drag drop behavior. + */ + startDrag: function(element, event, dragType) + { + //If there is no drop target manager, define startDrag as default + if(this.__dropTargetManager == null) + { + this.startDrag = this.__getDefaultStartDrag(); + } + else + { + this.startDrag = this.__getCustomStartDrag(); + } + this.startDrag(element, event, dragType); + }, + + /** + Default start drag function handles elements that drag but do not have drop targets + @returns {function} default start drag function + */ + __getDefaultStartDrag: function() + { + return function(element, event, dragType) + { + debug("default startDrag"); + if(!this.isDragging) + { + this.eventMouseout = this.elementMouseout.bindAsEventListener(this); + + this.__mousemoveHandlerFunction = this.__moveElement.bindAsEventListener(this); + this.__dropElementFunction = this.__dropElement.bindAsEventListener(this); + + var zIndex = this.__activateDragMask(); + this.__elementSetUp(element, event, zIndex); + this.__startDragObservers(this.__mousemoveHandlerFunction, this.__dropElementFunction); + } + this.isDragging = true; + } + }, + + /** + Custom start drag function handles elements that have drop targets + @returns {function} custome start drag function + */ + __getCustomStartDrag: function() + { + return function(element, event, dragType) + { + debug("custom startDrag"); + if(!this.isDragging) + { + + if(dragType == null) //There are no drop targets + { + this.__mousemoveHandlerFunction = this.__moveElement.bindAsEventListener(this); + this.__dropElementFunction = this.__dropElement.bindAsEventListener(this); + } + else + { + this.__dropTargetManager.setUpForDrag(dragType); + this.__mousemoveHandlerFunction = this.__moveElementWithTarget.bindAsEventListener(this); + this.__dropElementFunction = this.__dropElementWithTarget.bindAsEventListener(this); + } + this.eventMouseout = this.elementMouseout.bindAsEventListener(this); + + var zIndex = this.__activateDragMask(); + this.__elementSetUp(element, event, zIndex); + this.__startDragObservers(this.__mousemoveHandlerFunction, this.__dropElementFunction); + } + this.isDragging = true; + } + }, + + __activateDragMask: function() + { + return Mask.show(); + }, + + __deactivateDragMask: function() + { + Mask.hide(); + }, + + /** + Set up an element to be dragged + */ + __elementSetUp: function(elem, event, zIndex) + { + //TODO if removing selections is kept, move to utility funciton + //remove any existing selections + if(document.selection) + { + document.selection.empty(); + } + else if(window.getSelection) + { + var selection = window.getSelection(); + if(selection) + { + selection.removeAllRanges(); + } + } + + this.currentDragElement = elem; + this.currentDragElement.oldZIndex = this.currentDragElement.style.zIndex; + this.currentDragElement.style.zIndex = zIndex; + this.currentDropTarget = null; + //Location of mouse + var mouseX = Event.pointerX(event); + var mouseY = Event.pointerY(event); + //Distance from the edge of the element to edge of browser + var offsets = Element.cumulativeOffset(elem); + //Distance from the edge of the element of mouse + elem.offsetX = (mouseX - offsets[0]); + elem.offsetY = (mouseY - offsets[1]); + + //Used for revert effect + elem.originalTop = parseInt(elem.style.top || '0'); + elem.originalLeft = parseInt(elem.style.left || '0'); + }, + + /** + Start drag event observing + */ + __startDragObservers: function(mousemoveHandlerFunction, dropHandlerFunction) + { + Event.observe(document, "mousemove", mousemoveHandlerFunction, false); + Event.observe(document, "mouseup", dropHandlerFunction, false); + }, + + /** + Move element + */ + __moveElement: function(event) + { + var xPos = Event.pointerX(event); + var yPos = Event.pointerY(event); + + this.__moveCurrentDragElement(xPos, yPos); + }, + + /** + Move element and use DropTargetManager to check if it can be dropped + */ + __moveElementWithTarget: function(event) + { + var xPos = Event.pointerX(event); + var yPos = Event.pointerY(event); + + this.__moveCurrentDragElement(xPos, yPos); + + var oldDropTarget = this.currentDropTarget; //is the state changing? + var dropTarget = this.__dropTargetManager.getDropTarget(xPos, yPos); + + //Change indicator to drop allowed + if(dropTarget) + { + this.currentDropTarget = dropTarget; + if(!oldDropTarget) + { + var nodes = this.currentDragElement.childNodes; + this.toggleDropIndicator(true, nodes); + } + } + else //Change indicator to drop forbidden + { + this.currentDropTarget = null; + if(oldDropTarget) + { + var nodes = this.currentDragElement.childNodes; + this.toggleDropIndicator(false, nodes); + } + } + }, + + __moveCurrentDragElement: function(x, y) + { + var offsets = Element.cumulativeOffset(this.currentDragElement); + //subtract the element's current left, top coordinates from the offsets + offsets[0] -= parseInt(this.currentDragElement.style.left || '0'); + offsets[1] -= parseInt(this.currentDragElement.style.top || '0'); + + var style = this.currentDragElement.style; + + //take current mouse position, subtract difference in drag object position, s + style.left = (x - offsets[0] - this.currentDragElement.offsetX) + "px"; + style.top = (y - offsets[1] - this.currentDragElement.offsetY) + "px"; + }, + + /** + Check if the mouse button is no longer pressed, if not, call + eventDropped. (IE specific) + */ + __mouseStillDown: function(event) + { + /** + Check that the mouse button is still down + (used to detect roll off the screen in IE) + */ + //debug("check mouse down"); + //TODO refine this Check that element is really moving + if(!event.which && event.button == "0") + { + this.eventDropped(event); + return true; + } + return false; + }, + + + /** + Handle mouseout of drag element + */ + elementMouseout: function(event) + { + //debug("mouseout"); + var target = Event.element( event ); + if(target.tagName.toLowerCase() == "iframe") + { + Event.stop(event); + this.eventDropped(event); + } + + }, + + __dropElement: function(event) + { + this.isDragging = false; + + Event.stopObserving(document, "mousemove", this.__mousemoveHandlerFunction); + Event.stopObserving(document, "mouseup", this.__dropElementFunction); + Event.stopObserving(document, "mouseout", this.eventMouseout); + this.__deactivateDragMask(); + this.currentDragElement.style.zIndex = this.currentDragElement.oldZIndex; + }, + + __dropElementWithTarget: function(event) + { + this.__dropElement(event); + + this.__dropTargetManager.dropElementWithTarget(event, this.currentDragElement, this.currentDropTarget); + }, + + + /** + Toggle drop indicator to show if item can be dropped + @param accept {boolean} Indicates if item is accepted + @param nodes {Array} Potential imageHolder nodes //TODO once indicator is decided on can be made more efficient + */ + toggleDropIndicator: function(accept, nodes) + { + for(var j = 0 ; j < nodes.length ; j++) + { + if(nodes[j].imageHolder) + { + accept ? nodes[j].childNodes[0].style.display = "none" : nodes[j].childNodes[0].style.display = "block"; + accept ? nodes[j].childNodes[1].style.display = "block" : nodes[j].childNodes[1].style.display = "none"; + break; + } + } + } + +} \ No newline at end of file diff --git a/WebContent/webcontent/birt/ajax/core/BirtEvent.js b/WebContent/webcontent/birt/ajax/core/BirtEvent.js new file mode 100644 index 0000000..26b725c --- /dev/null +++ b/WebContent/webcontent/birt/ajax/core/BirtEvent.js @@ -0,0 +1,48 @@ +/****************************************************************************** + * Copyright (c) 2004 Actuate Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Actuate Corporation - Initial implementation. + *****************************************************************************/ + +/** + * BirtEvent + */ +BirtEvent = Class.create( ); + +BirtEvent.prototype = +{ + __E_WARN : '__E_WARN', + __E_BLUR : '__E_BLUR', // Blur current selection. + __E_GETPAGE : '__E_GETPAGE', // Getting pagination page. + __E_GETPAGE_INIT : '__E_GETPAGE_INIT', // Getting pagination page with parameters. + __E_PRINT : '__E_PRINT', // Print event. + __E_PRINT_SERVER : '__E_PRINT_SERVER', // Print event. + __E_QUERY_EXPORT : '__E_QUERY_EXPORT', + __E_TOC : '__E_TOC', + __E_TOC_IMAGE_CLICK : '__E_TOC_IMAGE_CLICK', + __E_PARAMETER : '__E_PARAMETER', + __E_CHANGE_PARAMETER : '__E_CHANGE_PARAMETER', //Change parameter event. + __E_CACHE_PARAMETER : '__E_CACHE_PARAMETER', //Cache parameter event. + __E_CASCADING_PARAMETER : '__E_CASCADING_PARAMETER', //Cascading parameter event. + __E_PDF : '__E_PDF', // Create pdf event. + __E_CANCEL_TASK : '__E_CANCEL_TASK', // Cancel current task event. + __E_GETPAGE_ALL : '__E_GETPAGE_ALL', // Get all pages. + __E_EXPORT_REPORT : '__E_EXPORT_REPORT', // Export report + + /** + * Initialization routine required by "ProtoType" lib. + * Define available birt events. + * + * @return, void + */ + initialize: function( ) + { + } +} + +var birtEvent = new BirtEvent( ); \ No newline at end of file diff --git a/WebContent/webcontent/birt/ajax/core/BirtEventDispatcher.js b/WebContent/webcontent/birt/ajax/core/BirtEventDispatcher.js new file mode 100644 index 0000000..d342a06 --- /dev/null +++ b/WebContent/webcontent/birt/ajax/core/BirtEventDispatcher.js @@ -0,0 +1,244 @@ +/****************************************************************************** + * Copyright (c) 2004 Actuate Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Actuate Corporation - Initial implementation. + *****************************************************************************/ + +/** + * BirtEventDispatcher + * ... + */ +BirtEventDispatcher = Class.create( ); + +BirtEventDispatcher.prototype = +{ + __focusId : null, + + __event_map : { }, + + /** + * Initialization routine required by "ProtoType" lib. + * + * @return, void + */ + initialize : function( ) + { + }, + + /** + * Register birt event handler with global birt event dispatcher to + * handle birt events (Not native events). + * + * @eventType, pre-defined birt event type + * @id, ui object id + * @handler, birt event handler + * @return, void + */ + registerEventHandler : function( eventType, id, handler ) + { + if ( !this.__event_map[eventType] ) + { + this.__event_map[eventType] = { }; + } + + this.__event_map[eventType][id] = handler; + }, + + /** + * Register birt event handler with global birt event dispatcher to + * handle birt events (Not native events). + * + * @eventType, pre-defined birt event type + * @id, ui object id + * @handler, birt event handler + * @return, void + */ + unregisterEventHandler : function( eventType, id ) + { + if( this.__event_map[eventType] && this.__event_map[eventType][id] ) + { + delete this.__event_map[eventType][id]; //deletes 'id' property + } + }, + + /** + Unregisters all handlers associated with a particular id + @param id ui object id + */ + unregisterEventHandlerById : function( id ) + { + debug(birtEventDispatcher.toString()); + for( var eventType in this.__event_map) + { + if( this.__event_map[eventType][id]) + { + delete this.__event_map[eventType][id]; //deletes 'id' property + } + } + debug(birtEventDispatcher.toString()); + }, + + /** + * Register birt event handler with global birt event dispatcher to + * handle birt events (Not native events). + * If the event has already been registered under another handler, + * replace that handler with new handler. + * + * @eventType, pre-defined birt event type + * @id, ui object id + * @handler, birt event handler + * @return, void + */ + replaceEventHandler : function( eventType, id, handler ) + { + if ( !this.__event_map[eventType] ) + { + this.__event_map[eventType] = { }; + } + else + { + for( var eventId in this.__event_map[eventType] ) + { + delete this.__event_map[eventType][eventId]; //unregister previous event handler + } + } + + this.__event_map[eventType][id] = handler; + }, + + /** + * Fire birt event. Objects that is or is the child of current focused object are waken. + * Their registered event handlers are triggered. + * + * @eventType, pr-defined birt events. + * @object, event parameters. + * @return, void + */ + fireEvent : function( eventType, object ) + { + var handled = this.sendEvent( eventType, object, false ); + if ( !handled ) + { + this.broadcastEvent( birtEvent.__E_WARN ); + } + }, + + /** + * Fire birt event. Objects that is or is the child of current focused object are waken. + * Their registered event handlers are triggered. + * + * @eventType, pr-defined birt events. + * @object, event parameters. + * @return, void + */ + broadcastEvent : function( eventType, object ) + { + this.sendEvent( eventType, object, true ); + }, + + /** + * Fire birt event. Objects that is or is the child of current focused object are waken. + * Their registered event handlers are triggered. + * + * @eventType, pr-defined birt events. + * @object, event parameters. + * @return, void + */ + sendEvent : function( eventType, object, isBroadcast ) + { + var processed = false; + var serverCall = false; + var focus = this.__focusId ? this.__focusId : birtReportDocument.__instance.id; + + for ( var id in this.__event_map[ eventType ] ) + { + if ( !isBroadcast && focus && focus != id ) + { + // TODO: need more complex scheme. + continue; + } + + var handler = this.__event_map[ eventType ][ id ]; + if ( handler ) + { + processed = true; + } + if ( handler( id, object ) ) + { + serverCall = true; + } + } + + if( serverCall ) + { + birtCommunicationManager.connect( ); + } + + return processed; + }, + + /** + * @param id id of current DOM element in focus. + */ + setFocusId : function( id ) + { + this.__focusId = id; + }, + + /** + * @return id id of current DOM element in focus. + */ + getFocusId : function( ) + { + return this.__focusId; + }, + + /** + * Convenience method. + * + * @param element current DOM element in focus, must have id + */ + setFocusElement : function( element ) + { + this.__focusId = element.id || null; + }, + + /** + * Convenience method. + * + * @return element current DOM element in focus + */ + getFocusElement : function( ) + { + return $( this.__focusId ); + }, + + + toString: function( ) + { + var str = ""; + str += "----start-------BirtEventDispatcher.toString------------"; + str += "\n"; + str += (" focusId = " + this.__focusId); + for(var i in this.__event_map) + { + str += "\n"; + str += (" eventType = " + i); + for(var k in this.__event_map[i]) + { + str += "\n"; + str += (" id = " + k); + } + } + str += "\n"; + str += "------end-------BirtEventDispatcher.toString------------"; + return str; + } +} + +var birtEventDispatcher = new BirtEventDispatcher( ); \ No newline at end of file diff --git a/WebContent/webcontent/birt/ajax/core/BirtSoapRequest.js b/WebContent/webcontent/birt/ajax/core/BirtSoapRequest.js new file mode 100644 index 0000000..ec660a7 --- /dev/null +++ b/WebContent/webcontent/birt/ajax/core/BirtSoapRequest.js @@ -0,0 +1,356 @@ +/****************************************************************************** + * Copyright (c) 2004 Actuate Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Actuate Corporation - Initial implementation. + *****************************************************************************/ + +/** + * BirtSoapRequest + * ... + */ +BirtSoapRequest = Class.create( ); + +BirtSoapRequest.prototype = +{ + SOAP_NAMESPACE_URI : "http://schemas.xmlsoap.org/soap/envelope/", + BIRT_NAMESPACE_URI : "http://schemas.eclipse.org/birt", + + __url : null, + __message : null, + __xml_document : null, + __operation_content : null, + + /** + * Initialization routine required by "ProtoType" lib. + * + * @return, void + */ + initialize : function( ) + { + /* + XML namespaces are supported by the following browsers : + - Firefox 2 and 3 + - Safari 3 + - Mozilla 1.7.13 + Unsupported by: + - IE6 nor IE7 + */ + this.hasXmlNamespaceSupport = ( typeof( document.createElementNS ) != "undefined" ); + + this.reset(); + }, + + /** + * Init the request message. There's only one request message DOM instance at any time, + * when client running. + * + * @message, request message DOM + * @return, void + */ + setMessage : function( message ) + { + // TODO: need to use dom contrcture the request. + this.__xml_document = message; + }, + + /** + * Retrieve the request message. + * + * @return, request message in DOM + */ + getMessage : function( message ) + { + return this.__message; + }, + + /** + * Retrieve the request message. + * + * @return, request message in DOM + */ + setURL : function( url ) + { + this.__url = url; + }, + + /** + * Retrieve the request message. + * + * @return, request message in DOM + */ + getURL : function( ) + { + return this.__url; + }, + + /** + * Clears the message body + */ + reset : function( ) + { + // Soap envelope + this.__xml_document = this.createXMLDom( this.SOAP_NAMESPACE_URI, "soap:Envelope" ); + + var soapEnv = this.__xml_document.documentElement; + + // Soap body + var soapBody; + + if ( this.hasXmlNamespaceSupport ) + { + soapBody = this.__xml_document.createElementNS( this.SOAP_NAMESPACE_URI, "Body" ); + } + else + { + soapBody = this.__xml_document.createElement( "soap:Body" ); + } + + soapEnv.appendChild( soapBody ); + + // Get updated objects method + var getUpdatedObjects = this.createBirtElement( "GetUpdatedObjects" ); + if ( !this.hasXmlNamespaceSupport ) + { + // only the first element needs the xmlns attribute + getUpdatedObjects.setAttribute( "xmlns", this.BIRT_NAMESPACE_URI ); + } + + soapBody.appendChild( getUpdatedObjects ); + + this.__operation_content = getUpdatedObjects; + + var str = this.prettyPrintXML( this.__xml_document.documentElement, false ); + debug( "RESET XML : new message body is\n" + str ); + }, + + /** + * Utility method to create an XML element in the birt namespace. + * + * @param qualifiedName qualified name + */ + createBirtElement : function( qualifiedName ) + { + if ( this.hasXmlNamespaceSupport ) + { + return this.__xml_document.createElementNS( this.BIRT_NAMESPACE_URI, qualifiedName ); + } + else + { + return this.__xml_document.createElement( qualifiedName ); + } + }, + + /** + * Utility method creates an XML document. + * + * @param rootName the name of documentElement + * @return xmlDocument a new XML document + */ + createXMLDom : function( namespaceUri, qualifiedName ) + { + if ( document.implementation && document.implementation.createDocument ) + { + // DOM Level 2 Browsers + var dom = document.implementation.createDocument( namespaceUri, qualifiedName, null ); + if ( !dom.documentElement ) + { + dom.appendChild( dom.createElement( qualifiedName ) ); + } + + return dom; + } + else if ( window.ActiveXObject ) + { + // Internet Explorer + var createdDocument = new ActiveXObject( "Microsoft.XMLDOM" ); + var documentElement = createdDocument.createElement( qualifiedName ); + createdDocument.appendChild( documentElement ); + + // check for a namespace prefix + var namespacePrefix = null; + var nameParts = qualifiedName.split(":"); + if ( nameParts.length > 0 ) + { + namespacePrefix = nameParts[0]; + qualifiedName = nameParts[1]; + } + + var nsAttribute = "xmlns"; + if ( namespacePrefix ) + { + nsAttribute += ":" + namespacePrefix; + } + + documentElement.setAttribute( nsAttribute, namespaceUri ); + return createdDocument; + } + else + { + throw "Unable to create new Document."; + } + }, + + /** + * Adds Operation type to message. + * + * @param id id of UIComponent + * @param operator name of desired operation (from Constants.js) + * @param data xmlElement type 'Data' or null if not applicable + * @param (optional) argument[1] - argument[n] object {name: "paramName1", value: "paramValue1"} + */ + addOperation : function( id, type, operator, data ) + { + var optionalArgs = 4; //number of params + var operation = this.createBirtElement( "Operation" ); + + // Target + var target = this.createBirtElement( "Target" ); + operation.appendChild( target ); + + // Target id + var reportId = this.createBirtElement( "Id" ); + target.appendChild( reportId ); + var reportIdText = this.__xml_document.createTextNode( id || "Error-id" ); + reportId.appendChild( reportIdText ); + + // Target type + var reportType = this.createBirtElement( "Type" ); + target.appendChild( reportType ); + var reportTypeText = this.__xml_document.createTextNode( type || "Error-id" ); + reportType.appendChild( reportTypeText ); + + // Operator + var operatorEl = this.createBirtElement( "Operator" ); + var targetText = this.__xml_document.createTextNode( operator || "Error-operator" ); + operatorEl.appendChild( targetText ); + operation.appendChild( operatorEl ); + + // Oprands + if( arguments.length > optionalArgs ) //there are optional parameters + { + var operand, name, value; + for( var i = optionalArgs; i < arguments.length; i++ ) + { + if( arguments[i].length && arguments[i].length > 0 ) + { + for( var j = 0; j < arguments[i].length; j++ ) + { + if ( !arguments[i][j].name ) + { + continue; + } + + operand = this.createBirtElement( "Oprand" ); + name = this.createBirtElement( "Name" ); + nameText = this.__xml_document.createTextNode( arguments[i][j].name ); + name.appendChild( nameText ); + operand.appendChild( name ); + value = this.createBirtElement( "Value" ); + valueText = this.__xml_document.createTextNode( arguments[i][j].value ); + value.appendChild( valueText ); + operand.appendChild( value ); + operation.appendChild( operand ); + } + } + else + { + if ( arguments[i].name ) + { + operand = this.createBirtElement( "Oprand" ); + name = this.createBirtElement( "Name" ); + nameText = this.__xml_document.createTextNode( arguments[i].name ); + name.appendChild( nameText ); + operand.appendChild( name ); + value = this.createBirtElement( "Value" ); + valueText = this.__xml_document.createTextNode( arguments[i].value ); + value.appendChild( valueText ); + operand.appendChild( value ); + operation.appendChild( operand ); + } + } + } + } + + // Data + if( data ) + { + operation.appendChild( data.documentElement ); + } + + this.__operation_content.appendChild( operation ); + + var str = this.prettyPrintXML( this.__xml_document.documentElement, false ); + debug( "ADDED OPERATION : new message body is\n" + str ); + }, + + /** + * Creates string of xml, optionally prints to debug window. + * + * @param xmlRoot documentElement of xml Element + * @param str leave empty -- used in recursive call + * @param offset leave empty -- used in recursive call + * @return String with indented tree of elements and text contents + */ + prettyPrintXML : function( xmlRoot, isDebug, str, offset ) + { + if( !str ) + { + str = ""; + } + + var myIndent = 6; + if( offset == null ) + { + myIndent = 2; + } + else + { + myIndent += offset; + } + var spacer = ""; + for( var i = 0; i < myIndent;i++ ) + { + spacer += " "; + } + var topLevel = xmlRoot.childNodes; + var size = topLevel.length; + var temp; + for( var i = 0; i < size; i++ ) + { + var curNode = topLevel[i]; + + //either node or a leaf + if( curNode.nodeType == "1" ) + { + str += spacer + "<" + curNode.nodeName + ">\n"; + if( isDebug ) + { + debug( spacer + "<" + curNode.nodeName + ">" ); + } + str = this.prettyPrintXML( curNode, isDebug, str, myIndent ); + str += spacer + "</" + curNode.nodeName + ">\n"; + if( isDebug ) + { + debug( spacer + "</" + curNode.nodeName + ">" ); + } + } + else + { + str += spacer + curNode.data + "\n"; + if( isDebug ) + { + debug( spacer + curNode.data ); + } + } + } + + return str; + } +} + +var birtSoapRequest = new BirtSoapRequest( ); \ No newline at end of file diff --git a/WebContent/webcontent/birt/ajax/core/BirtSoapResponse.js b/WebContent/webcontent/birt/ajax/core/BirtSoapResponse.js new file mode 100644 index 0000000..368692f --- /dev/null +++ b/WebContent/webcontent/birt/ajax/core/BirtSoapResponse.js @@ -0,0 +1,82 @@ +/****************************************************************************** + * Copyright (c) 2004 Actuate Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Actuate Corporation - Initial implementation. + *****************************************************************************/ + +/** + * BirtSoapResponse + * ... + */ +BirtSoapResponse = Class.create( ); + +BirtSoapResponse.prototype = +{ + /** + * Initialization routine required by "ProtoType" lib. + * + * @return, void + */ + initialize: function( ) + { + }, + + /** + * Process the soap response, dispatcher message content to designated + * message handlers. + * + * @message, incoming soap message DOM + * @return, void + */ + process: function( message ) + { + // TODO: will gradually remove it since not all response are in soap now. + var soapBody = message.getElementsByTagName( 'soapenv:Body' )[ 0 ]; + if ( !soapBody ) + { + soapBody = message.getElementsByTagName( 'Body' )[ 0 ]; + } + + if ( soapBody ) + { + for ( var i = 0; i < soapBody.childNodes.length; i++ ) + { + if ( soapBody.childNodes[i].nodeType == 1 ) // Need to use NodeType definition. + { + if ( soapBody.childNodes[i].tagName == 'soapenv:Fault' ) + { + birtExceptionDialog.__cb_bind( soapBody.childNodes[i] ); + } + else + { + var handler = eval( 'birt' + soapBody.childNodes[i].tagName + 'Handler' ); + if ( handler ) + { + handler.__process( soapBody.childNodes[i] ); + } + } + + break; + } + } + + return; + } + + if ( message ) + { + var handler = eval( 'birt' + message.tagName + 'ResponseHandler' ); + if ( handler ) + { + handler.__process( message ); + } + } + } +} + +var birtSoapResponse = new BirtSoapResponse( ); \ No newline at end of file diff --git a/WebContent/webcontent/birt/ajax/core/Mask.js b/WebContent/webcontent/birt/ajax/core/Mask.js new file mode 100644 index 0000000..1132970 --- /dev/null +++ b/WebContent/webcontent/birt/ajax/core/Mask.js @@ -0,0 +1,195 @@ +// Copyright 1994-2006, Actuate Software Corp., All rights reserved. + +Mask = Class.create(); + +Mask.prototype = { + + zIndexStack: [], + zIndexBase: 200, //Lowest zIndex for mask + zIndexCurrent: null, + opacity: 0, //Default opacity is zero + _baseElements : null, + + initialize: function(useIframe, opacity) + { + this.zIndexCurrent = this.zIndexBase; + + if(useIframe) + { + this.__useIFrame = true; + this.__mask = document.createElement( 'iframe' ); + // Workaround for IE https secure warning + this.__mask.src = "birt/pages/common/blank.html"; + } + else + { + this.__useIFrame = false; + this.__mask = document.createElement( 'div' ); + } + + this.__mask.id = "Mask"; + //default opacity to zero + if(opacity) + { + debug("setting opacity to : " + opacity); + this.opacity = opacity; + } + document.body.appendChild( this.__mask ); + this.__mask.style.position = 'absolute'; + this.__mask.style.top = '0px'; + this.__mask.style.left = '0px'; + var width = BirtPosition.viewportWidth(); + this.__mask.style.width = width + 'px'; + var height = BirtPosition.viewportHeight(); + this.__mask.style.height = height + 'px'; + this.__mask.style.zIndex = '200'; + this.__mask.style.backgroundColor = '#0044ff'; + this.__mask.style.filter = 'alpha( opacity=' + ( this.opacity * 100 ) + ')'; + this.__mask.style.opacity = this.opacity; + this.__mask.scrolling = 'no'; + this.__mask.marginHeight = '0px'; + this.__mask.marginWidth = '0px'; + this.__mask.style.display = 'none'; + // Support low version Mozilla/NS + this.__mask.style.MozOpacity = 0; + + if(useIframe) + { + this.__useIFrame = true; + this.__progressBarMask = document.createElement( 'iframe' ); + // Workaround for IE https secure warning + this.__progressBarMask.src = "birt/pages/common/blank.html"; + } + else + { + this.__useIFrame = false; + this.__progressBarMask = document.createElement( 'div' ); + } + + document.body.appendChild( this.__progressBarMask ); + this.__progressBarMask.style.position = 'absolute'; + this.__progressBarMask.style.top = '0px'; + this.__progressBarMask.style.left = '0px'; + var width = BirtPosition.viewportWidth(); + this.__progressBarMask.style.width = width + 'px'; + var height = BirtPosition.viewportHeight(); + this.__progressBarMask.style.height = height + 'px'; + this.__progressBarMask.style.zIndex = '200'; + this.__progressBarMask.style.backgroundColor = '#ff0000'; + this.__progressBarMask.style.filter = 'alpha( opacity=' + ( this.opacity * 100 ) + ')'; + this.__progressBarMask.style.opacity = this.opacity; + this.__progressBarMask.scrolling = 'no'; + this.__progressBarMask.marginHeight = '0px'; + this.__progressBarMask.marginWidth = '0px'; + this.__progressBarMask.style.display = 'none'; + this.__progressBarMask.style.cursor = "move"; //cursor is set to a different value than desired so that change is trigged in IE + + this.__eh_resize_closure = this.__eh_resize.bindAsEventListener( this ); + Event.observe( window, 'resize', this.__eh_resize_closure, false ); + }, + + /** + * Sets the element DOM objects present on the main window. + * They will be disabled when the mask is floating on the top + * of them. + * @param baseElements array of base elements + */ + setBaseElements : function( baseElements ) + { + this._baseElements = baseElements; + }, + + /* + If mask is not shown, shows mask, otherwise, moves mask zIndex above last returned zIndex. + @returns zIndex for element to place directly above mask + */ + show: function() + { + if(this.zIndexStack.length == 0) + { + this._updateElements(this._baseElements, false); + + Element.show( this.__mask ); + } + this.__mask.style.zIndex = this.zIndexCurrent; + this.zIndexStack.push(this.zIndexCurrent); + this.zIndexCurrent++; + var dialogZIndex = this.zIndexCurrent; + this.zIndexCurrent++; + + return dialogZIndex; + }, + + /* + Resizes masks to current screen width (not including scrollbars) + */ + __eh_resize: function() + { + var width = BirtPosition.viewportWidth(); + var height = BirtPosition.viewportHeight(); + + this.__mask.style.width = width + 'px'; + this.__mask.style.height = height + 'px'; + this.__progressBarMask.style.width = width + 'px'; + this.__progressBarMask.style.height = height + 'px'; + }, + + /* + Shows progress bar mask above the highest regular item zIndex. + */ + showProgressBarMask: function() + { + this.__progressBarMask.style.cursor = "wait"; + + Element.show( this.__progressBarMask ); + + this.__progressBarMask.style.zIndex = this.zIndexCurrent; + + return (this.zIndexCurrent + 1); + + }, + + hide: function() + { + if(this.zIndexStack.length == 1) + { + this._updateElements(this._baseElements, true); + + Element.hide( this.__mask ); + this.zIndexStack.pop(); + this.zIndexCurrent = this.zIndexBase; + } + else + { + this.zIndexCurrent = this.zIndexStack.pop(); + this.__mask.style.zIndex = this.zIndexStack[this.zIndexStack.length -1]; + } + }, + + hideProgressBarMask: function() + { + this.__progressBarMask.style.cursor = "move"; + + Element.hide( this.__progressBarMask ); + }, + + isIFrame: function() + { + return this.__useIFrame; + }, + + _updateElements : function(elements, enable) + { + if ( !elements ) + { + return; + } + + var func = enable?birtUtility.restoreTabIndexes:birtUtility.disableTabIndexes; + for ( var i = 0; i < elements.length; i++ ) + { + func.call(birtUtility, $(elements[i])); + } + } + +} diff --git a/WebContent/webcontent/birt/ajax/lib/head.js b/WebContent/webcontent/birt/ajax/lib/head.js new file mode 100644 index 0000000..ea0b659 --- /dev/null +++ b/WebContent/webcontent/birt/ajax/lib/head.js @@ -0,0 +1,1083 @@ +/*! + * HeadJS The only script in your + * Author Tero Piirainen (tipiirai) + * Maintainer Robert Hoffmann (itechnology) + * License MIT / http://bit.ly/mit-license + * + * Version 0.99 + * http://headjs.com + */ +; (function (win, undefined) { + "use strict"; + + // gt, gte, lt, lte, eq breakpoints would have been more simple to write as ['gt','gte','lt','lte','eq'] + // but then we would have had to loop over the collection on each resize() event, + // a simple object with a direct access to true/false is therefore much more efficient + var doc = win.document, + nav = win.navigator, + loc = win.location, + html = doc.documentElement, + klass = [], + conf = { + screens : [240, 320, 480, 640, 768, 800, 1024, 1280, 1440, 1680, 1920], + screensCss: { "gt": true, "gte": false, "lt": true, "lte": false, "eq": false }, + browsers : [ + { ie : { min: 6, max: 10 } } + //,{ chrome : { min: 8, max: 24 } } + //,{ ff : { min: 3, max: 19 } } + //,{ ios : { min: 3, max: 6 } } + //,{ android: { min: 2, max: 4 } } + //,{ webkit : { min: 9, max: 12 } } + //,{ opera : { min: 9, max: 12 } } + ], + browserCss: { "gt": true, "gte": false, "lt": true, "lte": false, "eq": true }, + section : "-section", + page : "-page", + head : "head" + }; + + if (win.head_conf) { + for (var item in win.head_conf) { + if (win.head_conf[item] !== undefined) { + conf[item] = win.head_conf[item]; + } + } + } + + function pushClass(name) { + klass[klass.length] = name; + } + + function removeClass(name) { + var re = new RegExp("\\b" + name + "\\b"); + html.className = html.className.replace(re, ''); + } + + function each(arr, fn) { + for (var i = 0, l = arr.length; i < l; i++) { + fn.call(arr, arr[i], i); + } + } + + // API + var api = win[conf.head] = function () { + api.ready.apply(null, arguments); + }; + + api.feature = function (key, enabled, queue) { + + // internal: apply all classes + if (!key) { + html.className += ' ' + klass.join(' '); + klass = []; + return api; + } + + if (Object.prototype.toString.call(enabled) === '[object Function]') { + enabled = enabled.call(); + } + + pushClass((enabled ? '' : 'no-') + key); + api[key] = !!enabled; + + // apply class to HTML element + if (!queue) { + removeClass('no-' + key); + removeClass(key); + api.feature(); + } + + return api; + }; + + // no queue here, so we can remove any eventual pre-existing no-js class + api.feature("js", true); + + // browser type & version + var ua = nav.userAgent.toLowerCase(), + mobile = /mobile|midp/.test(ua); + + // useful for enabling/disabling feature (we can consider a desktop navigator to have more cpu/gpu power) + api.feature("mobile" , mobile , true); + api.feature("desktop", !mobile, true); + + // http://www.zytrax.com/tech/web/browser_ids.htm + // http://www.zytrax.com/tech/web/mobile_ids.html + ua = /(chrome|firefox)[ \/]([\w.]+)/.exec(ua) || // Chrome & Firefox + /(iphone|ipad|ipod)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || // Mobile IOS + /(android)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || // Mobile Webkit + /(webkit|opera)(?:.*version)?[ \/]([\w.]+)/.exec(ua) || // Safari & Opera + /(msie) ([\w.]+)/.exec(ua) || []; + + + var browser = ua[1], + version = parseFloat(ua[2]); + + switch (browser) { + case 'msie': + browser = 'ie'; + version = doc.documentMode || version; + break; + + case 'firefox': + browser = 'ff'; + break; + + case 'ipod': + case 'ipad': + case 'iphone': + browser = 'ios'; + break; + + case 'webkit': + browser = 'safari'; + break; + } + + + // Browser vendor and version + api.browser = { + name : browser, + version: version + }; + api.browser[browser] = true; + + for (var i = 0, l = conf.browsers.length; i < l; i++) { + for (var key in conf.browsers[i]) { + if (browser === key) { + pushClass(key); + + var min = conf.browsers[i][key].min; + var max = conf.browsers[i][key].max; + + for (var v = min; v <= max; v++) { + if (version > v) { + if (conf.browserCss["gt"]) + pushClass("gt-" + key + v); + + if (conf.browserCss["gte"]) + pushClass("gte-" + key + v); + } + + else if (version < v) { + if (conf.browserCss["lt"]) + pushClass("lt-" + key + v); + + if (conf.browserCss["lte"]) + pushClass("lte-" + key + v); + } + + else if (version === v) { + if (conf.browserCss["lte"]) + pushClass("lte-" + key + v); + + if (conf.browserCss["eq"]) + pushClass("eq-" + key + v); + + if (conf.browserCss["gte"]) + pushClass("gte-" + key + v); + } + } + } + else { + pushClass('no-' + key); + } + } + } + + + // IE lt9 specific + if (browser === "ie" && version < 9) { + // HTML5 support : you still need to add html5 css initialization styles to your site + // See: assets/html5.css + each("abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video".split("|"), function (el) { + doc.createElement(el); + }); + } + + + // CSS "router" + each(loc.pathname.split("/"), function (el, i) { + if (this.length > 2 && this[i + 1] !== undefined) { + if (i) { + pushClass(this.slice(1, i + 1).join("-").toLowerCase() + conf.section); + } + } else { + // pageId + var id = el || "index", index = id.indexOf("."); + if (index > 0) { + id = id.substring(0, index); + } + + html.id = id.toLowerCase() + conf.page; + + // on root? + if (!i) { + pushClass("root" + conf.section); + } + } + }); + + + // basic screen info + api.screen = { + height: win.screen.height, + width : win.screen.width + }; + + // viewport resolutions: w-100, lt-480, lt-1024 ... + function screenSize() { + // remove earlier sizes + html.className = html.className.replace(/ (w-|eq-|gt-|gte-|lt-|lte-|portrait|no-portrait|landscape|no-landscape)\d+/g, ""); + + // Viewport width + var iw = win.innerWidth || html.clientWidth, + ow = win.outerWidth || win.screen.width; + + api.screen['innerWidth'] = iw; + api.screen['outerWidth'] = ow; + + // for debugging purposes, not really useful for anything else + pushClass("w-" + iw); + + each(conf.screens, function (width) { + if (iw > width) { + if (conf.screensCss["gt"]) + pushClass("gt-" + width); + + if (conf.screensCss["gte"]) + pushClass("gte-" + width); + } + + else if (iw < width) { + if (conf.screensCss["lt"]) + pushClass("lt-" + width); + + if (conf.screensCss["lte"]) + pushClass("lte-" + width); + } + + else if (iw === width) { + if (conf.screensCss["lte"]) + pushClass("lte-" + width); + + if (conf.screensCss["eq"]) + pushClass("e-q" + width); + + if (conf.screensCss["gte"]) + pushClass("gte-" + width); + } + }); + + + // Viewport height + var ih = win.innerHeight || html.clientHeight, + oh = win.outerHeight || win.screen.height; + + api.screen['innerHeight'] = ih; + api.screen['outerHeight'] = oh; + + // no need for onChange event to detect this + api.feature("portrait" , (ih > iw)); + api.feature("landscape", (ih < iw)); + } + + screenSize(); + + // Throttle navigators from triggering too many resize events + var resizeId = 0; + function onResize() { + win.clearTimeout(resizeId); + resizeId = win.setTimeout(screenSize, 100); + } + + // Manually attach, as to not overwrite existing handler + if (win.addEventListener) { + win.addEventListener("resize", onResize, false); + + } else { + win.attachEvent("onresize", onResize); + } +})(window); + +/*! + * HeadJS The only script in your + * Author Tero Piirainen (tipiirai) + * Maintainer Robert Hoffmann (itechnology) + * License MIT / http://bit.ly/mit-license + * + * Version 0.99 + * http://headjs.com + */ +;(function(win, undefined) { + "use strict"; + + var doc = win.document, + /* + To add a new test: + + head.feature("video", function() { + var tag = document.createElement('video'); + return !!tag.canPlayType; + }); + + Good place to grab more tests + + https://github.com/Modernizr/Modernizr/blob/master/modernizr.js + */ + + /* CSS modernizer */ + el = doc.createElement("i"), + style = el.style, + prefs = ' -o- -moz- -ms- -webkit- -khtml- '.split(' '), + domPrefs = 'Webkit Moz O ms Khtml'.split(' '), + + headVar = win.head_conf && win.head_conf.head || "head", + api = win[headVar]; + + // Thanks Paul Irish! + function testProps(props) { + for (var i in props) { + if (style[props[i]] !== undefined) { + return true; + } + } + + return false; + } + + + function testAll(prop) { + var camel = prop.charAt(0).toUpperCase() + prop.substr(1), + props = (prop + ' ' + domPrefs.join(camel + ' ') + camel).split(' '); + + return !!testProps(props); + } + + var tests = { + gradient: function() { + var s1 = 'background-image:', + s2 = 'gradient(linear,left top,right bottom,from(#9f9),to(#fff));', + s3 = 'linear-gradient(left top,#eee,#fff);'; + + style.cssText = (s1 + prefs.join(s2 + s1) + prefs.join(s3 + s1)).slice(0,-s1.length); + return !!style.backgroundImage; + }, + + rgba: function() { + style.cssText = "background-color:rgba(0,0,0,0.5)"; + return !!style.backgroundColor; + }, + + opacity: function() { + return el.style.opacity === ""; + }, + + textshadow: function() { + return style.textShadow === ''; + }, + + multiplebgs: function() { + style.cssText = "background:url(//:),url(//:),red url(//:)"; + return new RegExp("(url\\s*\\(.*?){3}").test(style.background); + }, + + boxshadow: function() { + return testAll("boxShadow"); + }, + + borderimage: function() { + return testAll("borderImage"); + }, + + borderradius: function() { + return testAll("borderRadius"); + }, + + cssreflections: function() { + return testAll("boxReflect"); + }, + + csstransforms: function() { + return testAll("transform"); + }, + + csstransitions: function() { + return testAll("transition"); + }, + touch: function () { + return 'ontouchstart' in win; + }, + retina: function () { + return (win.devicePixelRatio > 1); + }, + + /* + font-face support. Uses browser sniffing but is synchronous. + http://paulirish.com/2009/font-face-feature-detection/ + */ + fontface: function() { + var browser = api.browser.name, version = api.browser.version; + + switch (browser) { + case "ie": + return version >= 9; + + case "chrome": + return version >= 13; + + case "ff": + return version >= 6; + + case "ios": + return version >= 5; + + case "android": + return false; + + case "webkit": + return version >= 5.1; + + case "opera": + return version >= 10; + + default: + return false; + } + } + }; + + // queue features + for (var key in tests) { + if (tests[key]) { + api.feature(key, tests[key].call(), true); + } + } + + // enable features at once + api.feature(); + +})(window); +/*! + * HeadJS The only script in your + * Author Tero Piirainen (tipiirai) + * Maintainer Robert Hoffmann (itechnology) + * License MIT / http://bit.ly/mit-license + * + * Version 0.99 + * http://headjs.com + */ +; (function (win, undefined) { + "use strict"; + + var doc = win.document, + domWaiters = [], + queue = [], // waiters for the "head ready" event + handlers = {}, // user functions waiting for events + assets = {}, // loadable items in various states + isAsync = "async" in doc.createElement("script") || "MozAppearance" in doc.documentElement.style || win.opera, + isHeadReady, + isDomReady, + + /*** public API ***/ + headVar = win.head_conf && win.head_conf.head || "head", + api = win[headVar] = (win[headVar] || function () { api.ready.apply(null, arguments); }), + + // states + PRELOADING = 1, + PRELOADED = 2, + LOADING = 3, + LOADED = 4; + + // Method 1: simply load and let browser take care of ordering + if (isAsync) { + api.load = function () { + /// + /// INFO: use cases + /// head.load("http://domain.com/file.js","http://domain.com/file.js", callBack) + /// head.load({ label1: "http://domain.com/file.js" }, { label2: "http://domain.com/file.js" }, callBack) + /// + var args = arguments, + callback = args[args.length - 1], + items = {}; + + if (!isFunction(callback)) { + callback = null; + } + + each(args, function (item, i) { + if (item !== callback) { + item = getAsset(item); + items[item.name] = item; + + load(item, callback && i === args.length - 2 ? function () { + if (allLoaded(items)) { + one(callback); + } + + } : null); + } + }); + + return api; + }; + + + // Method 2: preload with text/cache hack + } else { + api.load = function () { + var args = arguments, + rest = [].slice.call(args, 1), + next = rest[0]; + + // wait for a while. immediate execution causes some browsers to ignore caching + if (!isHeadReady) { + queue.push(function () { + api.load.apply(null, args); + }); + + return api; + } + + // multiple arguments + if (!!next) { + /* Preload with text/cache hack (not good!) + * http://blog.getify.com/on-script-loaders/ + * http://www.nczonline.net/blog/2010/12/21/thoughts-on-script-loaders/ + * If caching is not configured correctly on the server, then items could load twice ! + *************************************************************************************/ + each(rest, function (item) { + if (!isFunction(item)) { + preLoad(getAsset(item)); + } + }); + + // execute + load(getAsset(args[0]), isFunction(next) ? next : function () { + api.load.apply(null, rest); + }); + } + else { + // single item + load(getAsset(args[0])); + } + + return api; + }; + } + + // INFO: for retro compatibility + api.js = api.load; + + api.test = function (test, success, failure, callback) { + /// + /// INFO: use cases: + /// head.test(condition, null , "file.NOk" , callback); + /// head.test(condition, "fileOk.js", null , callback); + /// head.test(condition, "fileOk.js", "file.NOk" , callback); + /// head.test(condition, "fileOk.js", ["file.NOk", "file.NOk"], callback); + /// head.test({ + /// test : condition, + /// success : [{ label1: "file1Ok.js" }, { label2: "file2Ok.js" }], + /// failure : [{ label1: "file1NOk.js" }, { label2: "file2NOk.js" }], + /// callback: callback + /// ); + /// head.test({ + /// test : condition, + /// success : ["file1Ok.js" , "file2Ok.js"], + /// failure : ["file1NOk.js", "file2NOk.js"], + /// callback: callback + /// ); + /// + var obj = (typeof test === 'object') ? test : { + test: test, + success: !!success ? isArray(success) ? success : [success] : false, + failure: !!failure ? isArray(failure) ? failure : [failure] : false, + callback: callback || noop + }; + + // Test Passed ? + var passed = !!obj.test; + + // Do we have a success case + if (passed && !!obj.success) { + obj.success.push(obj.callback); + api.load.apply(null, obj.success); + } + // Do we have a fail case + else if (!passed && !!obj.failure) { + obj.failure.push(obj.callback); + api.load.apply(null, obj.failure); + } + else { + callback(); + } + + return api; + }; + + api.ready = function (key, callback) { + /// + /// INFO: use cases: + /// head.ready(callBack) + /// head.ready(document , callBack) + /// head.ready("file.js", callBack); + /// head.ready("label" , callBack); + /// + + // DOM ready check: head.ready(document, function() { }); + if (key === doc) { + if (isDomReady) { + one(callback); + } + else { + domWaiters.push(callback); + } + + return api; + } + + // shift arguments + if (isFunction(key)) { + callback = key; + key = "ALL"; + } + + // make sure arguments are sane + if (typeof key !== 'string' || !isFunction(callback)) { + return api; + } + + // This can also be called when we trigger events based on filenames & labels + var asset = assets[key]; + + // item already loaded --> execute and return + if (asset && asset.state === LOADED || key === 'ALL' && allLoaded() && isDomReady) { + one(callback); + return api; + } + + var arr = handlers[key]; + if (!arr) { + arr = handlers[key] = [callback]; + } + else { + arr.push(callback); + } + + return api; + }; + + + // perform this when DOM is ready + api.ready(doc, function () { + + if (allLoaded()) { + each(handlers.ALL, function (callback) { + one(callback); + }); + } + + if (api.feature) { + api.feature("domloaded", true); + } + }); + + + /* private functions + *********************/ + function noop() { + // does nothing + } + + function each(arr, callback) { + if (!arr) { + return; + } + + // arguments special type + if (typeof arr === 'object') { + arr = [].slice.call(arr); + } + + // do the job + for (var i = 0, l = arr.length; i < l; i++) { + callback.call(arr, arr[i], i); + } + } + + /* A must read: http://bonsaiden.github.com/JavaScript-Garden + ************************************************************/ + function is(type, obj) { + var clas = Object.prototype.toString.call(obj).slice(8, -1); + return obj !== undefined && obj !== null && clas === type; + } + + function isFunction(item) { + return is("Function", item); + } + + function isArray(item) { + return is("Array", item); + } + + function toLabel(url) { + ///Converts a url to a file label + var items = url.split("/"), + name = items[items.length - 1], + i = name.indexOf("?"); + + return i !== -1 ? name.substring(0, i) : name; + } + + // INFO: this look like a "im triggering callbacks all over the place, but only wanna run it one time function" ..should try to make everything work without it if possible + // INFO: Even better. Look into promises/defered's like jQuery is doing + function one(callback) { + ///Execute a callback only once + callback = callback || noop; + + if (callback._done) { + return; + } + + callback(); + callback._done = 1; + } + + function getAsset(item) { + /// + /// Assets are in the form of + /// { + /// name : label, + /// url : url, + /// state: state + /// } + /// + var asset = {}; + + if (typeof item === 'object') { + for (var label in item) { + if (!!item[label]) { + asset = { + name: label, + url : item[label] + }; + } + } + } + else { + asset = { + name: toLabel(item), + url : item + }; + } + + // is the item already existant + var existing = assets[asset.name]; + if (existing && existing.url === asset.url) { + return existing; + } + + assets[asset.name] = asset; + return asset; + } + + function allLoaded(items) { + items = items || assets; + + for (var name in items) { + if (items.hasOwnProperty(name) && items[name].state !== LOADED) { + return false; + } + } + + return true; + } + + + function onPreload(asset) { + asset.state = PRELOADED; + + each(asset.onpreload, function (afterPreload) { + afterPreload.call(); + }); + } + + function preLoad(asset, callback) { + if (asset.state === undefined) { + + asset.state = PRELOADING; + asset.onpreload = []; + + loadAsset({ url: asset.url, type: 'cache' }, function () { + onPreload(asset); + }); + } + } + + function load(asset, callback) { + ///Used with normal loading logic + callback = callback || noop; + + if (asset.state === LOADED) { + callback(); + return; + } + + // INFO: why would we trigger a ready event when its not really loaded yet ? + if (asset.state === LOADING) { + api.ready(asset.name, callback); + return; + } + + if (asset.state === PRELOADING) { + asset.onpreload.push(function () { + load(asset, callback); + }); + return; + } + + asset.state = LOADING; + + loadAsset(asset, function () { + asset.state = LOADED; + callback(); + + // handlers for this asset + each(handlers[asset.name], function (fn) { + one(fn); + }); + + // dom is ready & no assets are queued for loading + // INFO: shouldn't we be doing the same test above ? + if (isDomReady && allLoaded()) { + each(handlers.ALL, function (fn) { + one(fn); + }); + } + }); + } + + /* Parts inspired from: https://github.com/cujojs/curl + ******************************************************/ + function loadAsset(asset, callback) { + callback = callback || noop; + + var ele; + if (/\.css[^\.]*$/.test(asset.url)) { + ele = doc.createElement('link'); + ele.type = 'text/' + (asset.type || 'css'); + ele.rel = 'stylesheet'; + ele.href = asset.url; + } + else { + ele = doc.createElement('script'); + ele.type = 'text/' + (asset.type || 'javascript'); + ele.src = asset.url; + } + + ele.onload = ele.onreadystatechange = process; + ele.onerror = error; + + /* Good read, but doesn't give much hope ! + * http://blog.getify.com/on-script-loaders/ + * http://www.nczonline.net/blog/2010/12/21/thoughts-on-script-loaders/ + * https://hacks.mozilla.org/2009/06/defer/ + */ + + // ASYNC: load in parellel and execute as soon as possible + ele.async = false; + // DEFER: load in parallel but maintain execution order + ele.defer = false; + + function error(event) { + event = event || win.event; + + // need some more detailed error handling here + + // release event listeners + ele.onload = ele.onreadystatechange = ele.onerror = null; + + // do callback + callback(); + } + + function process(event) { + event = event || win.event; + + // IE 7/8 (2 events on 1st load) + // 1) event.type = readystatechange, s.readyState = loading + // 2) event.type = readystatechange, s.readyState = loaded + + // IE 7/8 (1 event on reload) + // 1) event.type = readystatechange, s.readyState = complete + + // event.type === 'readystatechange' && /loaded|complete/.test(s.readyState) + + // IE 9 (3 events on 1st load) + // 1) event.type = readystatechange, s.readyState = loading + // 2) event.type = readystatechange, s.readyState = loaded + // 3) event.type = load , s.readyState = loaded + + // IE 9 (2 events on reload) + // 1) event.type = readystatechange, s.readyState = complete + // 2) event.type = load , s.readyState = complete + + // event.type === 'load' && /loaded|complete/.test(s.readyState) + // event.type === 'readystatechange' && /loaded|complete/.test(s.readyState) + + // IE 10 (3 events on 1st load) + // 1) event.type = readystatechange, s.readyState = loading + // 2) event.type = load , s.readyState = complete + // 3) event.type = readystatechange, s.readyState = loaded + + // IE 10 (3 events on reload) + // 1) event.type = readystatechange, s.readyState = loaded + // 2) event.type = load , s.readyState = complete + // 3) event.type = readystatechange, s.readyState = complete + + // event.type === 'load' && /loaded|complete/.test(s.readyState) + // event.type === 'readystatechange' && /complete/.test(s.readyState) + + // Other Browsers (1 event on 1st load) + // 1) event.type = load, s.readyState = undefined + + // Other Browsers (1 event on reload) + // 1) event.type = load, s.readyState = undefined + + // event.type == 'load' && s.readyState = undefined + + + // !doc.documentMode is for IE6/7, IE8+ have documentMode + if (event.type === 'load' || (/loaded|complete/.test(ele.readyState) && (!doc.documentMode || doc.documentMode < 9))) { + // release event listeners + ele.onload = ele.onreadystatechange = ele.onerror = null; + + // do callback + callback(); + } + + // emulates error on browsers that don't create an exception + // INFO: timeout not clearing ..why ? + //asset.timeout = win.setTimeout(function () { + // error({ type: "timeout" }); + //}, 3000); + } + + // use insertBefore to keep IE from throwing Operation Aborted (thx Bryan Forbes!) + var head = doc['head'] || doc.getElementsByTagName('head')[0]; + // but insert at end of head, because otherwise if it is a stylesheet, it will not ovverride values + head.insertBefore(ele, head.lastChild); + } + + /* Mix of stuff from jQuery & IEContentLoaded + * http://dev.w3.org/html5/spec/the-end.html#the-end + ***************************************************/ + function domReady() { + // Make sure body exists, at least, in case IE gets a little overzealous (jQuery ticket #5443). + if (!doc.body) { + // let's not get nasty by setting a timeout too small.. (loop mania guaranteed if assets are queued) + win.clearTimeout(api.readyTimeout); + api.readyTimeout = win.setTimeout(domReady, 50); + return; + } + + if (!isDomReady) { + isDomReady = true; + each(domWaiters, function (fn) { + one(fn); + }); + } + } + + function domContentLoaded() { + // W3C + if (doc.addEventListener) { + doc.removeEventListener("DOMContentLoaded", domContentLoaded, false); + domReady(); + } + + // IE + else if (doc.readyState === "complete") { + // we're here because readyState === "complete" in oldIE + // which is good enough for us to call the dom ready! + doc.detachEvent("onreadystatechange", domContentLoaded); + domReady(); + } + }; + + // Catch cases where ready() is called after the browser event has already occurred. + // we once tried to use readyState "interactive" here, but it caused issues like the one + // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 + if (doc.readyState === "complete") { + domReady(); + } + + // W3C + else if (doc.addEventListener) { + doc.addEventListener("DOMContentLoaded", domContentLoaded, false); + + // A fallback to window.onload, that will always work + win.addEventListener("load", domReady, false); + } + + // IE + else { + // Ensure firing before onload, maybe late but safe also for iframes + doc.attachEvent("onreadystatechange", domContentLoaded); + + // A fallback to window.onload, that will always work + win.attachEvent("onload", domReady); + + // If IE and not a frame + // continually check to see if the document is ready + var top = false; + + try { + top = win.frameElement == null && doc.documentElement; + } catch (e) { } + + if (top && top.doScroll) { + (function doScrollCheck() { + if (!isDomReady) { + try { + // Use the trick by Diego Perini + // http://javascript.nwbox.com/IEContentLoaded/ + top.doScroll("left"); + } catch (error) { + // let's not get nasty by setting a timeout too small.. (loop mania guaranteed if assets are queued) + win.clearTimeout(api.readyTimeout); + api.readyTimeout = win.setTimeout(doScrollCheck, 50); + return; + } + + // and execute any waiting functions + domReady(); + } + })(); + } + } + + /* + We wait for 300 ms before asset loading starts. for some reason this is needed + to make sure assets are cached. Not sure why this happens yet. A case study: + + https://github.com/headjs/headjs/issues/closed#issue/83 + */ + setTimeout(function () { + isHeadReady = true; + each(queue, function (fn) { + fn(); + }); + + }, 300); + +})(window); + + +/* + * Following lines are not part of the original head.js, but added for convenience. + */ + +// An additonal alias +birt = {loader: head}; diff --git a/WebContent/webcontent/birt/ajax/lib/prototype.js b/WebContent/webcontent/birt/ajax/lib/prototype.js new file mode 100644 index 0000000..474b223 --- /dev/null +++ b/WebContent/webcontent/birt/ajax/lib/prototype.js @@ -0,0 +1,6082 @@ +/* Prototype JavaScript framework, version 1.7 + * (c) 2005-2010 Sam Stephenson + * + * Prototype is freely distributable under the terms of an MIT-style license. + * For details, see the Prototype web site: http://www.prototypejs.org/ + * + *--------------------------------------------------------------------------*/ + +var Prototype = { + + Version: '1.7', + + Browser: (function(){ + var ua = navigator.userAgent; + var isOpera = Object.prototype.toString.call(window.opera) == '[object Opera]'; + return { + IE: !!window.attachEvent && !isOpera, + Opera: isOpera, + WebKit: ua.indexOf('AppleWebKit/') > -1, + Gecko: ua.indexOf('Gecko') > -1 && ua.indexOf('KHTML') === -1, + MobileSafari: /Apple.*Mobile/.test(ua) + } + })(), + + BrowserFeatures: { + XPath: !!document.evaluate, + + SelectorsAPI: !!document.querySelector, + + ElementExtensions: (function() { + var constructor = window.Element || window.HTMLElement; + return !!(constructor && constructor.prototype); + })(), + SpecificElementExtensions: (function() { + if (typeof window.HTMLDivElement !== 'undefined') + return true; + + var div = document.createElement('div'), + form = document.createElement('form'), + isSupported = false; + + if (div['__proto__'] && (div['__proto__'] !== form['__proto__'])) { + isSupported = true; + } + + div = form = null; + + return isSupported; + })() + }, + + ScriptFragment: ']*>([\\S\\s]*?)<\/script>', + JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/, + + emptyFunction: function() { }, + + K: function(x) { return x } +}; + +if (Prototype.Browser.MobileSafari) + Prototype.BrowserFeatures.SpecificElementExtensions = false; + + +var Abstract = { }; + + +var Try = { + these: function() { + var returnValue; + + for (var i = 0, length = arguments.length; i < length; i++) { + var lambda = arguments[i]; + try { + returnValue = lambda(); + break; + } catch (e) { } + } + + return returnValue; + } +}; + +/* Based on Alex Arnell's inheritance implementation. */ + +var Class = (function() { + + var IS_DONTENUM_BUGGY = (function(){ + for (var p in { toString: 1 }) { + if (p === 'toString') return false; + } + return true; + })(); + + function subclass() {}; + function create() { + var parent = null, properties = $A(arguments); + if (Object.isFunction(properties[0])) + parent = properties.shift(); + + function klass() { + this.initialize.apply(this, arguments); + } + + Object.extend(klass, Class.Methods); + klass.superclass = parent; + klass.subclasses = []; + + if (parent) { + subclass.prototype = parent.prototype; + klass.prototype = new subclass; + parent.subclasses.push(klass); + } + + for (var i = 0, length = properties.length; i < length; i++) + klass.addMethods(properties[i]); + + if (!klass.prototype.initialize) + klass.prototype.initialize = Prototype.emptyFunction; + + klass.prototype.constructor = klass; + return klass; + } + + function addMethods(source) { + var ancestor = this.superclass && this.superclass.prototype, + properties = Object.keys(source); + + if (IS_DONTENUM_BUGGY) { + if (source.toString != Object.prototype.toString) + properties.push("toString"); + if (source.valueOf != Object.prototype.valueOf) + properties.push("valueOf"); + } + + for (var i = 0, length = properties.length; i < length; i++) { + var property = properties[i], value = source[property]; + if (ancestor && Object.isFunction(value) && + value.argumentNames()[0] == "$super") { + var method = value; + value = (function(m) { + return function() { return ancestor[m].apply(this, arguments); }; + })(property).wrap(method); + + value.valueOf = method.valueOf.bind(method); + value.toString = method.toString.bind(method); + } + this.prototype[property] = value; + } + + return this; + } + + return { + create: create, + Methods: { + addMethods: addMethods + } + }; +})(); +(function() { + + var _toString = Object.prototype.toString, + NULL_TYPE = 'Null', + UNDEFINED_TYPE = 'Undefined', + BOOLEAN_TYPE = 'Boolean', + NUMBER_TYPE = 'Number', + STRING_TYPE = 'String', + OBJECT_TYPE = 'Object', + FUNCTION_CLASS = '[object Function]', + BOOLEAN_CLASS = '[object Boolean]', + NUMBER_CLASS = '[object Number]', + STRING_CLASS = '[object String]', + ARRAY_CLASS = '[object Array]', + DATE_CLASS = '[object Date]', + NATIVE_JSON_STRINGIFY_SUPPORT = window.JSON && + typeof JSON.stringify === 'function' && + JSON.stringify(0) === '0' && + typeof JSON.stringify(Prototype.K) === 'undefined'; + + function Type(o) { + switch(o) { + case null: return NULL_TYPE; + case (void 0): return UNDEFINED_TYPE; + } + var type = typeof o; + switch(type) { + case 'boolean': return BOOLEAN_TYPE; + case 'number': return NUMBER_TYPE; + case 'string': return STRING_TYPE; + } + return OBJECT_TYPE; + } + + function extend(destination, source) { + for (var property in source) + destination[property] = source[property]; + return destination; + } + + function inspect(object) { + try { + if (isUndefined(object)) return 'undefined'; + if (object === null) return 'null'; + return object.inspect ? object.inspect() : String(object); + } catch (e) { + if (e instanceof RangeError) return '...'; + throw e; + } + } + + function toJSON(value) { + return Str('', { '': value }, []); + } + + function Str(key, holder, stack) { + var value = holder[key], + type = typeof value; + + if (Type(value) === OBJECT_TYPE && typeof value.toJSON === 'function') { + value = value.toJSON(key); + } + + var _class = _toString.call(value); + + switch (_class) { + case NUMBER_CLASS: + case BOOLEAN_CLASS: + case STRING_CLASS: + value = value.valueOf(); + } + + switch (value) { + case null: return 'null'; + case true: return 'true'; + case false: return 'false'; + } + + type = typeof value; + switch (type) { + case 'string': + return value.inspect(true); + case 'number': + return isFinite(value) ? String(value) : 'null'; + case 'object': + + for (var i = 0, length = stack.length; i < length; i++) { + if (stack[i] === value) { throw new TypeError(); } + } + stack.push(value); + + var partial = []; + if (_class === ARRAY_CLASS) { + for (var i = 0, length = value.length; i < length; i++) { + var str = Str(i, value, stack); + partial.push(typeof str === 'undefined' ? 'null' : str); + } + partial = '[' + partial.join(',') + ']'; + } else { + var keys = Object.keys(value); + for (var i = 0, length = keys.length; i < length; i++) { + var key = keys[i], str = Str(key, value, stack); + if (typeof str !== "undefined") { + partial.push(key.inspect(true)+ ':' + str); + } + } + partial = '{' + partial.join(',') + '}'; + } + stack.pop(); + return partial; + } + } + + function stringify(object) { + return JSON.stringify(object); + } + + function toQueryString(object) { + return $H(object).toQueryString(); + } + + function toHTML(object) { + return object && object.toHTML ? object.toHTML() : String.interpret(object); + } + + function keys(object) { + if (Type(object) !== OBJECT_TYPE) { throw new TypeError(); } + var results = []; + for (var property in object) { + if (object.hasOwnProperty(property)) { + results.push(property); + } + } + return results; + } + + function values(object) { + var results = []; + for (var property in object) + results.push(object[property]); + return results; + } + + function clone(object) { + return extend({ }, object); + } + + function isElement(object) { + return !!(object && object.nodeType == 1); + } + + function isArray(object) { + return _toString.call(object) === ARRAY_CLASS; + } + + var hasNativeIsArray = (typeof Array.isArray == 'function') + && Array.isArray([]) && !Array.isArray({}); + + if (hasNativeIsArray) { + isArray = Array.isArray; + } + + function isHash(object) { + return object instanceof Hash; + } + + function isFunction(object) { + return _toString.call(object) === FUNCTION_CLASS; + } + + function isString(object) { + return _toString.call(object) === STRING_CLASS; + } + + function isNumber(object) { + return _toString.call(object) === NUMBER_CLASS; + } + + function isDate(object) { + return _toString.call(object) === DATE_CLASS; + } + + function isUndefined(object) { + return typeof object === "undefined"; + } + + extend(Object, { + extend: extend, + inspect: inspect, + toJSON: NATIVE_JSON_STRINGIFY_SUPPORT ? stringify : toJSON, + toQueryString: toQueryString, + toHTML: toHTML, + keys: Object.keys || keys, + values: values, + clone: clone, + isElement: isElement, + isArray: isArray, + isHash: isHash, + isFunction: isFunction, + isString: isString, + isNumber: isNumber, + isDate: isDate, + isUndefined: isUndefined + }); +})(); +Object.extend(Function.prototype, (function() { + var slice = Array.prototype.slice; + + function update(array, args) { + var arrayLength = array.length, length = args.length; + while (length--) array[arrayLength + length] = args[length]; + return array; + } + + function merge(array, args) { + array = slice.call(array, 0); + return update(array, args); + } + + function argumentNames() { + var names = this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1] + .replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g, '') + .replace(/\s+/g, '').split(','); + return names.length == 1 && !names[0] ? [] : names; + } + + function bind(context) { + if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this; + var __method = this, args = slice.call(arguments, 1); + return function() { + var a = merge(args, arguments); + return __method.apply(context, a); + } + } + + function bindAsEventListener(context) { + var __method = this, args = slice.call(arguments, 1); + return function(event) { + var a = update([event || window.event], args); + return __method.apply(context, a); + } + } + + function curry() { + if (!arguments.length) return this; + var __method = this, args = slice.call(arguments, 0); + return function() { + var a = merge(args, arguments); + return __method.apply(this, a); + } + } + + function delay(timeout) { + var __method = this, args = slice.call(arguments, 1); + timeout = timeout * 1000; + return window.setTimeout(function() { + return __method.apply(__method, args); + }, timeout); + } + + function defer() { + var args = update([0.01], arguments); + return this.delay.apply(this, args); + } + + function wrap(wrapper) { + var __method = this; + return function() { + var a = update([__method.bind(this)], arguments); + return wrapper.apply(this, a); + } + } + + function methodize() { + if (this._methodized) return this._methodized; + var __method = this; + return this._methodized = function() { + var a = update([this], arguments); + return __method.apply(null, a); + }; + } + + return { + argumentNames: argumentNames, + bind: bind, + bindAsEventListener: bindAsEventListener, + curry: curry, + delay: delay, + defer: defer, + wrap: wrap, + methodize: methodize + } +})()); + + + +(function(proto) { + + + function toISOString() { + return this.getUTCFullYear() + '-' + + (this.getUTCMonth() + 1).toPaddedString(2) + '-' + + this.getUTCDate().toPaddedString(2) + 'T' + + this.getUTCHours().toPaddedString(2) + ':' + + this.getUTCMinutes().toPaddedString(2) + ':' + + this.getUTCSeconds().toPaddedString(2) + 'Z'; + } + + + function toJSON() { + return this.toISOString(); + } + + if (!proto.toISOString) proto.toISOString = toISOString; + if (!proto.toJSON) proto.toJSON = toJSON; + +})(Date.prototype); + + +RegExp.prototype.match = RegExp.prototype.test; + +RegExp.escape = function(str) { + return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1'); +}; +var PeriodicalExecuter = Class.create({ + initialize: function(callback, frequency) { + this.callback = callback; + this.frequency = frequency; + this.currentlyExecuting = false; + + this.registerCallback(); + }, + + registerCallback: function() { + this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); + }, + + execute: function() { + this.callback(this); + }, + + stop: function() { + if (!this.timer) return; + clearInterval(this.timer); + this.timer = null; + }, + + onTimerEvent: function() { + if (!this.currentlyExecuting) { + try { + this.currentlyExecuting = true; + this.execute(); + this.currentlyExecuting = false; + } catch(e) { + this.currentlyExecuting = false; + throw e; + } + } + } +}); +Object.extend(String, { + interpret: function(value) { + return value == null ? '' : String(value); + }, + specialChar: { + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '\\': '\\\\' + } +}); + +Object.extend(String.prototype, (function() { + var NATIVE_JSON_PARSE_SUPPORT = window.JSON && + typeof JSON.parse === 'function' && + JSON.parse('{"test": true}').test; + + function prepareReplacement(replacement) { + if (Object.isFunction(replacement)) return replacement; + var template = new Template(replacement); + return function(match) { return template.evaluate(match) }; + } + + function gsub(pattern, replacement) { + var result = '', source = this, match; + replacement = prepareReplacement(replacement); + + if (Object.isString(pattern)) + pattern = RegExp.escape(pattern); + + if (!(pattern.length || pattern.source)) { + replacement = replacement(''); + return replacement + source.split('').join(replacement) + replacement; + } + + while (source.length > 0) { + if (match = source.match(pattern)) { + result += source.slice(0, match.index); + result += String.interpret(replacement(match)); + source = source.slice(match.index + match[0].length); + } else { + result += source, source = ''; + } + } + return result; + } + + function sub(pattern, replacement, count) { + replacement = prepareReplacement(replacement); + count = Object.isUndefined(count) ? 1 : count; + + return this.gsub(pattern, function(match) { + if (--count < 0) return match[0]; + return replacement(match); + }); + } + + function scan(pattern, iterator) { + this.gsub(pattern, iterator); + return String(this); + } + + function truncate(length, truncation) { + length = length || 30; + truncation = Object.isUndefined(truncation) ? '...' : truncation; + return this.length > length ? + this.slice(0, length - truncation.length) + truncation : String(this); + } + + function strip() { + return this.replace(/^\s+/, '').replace(/\s+$/, ''); + } + + function stripTags() { + return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi, ''); + } + + function stripScripts() { + return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), ''); + } + + function extractScripts() { + var matchAll = new RegExp(Prototype.ScriptFragment, 'img'), + matchOne = new RegExp(Prototype.ScriptFragment, 'im'); + return (this.match(matchAll) || []).map(function(scriptTag) { + return (scriptTag.match(matchOne) || ['', ''])[1]; + }); + } + + function evalScripts() { + return this.extractScripts().map(function(script) { return eval(script) }); + } + + function escapeHTML() { + return this.replace(/&/g,'&').replace(//g,'>'); + } + + function unescapeHTML() { + return this.stripTags().replace(/</g,'<').replace(/>/g,'>').replace(/&/g,'&'); + } + + + function toQueryParams(separator) { + var match = this.strip().match(/([^?#]*)(#.*)?$/); + if (!match) return { }; + + return match[1].split(separator || '&').inject({ }, function(hash, pair) { + if ((pair = pair.split('='))[0]) { + var key = decodeURIComponent(pair.shift()), + value = pair.length > 1 ? pair.join('=') : pair[0]; + + if (value != undefined) value = decodeURIComponent(value); + + if (key in hash) { + if (!Object.isArray(hash[key])) hash[key] = [hash[key]]; + hash[key].push(value); + } + else hash[key] = value; + } + return hash; + }); + } + + function toArray() { + return this.split(''); + } + + function succ() { + return this.slice(0, this.length - 1) + + String.fromCharCode(this.charCodeAt(this.length - 1) + 1); + } + + function times(count) { + return count < 1 ? '' : new Array(count + 1).join(this); + } + + function camelize() { + return this.replace(/-+(.)?/g, function(match, chr) { + return chr ? chr.toUpperCase() : ''; + }); + } + + function capitalize() { + return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase(); + } + + function underscore() { + return this.replace(/::/g, '/') + .replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2') + .replace(/([a-z\d])([A-Z])/g, '$1_$2') + .replace(/-/g, '_') + .toLowerCase(); + } + + function dasherize() { + return this.replace(/_/g, '-'); + } + + function inspect(useDoubleQuotes) { + var escapedString = this.replace(/[\x00-\x1f\\]/g, function(character) { + if (character in String.specialChar) { + return String.specialChar[character]; + } + return '\\u00' + character.charCodeAt().toPaddedString(2, 16); + }); + if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"'; + return "'" + escapedString.replace(/'/g, '\\\'') + "'"; + } + + function unfilterJSON(filter) { + return this.replace(filter || Prototype.JSONFilter, '$1'); + } + + function isJSON() { + var str = this; + if (str.blank()) return false; + str = str.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@'); + str = str.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']'); + str = str.replace(/(?:^|:|,)(?:\s*\[)+/g, ''); + return (/^[\],:{}\s]*$/).test(str); + } + + function evalJSON(sanitize) { + var json = this.unfilterJSON(), + cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; + if (cx.test(json)) { + json = json.replace(cx, function (a) { + return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); + }); + } + try { + if (!sanitize || json.isJSON()) return eval('(' + json + ')'); + } catch (e) { } + throw new SyntaxError('Badly formed JSON string: ' + this.inspect()); + } + + function parseJSON() { + var json = this.unfilterJSON(); + return JSON.parse(json); + } + + function include(pattern) { + return this.indexOf(pattern) > -1; + } + + function startsWith(pattern) { + return this.lastIndexOf(pattern, 0) === 0; + } + + function endsWith(pattern) { + var d = this.length - pattern.length; + return d >= 0 && this.indexOf(pattern, d) === d; + } + + function empty() { + return this == ''; + } + + function blank() { + return /^\s*$/.test(this); + } + + function interpolate(object, pattern) { + return new Template(this, pattern).evaluate(object); + } + + return { + gsub: gsub, + sub: sub, + scan: scan, + truncate: truncate, + strip: String.prototype.trim || strip, + stripTags: stripTags, + stripScripts: stripScripts, + extractScripts: extractScripts, + evalScripts: evalScripts, + escapeHTML: escapeHTML, + unescapeHTML: unescapeHTML, + toQueryParams: toQueryParams, + parseQuery: toQueryParams, + toArray: toArray, + succ: succ, + times: times, + camelize: camelize, + capitalize: capitalize, + underscore: underscore, + dasherize: dasherize, + inspect: inspect, + unfilterJSON: unfilterJSON, + isJSON: isJSON, + evalJSON: NATIVE_JSON_PARSE_SUPPORT ? parseJSON : evalJSON, + include: include, + startsWith: startsWith, + endsWith: endsWith, + empty: empty, + blank: blank, + interpolate: interpolate + }; +})()); + +var Template = Class.create({ + initialize: function(template, pattern) { + this.template = template.toString(); + this.pattern = pattern || Template.Pattern; + }, + + evaluate: function(object) { + if (object && Object.isFunction(object.toTemplateReplacements)) + object = object.toTemplateReplacements(); + + return this.template.gsub(this.pattern, function(match) { + if (object == null) return (match[1] + ''); + + var before = match[1] || ''; + if (before == '\\') return match[2]; + + var ctx = object, expr = match[3], + pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/; + + match = pattern.exec(expr); + if (match == null) return before; + + while (match != null) { + var comp = match[1].startsWith('[') ? match[2].replace(/\\\\]/g, ']') : match[1]; + ctx = ctx[comp]; + if (null == ctx || '' == match[3]) break; + expr = expr.substring('[' == match[3] ? match[1].length : match[0].length); + match = pattern.exec(expr); + } + + return before + String.interpret(ctx); + }); + } +}); +Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/; + +var $break = { }; + +var Enumerable = (function() { + function each(iterator, context) { + var index = 0; + try { + this._each(function(value) { + iterator.call(context, value, index++); + }); + } catch (e) { + if (e != $break) throw e; + } + return this; + } + + function eachSlice(number, iterator, context) { + var index = -number, slices = [], array = this.toArray(); + if (number < 1) return array; + while ((index += number) < array.length) + slices.push(array.slice(index, index+number)); + return slices.collect(iterator, context); + } + + function all(iterator, context) { + iterator = iterator || Prototype.K; + var result = true; + this.each(function(value, index) { + result = result && !!iterator.call(context, value, index); + if (!result) throw $break; + }); + return result; + } + + function any(iterator, context) { + iterator = iterator || Prototype.K; + var result = false; + this.each(function(value, index) { + if (result = !!iterator.call(context, value, index)) + throw $break; + }); + return result; + } + + function collect(iterator, context) { + iterator = iterator || Prototype.K; + var results = []; + this.each(function(value, index) { + results.push(iterator.call(context, value, index)); + }); + return results; + } + + function detect(iterator, context) { + var result; + this.each(function(value, index) { + if (iterator.call(context, value, index)) { + result = value; + throw $break; + } + }); + return result; + } + + function findAll(iterator, context) { + var results = []; + this.each(function(value, index) { + if (iterator.call(context, value, index)) + results.push(value); + }); + return results; + } + + function grep(filter, iterator, context) { + iterator = iterator || Prototype.K; + var results = []; + + if (Object.isString(filter)) + filter = new RegExp(RegExp.escape(filter)); + + this.each(function(value, index) { + if (filter.match(value)) + results.push(iterator.call(context, value, index)); + }); + return results; + } + + function include(object) { + if (Object.isFunction(this.indexOf)) + if (this.indexOf(object) != -1) return true; + + var found = false; + this.each(function(value) { + if (value == object) { + found = true; + throw $break; + } + }); + return found; + } + + function inGroupsOf(number, fillWith) { + fillWith = Object.isUndefined(fillWith) ? null : fillWith; + return this.eachSlice(number, function(slice) { + while(slice.length < number) slice.push(fillWith); + return slice; + }); + } + + function inject(memo, iterator, context) { + this.each(function(value, index) { + memo = iterator.call(context, memo, value, index); + }); + return memo; + } + + function invoke(method) { + var args = $A(arguments).slice(1); + return this.map(function(value) { + return value[method].apply(value, args); + }); + } + + function max(iterator, context) { + iterator = iterator || Prototype.K; + var result; + this.each(function(value, index) { + value = iterator.call(context, value, index); + if (result == null || value >= result) + result = value; + }); + return result; + } + + function min(iterator, context) { + iterator = iterator || Prototype.K; + var result; + this.each(function(value, index) { + value = iterator.call(context, value, index); + if (result == null || value < result) + result = value; + }); + return result; + } + + function partition(iterator, context) { + iterator = iterator || Prototype.K; + var trues = [], falses = []; + this.each(function(value, index) { + (iterator.call(context, value, index) ? + trues : falses).push(value); + }); + return [trues, falses]; + } + + function pluck(property) { + var results = []; + this.each(function(value) { + results.push(value[property]); + }); + return results; + } + + function reject(iterator, context) { + var results = []; + this.each(function(value, index) { + if (!iterator.call(context, value, index)) + results.push(value); + }); + return results; + } + + function sortBy(iterator, context) { + return this.map(function(value, index) { + return { + value: value, + criteria: iterator.call(context, value, index) + }; + }).sort(function(left, right) { + var a = left.criteria, b = right.criteria; + return a < b ? -1 : a > b ? 1 : 0; + }).pluck('value'); + } + + function toArray() { + return this.map(); + } + + function zip() { + var iterator = Prototype.K, args = $A(arguments); + if (Object.isFunction(args.last())) + iterator = args.pop(); + + var collections = [this].concat(args).map($A); + return this.map(function(value, index) { + return iterator(collections.pluck(index)); + }); + } + + function size() { + return this.toArray().length; + } + + function inspect() { + return '#'; + } + + + + + + + + + + return { + each: each, + eachSlice: eachSlice, + all: all, + every: all, + any: any, + some: any, + collect: collect, + map: collect, + detect: detect, + findAll: findAll, + select: findAll, + filter: findAll, + grep: grep, + include: include, + member: include, + inGroupsOf: inGroupsOf, + inject: inject, + invoke: invoke, + max: max, + min: min, + partition: partition, + pluck: pluck, + reject: reject, + sortBy: sortBy, + toArray: toArray, + entries: toArray, + zip: zip, + size: size, + inspect: inspect, + find: detect + }; +})(); + +function $A(iterable) { + if (!iterable) return []; + if ('toArray' in Object(iterable)) return iterable.toArray(); + var length = iterable.length || 0, results = new Array(length); + while (length--) results[length] = iterable[length]; + return results; +} + + +function $w(string) { + if (!Object.isString(string)) return []; + string = string.strip(); + return string ? string.split(/\s+/) : []; +} + +Array.from = $A; + + +(function() { + var arrayProto = Array.prototype, + slice = arrayProto.slice, + _each = arrayProto.forEach; // use native browser JS 1.6 implementation if available + + function each(iterator, context) { + for (var i = 0, length = this.length >>> 0; i < length; i++) { + if (i in this) iterator.call(context, this[i], i, this); + } + } + if (!_each) _each = each; + + function clear() { + this.length = 0; + return this; + } + + function first() { + return this[0]; + } + + function last() { + return this[this.length - 1]; + } + + function compact() { + return this.select(function(value) { + return value != null; + }); + } + + function flatten() { + return this.inject([], function(array, value) { + if (Object.isArray(value)) + return array.concat(value.flatten()); + array.push(value); + return array; + }); + } + + function without() { + var values = slice.call(arguments, 0); + return this.select(function(value) { + return !values.include(value); + }); + } + + function reverse(inline) { + return (inline === false ? this.toArray() : this)._reverse(); + } + + function uniq(sorted) { + return this.inject([], function(array, value, index) { + if (0 == index || (sorted ? array.last() != value : !array.include(value))) + array.push(value); + return array; + }); + } + + function intersect(array) { + return this.uniq().findAll(function(item) { + return array.detect(function(value) { return item === value }); + }); + } + + + function clone() { + return slice.call(this, 0); + } + + function size() { + return this.length; + } + + function inspect() { + return '[' + this.map(Object.inspect).join(', ') + ']'; + } + + function indexOf(item, i) { + i || (i = 0); + var length = this.length; + if (i < 0) i = length + i; + for (; i < length; i++) + if (this[i] === item) return i; + return -1; + } + + function lastIndexOf(item, i) { + i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1; + var n = this.slice(0, i).reverse().indexOf(item); + return (n < 0) ? n : i - n - 1; + } + + function concat() { + var array = slice.call(this, 0), item; + for (var i = 0, length = arguments.length; i < length; i++) { + item = arguments[i]; + if (Object.isArray(item) && !('callee' in item)) { + for (var j = 0, arrayLength = item.length; j < arrayLength; j++) + array.push(item[j]); + } else { + array.push(item); + } + } + return array; + } + + Object.extend(arrayProto, Enumerable); + + if (!arrayProto._reverse) + arrayProto._reverse = arrayProto.reverse; + + Object.extend(arrayProto, { + _each: _each, + clear: clear, + first: first, + last: last, + compact: compact, + flatten: flatten, + without: without, + reverse: reverse, + uniq: uniq, + intersect: intersect, + clone: clone, + toArray: clone, + size: size, + inspect: inspect + }); + + var CONCAT_ARGUMENTS_BUGGY = (function() { + return [].concat(arguments)[0][0] !== 1; + })(1,2) + + if (CONCAT_ARGUMENTS_BUGGY) arrayProto.concat = concat; + + if (!arrayProto.indexOf) arrayProto.indexOf = indexOf; + if (!arrayProto.lastIndexOf) arrayProto.lastIndexOf = lastIndexOf; +})(); +function $H(object) { + return new Hash(object); +}; + +var Hash = Class.create(Enumerable, (function() { + function initialize(object) { + this._object = Object.isHash(object) ? object.toObject() : Object.clone(object); + } + + + function _each(iterator) { + for (var key in this._object) { + var value = this._object[key], pair = [key, value]; + pair.key = key; + pair.value = value; + iterator(pair); + } + } + + function set(key, value) { + return this._object[key] = value; + } + + function get(key) { + if (this._object[key] !== Object.prototype[key]) + return this._object[key]; + } + + function unset(key) { + var value = this._object[key]; + delete this._object[key]; + return value; + } + + function toObject() { + return Object.clone(this._object); + } + + + + function keys() { + return this.pluck('key'); + } + + function values() { + return this.pluck('value'); + } + + function index(value) { + var match = this.detect(function(pair) { + return pair.value === value; + }); + return match && match.key; + } + + function merge(object) { + return this.clone().update(object); + } + + function update(object) { + return new Hash(object).inject(this, function(result, pair) { + result.set(pair.key, pair.value); + return result; + }); + } + + function toQueryPair(key, value) { + if (Object.isUndefined(value)) return key; + return key + '=' + encodeURIComponent(String.interpret(value)); + } + + function toQueryString() { + return this.inject([], function(results, pair) { + var key = encodeURIComponent(pair.key), values = pair.value; + + if (values && typeof values == 'object') { + if (Object.isArray(values)) { + var queryValues = []; + for (var i = 0, len = values.length, value; i < len; i++) { + value = values[i]; + queryValues.push(toQueryPair(key, value)); + } + return results.concat(queryValues); + } + } else results.push(toQueryPair(key, values)); + return results; + }).join('&'); + } + + function inspect() { + return '#'; + } + + function clone() { + return new Hash(this); + } + + return { + initialize: initialize, + _each: _each, + set: set, + get: get, + unset: unset, + toObject: toObject, + toTemplateReplacements: toObject, + keys: keys, + values: values, + index: index, + merge: merge, + update: update, + toQueryString: toQueryString, + inspect: inspect, + toJSON: toObject, + clone: clone + }; +})()); + +Hash.from = $H; +Object.extend(Number.prototype, (function() { + function toColorPart() { + return this.toPaddedString(2, 16); + } + + function succ() { + return this + 1; + } + + function times(iterator, context) { + $R(0, this, true).each(iterator, context); + return this; + } + + function toPaddedString(length, radix) { + var string = this.toString(radix || 10); + return '0'.times(length - string.length) + string; + } + + function abs() { + return Math.abs(this); + } + + function round() { + return Math.round(this); + } + + function ceil() { + return Math.ceil(this); + } + + function floor() { + return Math.floor(this); + } + + return { + toColorPart: toColorPart, + succ: succ, + times: times, + toPaddedString: toPaddedString, + abs: abs, + round: round, + ceil: ceil, + floor: floor + }; +})()); + +function $R(start, end, exclusive) { + return new ObjectRange(start, end, exclusive); +} + +var ObjectRange = Class.create(Enumerable, (function() { + function initialize(start, end, exclusive) { + this.start = start; + this.end = end; + this.exclusive = exclusive; + } + + function _each(iterator) { + var value = this.start; + while (this.include(value)) { + iterator(value); + value = value.succ(); + } + } + + function include(value) { + if (value < this.start) + return false; + if (this.exclusive) + return value < this.end; + return value <= this.end; + } + + return { + initialize: initialize, + _each: _each, + include: include + }; +})()); + + + +var Ajax = { + getTransport: function() { + return Try.these( + function() {return new XMLHttpRequest()}, + function() {return new ActiveXObject('Msxml2.XMLHTTP')}, + function() {return new ActiveXObject('Microsoft.XMLHTTP')} + ) || false; + }, + + activeRequestCount: 0 +}; + +Ajax.Responders = { + responders: [], + + _each: function(iterator) { + this.responders._each(iterator); + }, + + register: function(responder) { + if (!this.include(responder)) + this.responders.push(responder); + }, + + unregister: function(responder) { + this.responders = this.responders.without(responder); + }, + + dispatch: function(callback, request, transport, json) { + this.each(function(responder) { + if (Object.isFunction(responder[callback])) { + try { + responder[callback].apply(responder, [request, transport, json]); + } catch (e) { } + } + }); + } +}; + +Object.extend(Ajax.Responders, Enumerable); + +Ajax.Responders.register({ + onCreate: function() { Ajax.activeRequestCount++ }, + onComplete: function() { Ajax.activeRequestCount-- } +}); +Ajax.Base = Class.create({ + initialize: function(options) { + this.options = { + method: 'post', + asynchronous: true, + contentType: 'application/x-www-form-urlencoded', + encoding: 'UTF-8', + parameters: '', + evalJSON: true, + evalJS: true + }; + Object.extend(this.options, options || { }); + + this.options.method = this.options.method.toLowerCase(); + + if (Object.isHash(this.options.parameters)) + this.options.parameters = this.options.parameters.toObject(); + } +}); +Ajax.Request = Class.create(Ajax.Base, { + _complete: false, + + initialize: function($super, url, options) { + $super(options); + this.transport = Ajax.getTransport(); + this.request(url); + }, + + request: function(url) { + this.url = url; + this.method = this.options.method; + var params = Object.isString(this.options.parameters) ? + this.options.parameters : + Object.toQueryString(this.options.parameters); + + if (!['get', 'post'].include(this.method)) { + params += (params ? '&' : '') + "_method=" + this.method; + this.method = 'post'; + } + + if (params && this.method === 'get') { + this.url += (this.url.include('?') ? '&' : '?') + params; + } + + this.parameters = params.toQueryParams(); + + try { + var response = new Ajax.Response(this); + if (this.options.onCreate) this.options.onCreate(response); + Ajax.Responders.dispatch('onCreate', this, response); + + this.transport.open(this.method.toUpperCase(), this.url, + this.options.asynchronous); + + if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1); + + this.transport.onreadystatechange = this.onStateChange.bind(this); + this.setRequestHeaders(); + + this.body = this.method == 'post' ? (this.options.postBody || params) : null; + this.transport.send(this.body); + + /* Force Firefox to handle ready state 4 for synchronous requests */ + if (!this.options.asynchronous && this.transport.overrideMimeType) + this.onStateChange(); + + } + catch (e) { + this.dispatchException(e); + } + }, + + onStateChange: function() { + var readyState = this.transport.readyState; + if (readyState > 1 && !((readyState == 4) && this._complete)) + this.respondToReadyState(this.transport.readyState); + }, + + setRequestHeaders: function() { + var headers = { + 'X-Requested-With': 'XMLHttpRequest', + 'X-Prototype-Version': Prototype.Version, + 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*' + }; + + if (this.method == 'post') { + headers['Content-type'] = this.options.contentType + + (this.options.encoding ? '; charset=' + this.options.encoding : ''); + + /* Force "Connection: close" for older Mozilla browsers to work + * around a bug where XMLHttpRequest sends an incorrect + * Content-length header. See Mozilla Bugzilla #246651. + */ + if (this.transport.overrideMimeType && + (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005) + headers['Connection'] = 'close'; + } + + if (typeof this.options.requestHeaders == 'object') { + var extras = this.options.requestHeaders; + + if (Object.isFunction(extras.push)) + for (var i = 0, length = extras.length; i < length; i += 2) + headers[extras[i]] = extras[i+1]; + else + $H(extras).each(function(pair) { headers[pair.key] = pair.value }); + } + + for (var name in headers) + this.transport.setRequestHeader(name, headers[name]); + }, + + success: function() { + var status = this.getStatus(); + return !status || (status >= 200 && status < 300) || status == 304; + }, + + getStatus: function() { + try { + if (this.transport.status === 1223) return 204; + return this.transport.status || 0; + } catch (e) { return 0 } + }, + + respondToReadyState: function(readyState) { + var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this); + + if (state == 'Complete') { + try { + this._complete = true; + (this.options['on' + response.status] + || this.options['on' + (this.success() ? 'Success' : 'Failure')] + || Prototype.emptyFunction)(response, response.headerJSON); + } catch (e) { + this.dispatchException(e); + } + + var contentType = response.getHeader('Content-type'); + if (this.options.evalJS == 'force' + || (this.options.evalJS && this.isSameOrigin() && contentType + && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))) + this.evalResponse(); + } + + try { + (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON); + Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON); + } catch (e) { + this.dispatchException(e); + } + + if (state == 'Complete') { + this.transport.onreadystatechange = Prototype.emptyFunction; + } + }, + + isSameOrigin: function() { + var m = this.url.match(/^\s*https?:\/\/[^\/]*/); + return !m || (m[0] == '#{protocol}//#{domain}#{port}'.interpolate({ + protocol: location.protocol, + domain: document.domain, + port: location.port ? ':' + location.port : '' + })); + }, + + getHeader: function(name) { + try { + return this.transport.getResponseHeader(name) || null; + } catch (e) { return null; } + }, + + evalResponse: function() { + try { + return eval((this.transport.responseText || '').unfilterJSON()); + } catch (e) { + this.dispatchException(e); + } + }, + + dispatchException: function(exception) { + (this.options.onException || Prototype.emptyFunction)(this, exception); + Ajax.Responders.dispatch('onException', this, exception); + } +}); + +Ajax.Request.Events = + ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete']; + + + + + + + + +Ajax.Response = Class.create({ + initialize: function(request){ + this.request = request; + var transport = this.transport = request.transport, + readyState = this.readyState = transport.readyState; + + if ((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) { + this.status = this.getStatus(); + this.statusText = this.getStatusText(); + this.responseText = String.interpret(transport.responseText); + this.headerJSON = this._getHeaderJSON(); + } + + if (readyState == 4) { + var xml = transport.responseXML; + this.responseXML = Object.isUndefined(xml) ? null : xml; + this.responseJSON = this._getResponseJSON(); + } + }, + + status: 0, + + statusText: '', + + getStatus: Ajax.Request.prototype.getStatus, + + getStatusText: function() { + try { + return this.transport.statusText || ''; + } catch (e) { return '' } + }, + + getHeader: Ajax.Request.prototype.getHeader, + + getAllHeaders: function() { + try { + return this.getAllResponseHeaders(); + } catch (e) { return null } + }, + + getResponseHeader: function(name) { + return this.transport.getResponseHeader(name); + }, + + getAllResponseHeaders: function() { + return this.transport.getAllResponseHeaders(); + }, + + _getHeaderJSON: function() { + var json = this.getHeader('X-JSON'); + if (!json) return null; + json = decodeURIComponent(escape(json)); + try { + return json.evalJSON(this.request.options.sanitizeJSON || + !this.request.isSameOrigin()); + } catch (e) { + this.request.dispatchException(e); + } + }, + + _getResponseJSON: function() { + var options = this.request.options; + if (!options.evalJSON || (options.evalJSON != 'force' && + !(this.getHeader('Content-type') || '').include('application/json')) || + this.responseText.blank()) + return null; + try { + return this.responseText.evalJSON(options.sanitizeJSON || + !this.request.isSameOrigin()); + } catch (e) { + this.request.dispatchException(e); + } + } +}); + +Ajax.Updater = Class.create(Ajax.Request, { + initialize: function($super, container, url, options) { + this.container = { + success: (container.success || container), + failure: (container.failure || (container.success ? null : container)) + }; + + options = Object.clone(options); + var onComplete = options.onComplete; + options.onComplete = (function(response, json) { + this.updateContent(response.responseText); + if (Object.isFunction(onComplete)) onComplete(response, json); + }).bind(this); + + $super(url, options); + }, + + updateContent: function(responseText) { + var receiver = this.container[this.success() ? 'success' : 'failure'], + options = this.options; + + if (!options.evalScripts) responseText = responseText.stripScripts(); + + if (receiver = $(receiver)) { + if (options.insertion) { + if (Object.isString(options.insertion)) { + var insertion = { }; insertion[options.insertion] = responseText; + receiver.insert(insertion); + } + else options.insertion(receiver, responseText); + } + else receiver.update(responseText); + } + } +}); + +Ajax.PeriodicalUpdater = Class.create(Ajax.Base, { + initialize: function($super, container, url, options) { + $super(options); + this.onComplete = this.options.onComplete; + + this.frequency = (this.options.frequency || 2); + this.decay = (this.options.decay || 1); + + this.updater = { }; + this.container = container; + this.url = url; + + this.start(); + }, + + start: function() { + this.options.onComplete = this.updateComplete.bind(this); + this.onTimerEvent(); + }, + + stop: function() { + this.updater.options.onComplete = undefined; + clearTimeout(this.timer); + (this.onComplete || Prototype.emptyFunction).apply(this, arguments); + }, + + updateComplete: function(response) { + if (this.options.decay) { + this.decay = (response.responseText == this.lastText ? + this.decay * this.options.decay : 1); + + this.lastText = response.responseText; + } + this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency); + }, + + onTimerEvent: function() { + this.updater = new Ajax.Updater(this.container, this.url, this.options); + } +}); + + +function $(element) { + if (arguments.length > 1) { + for (var i = 0, elements = [], length = arguments.length; i < length; i++) + elements.push($(arguments[i])); + return elements; + } + if (Object.isString(element)) + element = document.getElementById(element); + return Element.extend(element); +} + +if (Prototype.BrowserFeatures.XPath) { + document._getElementsByXPath = function(expression, parentElement) { + var results = []; + var query = document.evaluate(expression, $(parentElement) || document, + null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); + for (var i = 0, length = query.snapshotLength; i < length; i++) + results.push(Element.extend(query.snapshotItem(i))); + return results; + }; +} + +/*--------------------------------------------------------------------------*/ + +if (!Node) var Node = { }; + +if (!Node.ELEMENT_NODE) { + Object.extend(Node, { + ELEMENT_NODE: 1, + ATTRIBUTE_NODE: 2, + TEXT_NODE: 3, + CDATA_SECTION_NODE: 4, + ENTITY_REFERENCE_NODE: 5, + ENTITY_NODE: 6, + PROCESSING_INSTRUCTION_NODE: 7, + COMMENT_NODE: 8, + DOCUMENT_NODE: 9, + DOCUMENT_TYPE_NODE: 10, + DOCUMENT_FRAGMENT_NODE: 11, + NOTATION_NODE: 12 + }); +} + + + +(function(global) { + function shouldUseCache(tagName, attributes) { + if (tagName === 'select') return false; + if ('type' in attributes) return false; + return true; + } + + var HAS_EXTENDED_CREATE_ELEMENT_SYNTAX = (function(){ + try { + var el = document.createElement(''); + return el.tagName.toLowerCase() === 'input' && el.name === 'x'; + } + catch(err) { + return false; + } + })(); + + var element = global.Element; + + global.Element = function(tagName, attributes) { + attributes = attributes || { }; + tagName = tagName.toLowerCase(); + var cache = Element.cache; + + if (HAS_EXTENDED_CREATE_ELEMENT_SYNTAX && attributes.name) { + tagName = '<' + tagName + ' name="' + attributes.name + '">'; + delete attributes.name; + return Element.writeAttribute(document.createElement(tagName), attributes); + } + + if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName)); + + var node = shouldUseCache(tagName, attributes) ? + cache[tagName].cloneNode(false) : document.createElement(tagName); + + return Element.writeAttribute(node, attributes); + }; + + Object.extend(global.Element, element || { }); + if (element) global.Element.prototype = element.prototype; + +})(this); + +Element.idCounter = 1; +Element.cache = { }; + +Element._purgeElement = function(element) { + var uid = element._prototypeUID; + if (uid) { + Element.stopObserving(element); + element._prototypeUID = void 0; + delete Element.Storage[uid]; + } +} + +Element.Methods = { + visible: function(element) { + return $(element).style.display != 'none'; + }, + + toggle: function(element) { + element = $(element); + Element[Element.visible(element) ? 'hide' : 'show'](element); + return element; + }, + + hide: function(element) { + element = $(element); + element.style.display = 'none'; + return element; + }, + + show: function(element) { + element = $(element); + element.style.display = ''; + return element; + }, + + remove: function(element) { + element = $(element); + element.parentNode.removeChild(element); + return element; + }, + + update: (function(){ + + var SELECT_ELEMENT_INNERHTML_BUGGY = (function(){ + var el = document.createElement("select"), + isBuggy = true; + el.innerHTML = ""; + if (el.options && el.options[0]) { + isBuggy = el.options[0].nodeName.toUpperCase() !== "OPTION"; + } + el = null; + return isBuggy; + })(); + + var TABLE_ELEMENT_INNERHTML_BUGGY = (function(){ + try { + var el = document.createElement("table"); + if (el && el.tBodies) { + el.innerHTML = "test"; + var isBuggy = typeof el.tBodies[0] == "undefined"; + el = null; + return isBuggy; + } + } catch (e) { + return true; + } + })(); + + var LINK_ELEMENT_INNERHTML_BUGGY = (function() { + try { + var el = document.createElement('div'); + el.innerHTML = ""; + var isBuggy = (el.childNodes.length === 0); + el = null; + return isBuggy; + } catch(e) { + return true; + } + })(); + + var ANY_INNERHTML_BUGGY = SELECT_ELEMENT_INNERHTML_BUGGY || + TABLE_ELEMENT_INNERHTML_BUGGY || LINK_ELEMENT_INNERHTML_BUGGY; + + var SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING = (function () { + var s = document.createElement("script"), + isBuggy = false; + try { + s.appendChild(document.createTextNode("")); + isBuggy = !s.firstChild || + s.firstChild && s.firstChild.nodeType !== 3; + } catch (e) { + isBuggy = true; + } + s = null; + return isBuggy; + })(); + + + function update(element, content) { + element = $(element); + var purgeElement = Element._purgeElement; + + var descendants = element.getElementsByTagName('*'), + i = descendants.length; + while (i--) purgeElement(descendants[i]); + + if (content && content.toElement) + content = content.toElement(); + + if (Object.isElement(content)) + return element.update().insert(content); + + content = Object.toHTML(content); + + var tagName = element.tagName.toUpperCase(); + + if (tagName === 'SCRIPT' && SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING) { + element.text = content; + return element; + } + + if (ANY_INNERHTML_BUGGY) { + if (tagName in Element._insertionTranslations.tags) { + while (element.firstChild) { + element.removeChild(element.firstChild); + } + Element._getContentFromAnonymousElement(tagName, content.stripScripts()) + .each(function(node) { + element.appendChild(node) + }); + } else if (LINK_ELEMENT_INNERHTML_BUGGY && Object.isString(content) && content.indexOf(' -1) { + while (element.firstChild) { + element.removeChild(element.firstChild); + } + var nodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts(), true); + nodes.each(function(node) { element.appendChild(node) }); + } + else { + element.innerHTML = content.stripScripts(); + } + } + else { + element.innerHTML = content.stripScripts(); + } + + content.evalScripts.bind(content).defer(); + return element; + } + + return update; + })(), + + replace: function(element, content) { + element = $(element); + if (content && content.toElement) content = content.toElement(); + else if (!Object.isElement(content)) { + content = Object.toHTML(content); + var range = element.ownerDocument.createRange(); + range.selectNode(element); + content.evalScripts.bind(content).defer(); + content = range.createContextualFragment(content.stripScripts()); + } + element.parentNode.replaceChild(content, element); + return element; + }, + + insert: function(element, insertions) { + element = $(element); + + if (Object.isString(insertions) || Object.isNumber(insertions) || + Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML))) + insertions = {bottom:insertions}; + + var content, insert, tagName, childNodes; + + for (var position in insertions) { + content = insertions[position]; + position = position.toLowerCase(); + insert = Element._insertionTranslations[position]; + + if (content && content.toElement) content = content.toElement(); + if (Object.isElement(content)) { + insert(element, content); + continue; + } + + content = Object.toHTML(content); + + tagName = ((position == 'before' || position == 'after') + ? element.parentNode : element).tagName.toUpperCase(); + + childNodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts()); + + if (position == 'top' || position == 'after') childNodes.reverse(); + childNodes.each(insert.curry(element)); + + content.evalScripts.bind(content).defer(); + } + + return element; + }, + + wrap: function(element, wrapper, attributes) { + element = $(element); + if (Object.isElement(wrapper)) + $(wrapper).writeAttribute(attributes || { }); + else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes); + else wrapper = new Element('div', wrapper); + if (element.parentNode) + element.parentNode.replaceChild(wrapper, element); + wrapper.appendChild(element); + return wrapper; + }, + + inspect: function(element) { + element = $(element); + var result = '<' + element.tagName.toLowerCase(); + $H({'id': 'id', 'className': 'class'}).each(function(pair) { + var property = pair.first(), + attribute = pair.last(), + value = (element[property] || '').toString(); + if (value) result += ' ' + attribute + '=' + value.inspect(true); + }); + return result + '>'; + }, + + recursivelyCollect: function(element, property, maximumLength) { + element = $(element); + maximumLength = maximumLength || -1; + var elements = []; + + while (element = element[property]) { + if (element.nodeType == 1) + elements.push(Element.extend(element)); + if (elements.length == maximumLength) + break; + } + + return elements; + }, + + ancestors: function(element) { + return Element.recursivelyCollect(element, 'parentNode'); + }, + + descendants: function(element) { + return Element.select(element, "*"); + }, + + firstDescendant: function(element) { + element = $(element).firstChild; + while (element && element.nodeType != 1) element = element.nextSibling; + return $(element); + }, + + immediateDescendants: function(element) { + var results = [], child = $(element).firstChild; + while (child) { + if (child.nodeType === 1) { + results.push(Element.extend(child)); + } + child = child.nextSibling; + } + return results; + }, + + previousSiblings: function(element, maximumLength) { + return Element.recursivelyCollect(element, 'previousSibling'); + }, + + nextSiblings: function(element) { + return Element.recursivelyCollect(element, 'nextSibling'); + }, + + siblings: function(element) { + element = $(element); + return Element.previousSiblings(element).reverse() + .concat(Element.nextSiblings(element)); + }, + + match: function(element, selector) { + element = $(element); + if (Object.isString(selector)) + return Prototype.Selector.match(element, selector); + return selector.match(element); + }, + + up: function(element, expression, index) { + element = $(element); + if (arguments.length == 1) return $(element.parentNode); + var ancestors = Element.ancestors(element); + return Object.isNumber(expression) ? ancestors[expression] : + Prototype.Selector.find(ancestors, expression, index); + }, + + down: function(element, expression, index) { + element = $(element); + if (arguments.length == 1) return Element.firstDescendant(element); + return Object.isNumber(expression) ? Element.descendants(element)[expression] : + Element.select(element, expression)[index || 0]; + }, + + previous: function(element, expression, index) { + element = $(element); + if (Object.isNumber(expression)) index = expression, expression = false; + if (!Object.isNumber(index)) index = 0; + + if (expression) { + return Prototype.Selector.find(element.previousSiblings(), expression, index); + } else { + return element.recursivelyCollect("previousSibling", index + 1)[index]; + } + }, + + next: function(element, expression, index) { + element = $(element); + if (Object.isNumber(expression)) index = expression, expression = false; + if (!Object.isNumber(index)) index = 0; + + if (expression) { + return Prototype.Selector.find(element.nextSiblings(), expression, index); + } else { + var maximumLength = Object.isNumber(index) ? index + 1 : 1; + return element.recursivelyCollect("nextSibling", index + 1)[index]; + } + }, + + + select: function(element) { + element = $(element); + var expressions = Array.prototype.slice.call(arguments, 1).join(', '); + return Prototype.Selector.select(expressions, element); + }, + + adjacent: function(element) { + element = $(element); + var expressions = Array.prototype.slice.call(arguments, 1).join(', '); + return Prototype.Selector.select(expressions, element.parentNode).without(element); + }, + + identify: function(element) { + element = $(element); + var id = Element.readAttribute(element, 'id'); + if (id) return id; + do { id = 'anonymous_element_' + Element.idCounter++ } while ($(id)); + Element.writeAttribute(element, 'id', id); + return id; + }, + + readAttribute: function(element, name) { + element = $(element); + if (Prototype.Browser.IE) { + var t = Element._attributeTranslations.read; + if (t.values[name]) return t.values[name](element, name); + if (t.names[name]) name = t.names[name]; + if (name.include(':')) { + return (!element.attributes || !element.attributes[name]) ? null : + element.attributes[name].value; + } + } + return element.getAttribute(name); + }, + + writeAttribute: function(element, name, value) { + element = $(element); + var attributes = { }, t = Element._attributeTranslations.write; + + if (typeof name == 'object') attributes = name; + else attributes[name] = Object.isUndefined(value) ? true : value; + + for (var attr in attributes) { + name = t.names[attr] || attr; + value = attributes[attr]; + if (t.values[attr]) name = t.values[attr](element, value); + if (value === false || value === null) + element.removeAttribute(name); + else if (value === true) + element.setAttribute(name, name); + else element.setAttribute(name, value); + } + return element; + }, + + getHeight: function(element) { + return Element.getDimensions(element).height; + }, + + getWidth: function(element) { + return Element.getDimensions(element).width; + }, + + classNames: function(element) { + return new Element.ClassNames(element); + }, + + hasClassName: function(element, className) { + if (!(element = $(element))) return; + var elementClassName = element.className; + return (elementClassName.length > 0 && (elementClassName == className || + new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName))); + }, + + addClassName: function(element, className) { + if (!(element = $(element))) return; + if (!Element.hasClassName(element, className)) + element.className += (element.className ? ' ' : '') + className; + return element; + }, + + removeClassName: function(element, className) { + if (!(element = $(element))) return; + element.className = element.className.replace( + new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip(); + return element; + }, + + toggleClassName: function(element, className) { + if (!(element = $(element))) return; + return Element[Element.hasClassName(element, className) ? + 'removeClassName' : 'addClassName'](element, className); + }, + + cleanWhitespace: function(element) { + element = $(element); + var node = element.firstChild; + while (node) { + var nextNode = node.nextSibling; + if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) + element.removeChild(node); + node = nextNode; + } + return element; + }, + + empty: function(element) { + return $(element).innerHTML.blank(); + }, + + descendantOf: function(element, ancestor) { + element = $(element), ancestor = $(ancestor); + + if (element.compareDocumentPosition) + return (element.compareDocumentPosition(ancestor) & 8) === 8; + + if (ancestor.contains) + return ancestor.contains(element) && ancestor !== element; + + while (element = element.parentNode) + if (element == ancestor) return true; + + return false; + }, + + scrollTo: function(element) { + element = $(element); + var pos = Element.cumulativeOffset(element); + window.scrollTo(pos[0], pos[1]); + return element; + }, + + getStyle: function(element, style) { + element = $(element); + style = style == 'float' ? 'cssFloat' : style.camelize(); + var value = element.style[style]; + if (!value || value == 'auto') { + var css = document.defaultView.getComputedStyle(element, null); + value = css ? css[style] : null; + } + if (style == 'opacity') return value ? parseFloat(value) : 1.0; + return value == 'auto' ? null : value; + }, + + getOpacity: function(element) { + return $(element).getStyle('opacity'); + }, + + setStyle: function(element, styles) { + element = $(element); + var elementStyle = element.style, match; + if (Object.isString(styles)) { + element.style.cssText += ';' + styles; + return styles.include('opacity') ? + element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element; + } + for (var property in styles) + if (property == 'opacity') element.setOpacity(styles[property]); + else + elementStyle[(property == 'float' || property == 'cssFloat') ? + (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') : + property] = styles[property]; + + return element; + }, + + setOpacity: function(element, value) { + element = $(element); + element.style.opacity = (value == 1 || value === '') ? '' : + (value < 0.00001) ? 0 : value; + return element; + }, + + makePositioned: function(element) { + element = $(element); + var pos = Element.getStyle(element, 'position'); + if (pos == 'static' || !pos) { + element._madePositioned = true; + element.style.position = 'relative'; + if (Prototype.Browser.Opera) { + element.style.top = 0; + element.style.left = 0; + } + } + return element; + }, + + undoPositioned: function(element) { + element = $(element); + if (element._madePositioned) { + element._madePositioned = undefined; + element.style.position = + element.style.top = + element.style.left = + element.style.bottom = + element.style.right = ''; + } + return element; + }, + + makeClipping: function(element) { + element = $(element); + if (element._overflow) return element; + element._overflow = Element.getStyle(element, 'overflow') || 'auto'; + if (element._overflow !== 'hidden') + element.style.overflow = 'hidden'; + return element; + }, + + undoClipping: function(element) { + element = $(element); + if (!element._overflow) return element; + element.style.overflow = element._overflow == 'auto' ? '' : element._overflow; + element._overflow = null; + return element; + }, + + clonePosition: function(element, source) { + var options = Object.extend({ + setLeft: true, + setTop: true, + setWidth: true, + setHeight: true, + offsetTop: 0, + offsetLeft: 0 + }, arguments[2] || { }); + + source = $(source); + var p = Element.viewportOffset(source), delta = [0, 0], parent = null; + + element = $(element); + + if (Element.getStyle(element, 'position') == 'absolute') { + parent = Element.getOffsetParent(element); + delta = Element.viewportOffset(parent); + } + + if (parent == document.body) { + delta[0] -= document.body.offsetLeft; + delta[1] -= document.body.offsetTop; + } + + if (options.setLeft) element.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px'; + if (options.setTop) element.style.top = (p[1] - delta[1] + options.offsetTop) + 'px'; + if (options.setWidth) element.style.width = source.offsetWidth + 'px'; + if (options.setHeight) element.style.height = source.offsetHeight + 'px'; + return element; + } +}; + +Object.extend(Element.Methods, { + getElementsBySelector: Element.Methods.select, + + childElements: Element.Methods.immediateDescendants +}); + +Element._attributeTranslations = { + write: { + names: { + className: 'class', + htmlFor: 'for' + }, + values: { } + } +}; + +if (Prototype.Browser.Opera) { + Element.Methods.getStyle = Element.Methods.getStyle.wrap( + function(proceed, element, style) { + switch (style) { + case 'height': case 'width': + if (!Element.visible(element)) return null; + + var dim = parseInt(proceed(element, style), 10); + + if (dim !== element['offset' + style.capitalize()]) + return dim + 'px'; + + var properties; + if (style === 'height') { + properties = ['border-top-width', 'padding-top', + 'padding-bottom', 'border-bottom-width']; + } + else { + properties = ['border-left-width', 'padding-left', + 'padding-right', 'border-right-width']; + } + return properties.inject(dim, function(memo, property) { + var val = proceed(element, property); + return val === null ? memo : memo - parseInt(val, 10); + }) + 'px'; + default: return proceed(element, style); + } + } + ); + + Element.Methods.readAttribute = Element.Methods.readAttribute.wrap( + function(proceed, element, attribute) { + if (attribute === 'title') return element.title; + return proceed(element, attribute); + } + ); +} + +else if (Prototype.Browser.IE) { + Element.Methods.getStyle = function(element, style) { + element = $(element); + style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize(); + var value = element.style[style]; + if (!value && element.currentStyle) value = element.currentStyle[style]; + + if (style == 'opacity') { + if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/)) + if (value[1]) return parseFloat(value[1]) / 100; + return 1.0; + } + + if (value == 'auto') { + if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none')) + return element['offset' + style.capitalize()] + 'px'; + return null; + } + return value; + }; + + Element.Methods.setOpacity = function(element, value) { + function stripAlpha(filter){ + return filter.replace(/alpha\([^\)]*\)/gi,''); + } + element = $(element); + var currentStyle = element.currentStyle; + if ((currentStyle && !currentStyle.hasLayout) || + (!currentStyle && element.style.zoom == 'normal')) + element.style.zoom = 1; + + var filter = element.getStyle('filter'), style = element.style; + if (value == 1 || value === '') { + (filter = stripAlpha(filter)) ? + style.filter = filter : style.removeAttribute('filter'); + return element; + } else if (value < 0.00001) value = 0; + style.filter = stripAlpha(filter) + + 'alpha(opacity=' + (value * 100) + ')'; + return element; + }; + + Element._attributeTranslations = (function(){ + + var classProp = 'className', + forProp = 'for', + el = document.createElement('div'); + + el.setAttribute(classProp, 'x'); + + if (el.className !== 'x') { + el.setAttribute('class', 'x'); + if (el.className === 'x') { + classProp = 'class'; + } + } + el = null; + + el = document.createElement('label'); + el.setAttribute(forProp, 'x'); + if (el.htmlFor !== 'x') { + el.setAttribute('htmlFor', 'x'); + if (el.htmlFor === 'x') { + forProp = 'htmlFor'; + } + } + el = null; + + return { + read: { + names: { + 'class': classProp, + 'className': classProp, + 'for': forProp, + 'htmlFor': forProp + }, + values: { + _getAttr: function(element, attribute) { + return element.getAttribute(attribute); + }, + _getAttr2: function(element, attribute) { + return element.getAttribute(attribute, 2); + }, + _getAttrNode: function(element, attribute) { + var node = element.getAttributeNode(attribute); + return node ? node.value : ""; + }, + _getEv: (function(){ + + var el = document.createElement('div'), f; + el.onclick = Prototype.emptyFunction; + var value = el.getAttribute('onclick'); + + if (String(value).indexOf('{') > -1) { + f = function(element, attribute) { + attribute = element.getAttribute(attribute); + if (!attribute) return null; + attribute = attribute.toString(); + attribute = attribute.split('{')[1]; + attribute = attribute.split('}')[0]; + return attribute.strip(); + }; + } + else if (value === '') { + f = function(element, attribute) { + attribute = element.getAttribute(attribute); + if (!attribute) return null; + return attribute.strip(); + }; + } + el = null; + return f; + })(), + _flag: function(element, attribute) { + return $(element).hasAttribute(attribute) ? attribute : null; + }, + style: function(element) { + return element.style.cssText.toLowerCase(); + }, + title: function(element) { + return element.title; + } + } + } + } + })(); + + Element._attributeTranslations.write = { + names: Object.extend({ + cellpadding: 'cellPadding', + cellspacing: 'cellSpacing' + }, Element._attributeTranslations.read.names), + values: { + checked: function(element, value) { + element.checked = !!value; + }, + + style: function(element, value) { + element.style.cssText = value ? value : ''; + } + } + }; + + Element._attributeTranslations.has = {}; + + $w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' + + 'encType maxLength readOnly longDesc frameBorder').each(function(attr) { + Element._attributeTranslations.write.names[attr.toLowerCase()] = attr; + Element._attributeTranslations.has[attr.toLowerCase()] = attr; + }); + + (function(v) { + Object.extend(v, { + href: v._getAttr2, + src: v._getAttr2, + type: v._getAttr, + action: v._getAttrNode, + disabled: v._flag, + checked: v._flag, + readonly: v._flag, + multiple: v._flag, + onload: v._getEv, + onunload: v._getEv, + onclick: v._getEv, + ondblclick: v._getEv, + onmousedown: v._getEv, + onmouseup: v._getEv, + onmouseover: v._getEv, + onmousemove: v._getEv, + onmouseout: v._getEv, + onfocus: v._getEv, + onblur: v._getEv, + onkeypress: v._getEv, + onkeydown: v._getEv, + onkeyup: v._getEv, + onsubmit: v._getEv, + onreset: v._getEv, + onselect: v._getEv, + onchange: v._getEv + }); + })(Element._attributeTranslations.read.values); + + if (Prototype.BrowserFeatures.ElementExtensions) { + (function() { + function _descendants(element) { + var nodes = element.getElementsByTagName('*'), results = []; + for (var i = 0, node; node = nodes[i]; i++) + if (node.tagName !== "!") // Filter out comment nodes. + results.push(node); + return results; + } + + Element.Methods.down = function(element, expression, index) { + element = $(element); + if (arguments.length == 1) return element.firstDescendant(); + return Object.isNumber(expression) ? _descendants(element)[expression] : + Element.select(element, expression)[index || 0]; + } + })(); + } + +} + +else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) { + Element.Methods.setOpacity = function(element, value) { + element = $(element); + element.style.opacity = (value == 1) ? 0.999999 : + (value === '') ? '' : (value < 0.00001) ? 0 : value; + return element; + }; +} + +else if (Prototype.Browser.WebKit) { + Element.Methods.setOpacity = function(element, value) { + element = $(element); + element.style.opacity = (value == 1 || value === '') ? '' : + (value < 0.00001) ? 0 : value; + + if (value == 1) + if (element.tagName.toUpperCase() == 'IMG' && element.width) { + element.width++; element.width--; + } else try { + var n = document.createTextNode(' '); + element.appendChild(n); + element.removeChild(n); + } catch (e) { } + + return element; + }; +} + +if ('outerHTML' in document.documentElement) { + Element.Methods.replace = function(element, content) { + element = $(element); + + if (content && content.toElement) content = content.toElement(); + if (Object.isElement(content)) { + element.parentNode.replaceChild(content, element); + return element; + } + + content = Object.toHTML(content); + var parent = element.parentNode, tagName = parent.tagName.toUpperCase(); + + if (Element._insertionTranslations.tags[tagName]) { + var nextSibling = element.next(), + fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts()); + parent.removeChild(element); + if (nextSibling) + fragments.each(function(node) { parent.insertBefore(node, nextSibling) }); + else + fragments.each(function(node) { parent.appendChild(node) }); + } + else element.outerHTML = content.stripScripts(); + + content.evalScripts.bind(content).defer(); + return element; + }; +} + +Element._returnOffset = function(l, t) { + var result = [l, t]; + result.left = l; + result.top = t; + return result; +}; + +Element._getContentFromAnonymousElement = function(tagName, html, force) { + var div = new Element('div'), + t = Element._insertionTranslations.tags[tagName]; + + var workaround = false; + if (t) workaround = true; + else if (force) { + workaround = true; + t = ['', '', 0]; + } + + if (workaround) { + div.innerHTML = ' ' + t[0] + html + t[1]; + div.removeChild(div.firstChild); + for (var i = t[2]; i--; ) { + div = div.firstChild; + } + } + else { + div.innerHTML = html; + } + return $A(div.childNodes); +}; + +Element._insertionTranslations = { + before: function(element, node) { + element.parentNode.insertBefore(node, element); + }, + top: function(element, node) { + element.insertBefore(node, element.firstChild); + }, + bottom: function(element, node) { + element.appendChild(node); + }, + after: function(element, node) { + element.parentNode.insertBefore(node, element.nextSibling); + }, + tags: { + TABLE: ['', '
', 1], + TBODY: ['', '
', 2], + TR: ['', '
', 3], + TD: ['
', '
', 4], + SELECT: ['', 1] + } +}; + +(function() { + var tags = Element._insertionTranslations.tags; + Object.extend(tags, { + THEAD: tags.TBODY, + TFOOT: tags.TBODY, + TH: tags.TD + }); +})(); + +Element.Methods.Simulated = { + hasAttribute: function(element, attribute) { + attribute = Element._attributeTranslations.has[attribute] || attribute; + var node = $(element).getAttributeNode(attribute); + return !!(node && node.specified); + } +}; + +Element.Methods.ByTag = { }; + +Object.extend(Element, Element.Methods); + +(function(div) { + + if (!Prototype.BrowserFeatures.ElementExtensions && div['__proto__']) { + window.HTMLElement = { }; + window.HTMLElement.prototype = div['__proto__']; + Prototype.BrowserFeatures.ElementExtensions = true; + } + + div = null; + +})(document.createElement('div')); + +Element.extend = (function() { + + function checkDeficiency(tagName) { + if (typeof window.Element != 'undefined') { + var proto = window.Element.prototype; + if (proto) { + var id = '_' + (Math.random()+'').slice(2), + el = document.createElement(tagName); + proto[id] = 'x'; + var isBuggy = (el[id] !== 'x'); + delete proto[id]; + el = null; + return isBuggy; + } + } + return false; + } + + function extendElementWith(element, methods) { + for (var property in methods) { + var value = methods[property]; + if (Object.isFunction(value) && !(property in element)) + element[property] = value.methodize(); + } + } + + var HTMLOBJECTELEMENT_PROTOTYPE_BUGGY = checkDeficiency('object'); + + if (Prototype.BrowserFeatures.SpecificElementExtensions) { + if (HTMLOBJECTELEMENT_PROTOTYPE_BUGGY) { + return function(element) { + if (element && typeof element._extendedByPrototype == 'undefined') { + var t = element.tagName; + if (t && (/^(?:object|applet|embed)$/i.test(t))) { + extendElementWith(element, Element.Methods); + extendElementWith(element, Element.Methods.Simulated); + extendElementWith(element, Element.Methods.ByTag[t.toUpperCase()]); + } + } + return element; + } + } + return Prototype.K; + } + + var Methods = { }, ByTag = Element.Methods.ByTag; + + var extend = Object.extend(function(element) { + if (!element || typeof element._extendedByPrototype != 'undefined' || + element.nodeType != 1 || element == window) return element; + + var methods = Object.clone(Methods), + tagName = element.tagName.toUpperCase(); + + if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]); + + extendElementWith(element, methods); + + element._extendedByPrototype = Prototype.emptyFunction; + return element; + + }, { + refresh: function() { + if (!Prototype.BrowserFeatures.ElementExtensions) { + Object.extend(Methods, Element.Methods); + Object.extend(Methods, Element.Methods.Simulated); + } + } + }); + + extend.refresh(); + return extend; +})(); + +if (document.documentElement.hasAttribute) { + Element.hasAttribute = function(element, attribute) { + return element.hasAttribute(attribute); + }; +} +else { + Element.hasAttribute = Element.Methods.Simulated.hasAttribute; +} + +Element.addMethods = function(methods) { + var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag; + + if (!methods) { + Object.extend(Form, Form.Methods); + Object.extend(Form.Element, Form.Element.Methods); + Object.extend(Element.Methods.ByTag, { + "FORM": Object.clone(Form.Methods), + "INPUT": Object.clone(Form.Element.Methods), + "SELECT": Object.clone(Form.Element.Methods), + "TEXTAREA": Object.clone(Form.Element.Methods), + "BUTTON": Object.clone(Form.Element.Methods) + }); + } + + if (arguments.length == 2) { + var tagName = methods; + methods = arguments[1]; + } + + if (!tagName) Object.extend(Element.Methods, methods || { }); + else { + if (Object.isArray(tagName)) tagName.each(extend); + else extend(tagName); + } + + function extend(tagName) { + tagName = tagName.toUpperCase(); + if (!Element.Methods.ByTag[tagName]) + Element.Methods.ByTag[tagName] = { }; + Object.extend(Element.Methods.ByTag[tagName], methods); + } + + function copy(methods, destination, onlyIfAbsent) { + onlyIfAbsent = onlyIfAbsent || false; + for (var property in methods) { + var value = methods[property]; + if (!Object.isFunction(value)) continue; + if (!onlyIfAbsent || !(property in destination)) + destination[property] = value.methodize(); + } + } + + function findDOMClass(tagName) { + var klass; + var trans = { + "OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph", + "FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList", + "DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading", + "H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote", + "INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION": + "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD": + "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR": + "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET": + "FrameSet", "IFRAME": "IFrame" + }; + if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element'; + if (window[klass]) return window[klass]; + klass = 'HTML' + tagName + 'Element'; + if (window[klass]) return window[klass]; + klass = 'HTML' + tagName.capitalize() + 'Element'; + if (window[klass]) return window[klass]; + + var element = document.createElement(tagName), + proto = element['__proto__'] || element.constructor.prototype; + + element = null; + return proto; + } + + var elementPrototype = window.HTMLElement ? HTMLElement.prototype : + Element.prototype; + + if (F.ElementExtensions) { + copy(Element.Methods, elementPrototype); + copy(Element.Methods.Simulated, elementPrototype, true); + } + + if (F.SpecificElementExtensions) { + for (var tag in Element.Methods.ByTag) { + var klass = findDOMClass(tag); + if (Object.isUndefined(klass)) continue; + copy(T[tag], klass.prototype); + } + } + + Object.extend(Element, Element.Methods); + delete Element.ByTag; + + if (Element.extend.refresh) Element.extend.refresh(); + Element.cache = { }; +}; + + +document.viewport = { + + getDimensions: function() { + return { width: this.getWidth(), height: this.getHeight() }; + }, + + getScrollOffsets: function() { + return Element._returnOffset( + window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft, + window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop); + } +}; + +(function(viewport) { + var B = Prototype.Browser, doc = document, element, property = {}; + + function getRootElement() { + if (B.WebKit && !doc.evaluate) + return document; + + if (B.Opera && window.parseFloat(window.opera.version()) < 9.5) + return document.body; + + return document.documentElement; + } + + function define(D) { + if (!element) element = getRootElement(); + + property[D] = 'client' + D; + + viewport['get' + D] = function() { return element[property[D]] }; + return viewport['get' + D](); + } + + viewport.getWidth = define.curry('Width'); + + viewport.getHeight = define.curry('Height'); +})(document.viewport); + + +Element.Storage = { + UID: 1 +}; + +Element.addMethods({ + getStorage: function(element) { + if (!(element = $(element))) return; + + var uid; + if (element === window) { + uid = 0; + } else { + if (typeof element._prototypeUID === "undefined") + element._prototypeUID = Element.Storage.UID++; + uid = element._prototypeUID; + } + + if (!Element.Storage[uid]) + Element.Storage[uid] = $H(); + + return Element.Storage[uid]; + }, + + store: function(element, key, value) { + if (!(element = $(element))) return; + + if (arguments.length === 2) { + Element.getStorage(element).update(key); + } else { + Element.getStorage(element).set(key, value); + } + + return element; + }, + + retrieve: function(element, key, defaultValue) { + if (!(element = $(element))) return; + var hash = Element.getStorage(element), value = hash.get(key); + + if (Object.isUndefined(value)) { + hash.set(key, defaultValue); + value = defaultValue; + } + + return value; + }, + + clone: function(element, deep) { + if (!(element = $(element))) return; + var clone = element.cloneNode(deep); + clone._prototypeUID = void 0; + if (deep) { + var descendants = Element.select(clone, '*'), + i = descendants.length; + while (i--) { + descendants[i]._prototypeUID = void 0; + } + } + return Element.extend(clone); + }, + + purge: function(element) { + if (!(element = $(element))) return; + var purgeElement = Element._purgeElement; + + purgeElement(element); + + var descendants = element.getElementsByTagName('*'), + i = descendants.length; + + while (i--) purgeElement(descendants[i]); + + return null; + } +}); + +(function() { + + function toDecimal(pctString) { + var match = pctString.match(/^(\d+)%?$/i); + if (!match) return null; + return (Number(match[1]) / 100); + } + + function getPixelValue(value, property, context) { + var element = null; + if (Object.isElement(value)) { + element = value; + value = element.getStyle(property); + } + + if (value === null) { + return null; + } + + if ((/^(?:-)?\d+(\.\d+)?(px)?$/i).test(value)) { + return window.parseFloat(value); + } + + var isPercentage = value.include('%'), isViewport = (context === document.viewport); + + if (/\d/.test(value) && element && element.runtimeStyle && !(isPercentage && isViewport)) { + var style = element.style.left, rStyle = element.runtimeStyle.left; + element.runtimeStyle.left = element.currentStyle.left; + element.style.left = value || 0; + value = element.style.pixelLeft; + element.style.left = style; + element.runtimeStyle.left = rStyle; + + return value; + } + + if (element && isPercentage) { + context = context || element.parentNode; + var decimal = toDecimal(value); + var whole = null; + var position = element.getStyle('position'); + + var isHorizontal = property.include('left') || property.include('right') || + property.include('width'); + + var isVertical = property.include('top') || property.include('bottom') || + property.include('height'); + + if (context === document.viewport) { + if (isHorizontal) { + whole = document.viewport.getWidth(); + } else if (isVertical) { + whole = document.viewport.getHeight(); + } + } else { + if (isHorizontal) { + whole = $(context).measure('width'); + } else if (isVertical) { + whole = $(context).measure('height'); + } + } + + return (whole === null) ? 0 : whole * decimal; + } + + return 0; + } + + function toCSSPixels(number) { + if (Object.isString(number) && number.endsWith('px')) { + return number; + } + return number + 'px'; + } + + function isDisplayed(element) { + var originalElement = element; + while (element && element.parentNode) { + var display = element.getStyle('display'); + if (display === 'none') { + return false; + } + element = $(element.parentNode); + } + return true; + } + + var hasLayout = Prototype.K; + if ('currentStyle' in document.documentElement) { + hasLayout = function(element) { + if (!element.currentStyle.hasLayout) { + element.style.zoom = 1; + } + return element; + }; + } + + function cssNameFor(key) { + if (key.include('border')) key = key + '-width'; + return key.camelize(); + } + + Element.Layout = Class.create(Hash, { + initialize: function($super, element, preCompute) { + $super(); + this.element = $(element); + + Element.Layout.PROPERTIES.each( function(property) { + this._set(property, null); + }, this); + + if (preCompute) { + this._preComputing = true; + this._begin(); + Element.Layout.PROPERTIES.each( this._compute, this ); + this._end(); + this._preComputing = false; + } + }, + + _set: function(property, value) { + return Hash.prototype.set.call(this, property, value); + }, + + set: function(property, value) { + throw "Properties of Element.Layout are read-only."; + }, + + get: function($super, property) { + var value = $super(property); + return value === null ? this._compute(property) : value; + }, + + _begin: function() { + if (this._prepared) return; + + var element = this.element; + if (isDisplayed(element)) { + this._prepared = true; + return; + } + + var originalStyles = { + position: element.style.position || '', + width: element.style.width || '', + visibility: element.style.visibility || '', + display: element.style.display || '' + }; + + element.store('prototype_original_styles', originalStyles); + + var position = element.getStyle('position'), + width = element.getStyle('width'); + + if (width === "0px" || width === null) { + element.style.display = 'block'; + width = element.getStyle('width'); + } + + var context = (position === 'fixed') ? document.viewport : + element.parentNode; + + element.setStyle({ + position: 'absolute', + visibility: 'hidden', + display: 'block' + }); + + var positionedWidth = element.getStyle('width'); + + var newWidth; + if (width && (positionedWidth === width)) { + newWidth = getPixelValue(element, 'width', context); + } else if (position === 'absolute' || position === 'fixed') { + newWidth = getPixelValue(element, 'width', context); + } else { + var parent = element.parentNode, pLayout = $(parent).getLayout(); + + newWidth = pLayout.get('width') - + this.get('margin-left') - + this.get('border-left') - + this.get('padding-left') - + this.get('padding-right') - + this.get('border-right') - + this.get('margin-right'); + } + + element.setStyle({ width: newWidth + 'px' }); + + this._prepared = true; + }, + + _end: function() { + var element = this.element; + var originalStyles = element.retrieve('prototype_original_styles'); + element.store('prototype_original_styles', null); + element.setStyle(originalStyles); + this._prepared = false; + }, + + _compute: function(property) { + var COMPUTATIONS = Element.Layout.COMPUTATIONS; + if (!(property in COMPUTATIONS)) { + throw "Property not found."; + } + + return this._set(property, COMPUTATIONS[property].call(this, this.element)); + }, + + toObject: function() { + var args = $A(arguments); + var keys = (args.length === 0) ? Element.Layout.PROPERTIES : + args.join(' ').split(' '); + var obj = {}; + keys.each( function(key) { + if (!Element.Layout.PROPERTIES.include(key)) return; + var value = this.get(key); + if (value != null) obj[key] = value; + }, this); + return obj; + }, + + toHash: function() { + var obj = this.toObject.apply(this, arguments); + return new Hash(obj); + }, + + toCSS: function() { + var args = $A(arguments); + var keys = (args.length === 0) ? Element.Layout.PROPERTIES : + args.join(' ').split(' '); + var css = {}; + + keys.each( function(key) { + if (!Element.Layout.PROPERTIES.include(key)) return; + if (Element.Layout.COMPOSITE_PROPERTIES.include(key)) return; + + var value = this.get(key); + if (value != null) css[cssNameFor(key)] = value + 'px'; + }, this); + return css; + }, + + inspect: function() { + return "#"; + } + }); + + Object.extend(Element.Layout, { + PROPERTIES: $w('height width top left right bottom border-left border-right border-top border-bottom padding-left padding-right padding-top padding-bottom margin-top margin-bottom margin-left margin-right padding-box-width padding-box-height border-box-width border-box-height margin-box-width margin-box-height'), + + COMPOSITE_PROPERTIES: $w('padding-box-width padding-box-height margin-box-width margin-box-height border-box-width border-box-height'), + + COMPUTATIONS: { + 'height': function(element) { + if (!this._preComputing) this._begin(); + + var bHeight = this.get('border-box-height'); + if (bHeight <= 0) { + if (!this._preComputing) this._end(); + return 0; + } + + var bTop = this.get('border-top'), + bBottom = this.get('border-bottom'); + + var pTop = this.get('padding-top'), + pBottom = this.get('padding-bottom'); + + if (!this._preComputing) this._end(); + + return bHeight - bTop - bBottom - pTop - pBottom; + }, + + 'width': function(element) { + if (!this._preComputing) this._begin(); + + var bWidth = this.get('border-box-width'); + if (bWidth <= 0) { + if (!this._preComputing) this._end(); + return 0; + } + + var bLeft = this.get('border-left'), + bRight = this.get('border-right'); + + var pLeft = this.get('padding-left'), + pRight = this.get('padding-right'); + + if (!this._preComputing) this._end(); + + return bWidth - bLeft - bRight - pLeft - pRight; + }, + + 'padding-box-height': function(element) { + var height = this.get('height'), + pTop = this.get('padding-top'), + pBottom = this.get('padding-bottom'); + + return height + pTop + pBottom; + }, + + 'padding-box-width': function(element) { + var width = this.get('width'), + pLeft = this.get('padding-left'), + pRight = this.get('padding-right'); + + return width + pLeft + pRight; + }, + + 'border-box-height': function(element) { + if (!this._preComputing) this._begin(); + var height = element.offsetHeight; + if (!this._preComputing) this._end(); + return height; + }, + + 'border-box-width': function(element) { + if (!this._preComputing) this._begin(); + var width = element.offsetWidth; + if (!this._preComputing) this._end(); + return width; + }, + + 'margin-box-height': function(element) { + var bHeight = this.get('border-box-height'), + mTop = this.get('margin-top'), + mBottom = this.get('margin-bottom'); + + if (bHeight <= 0) return 0; + + return bHeight + mTop + mBottom; + }, + + 'margin-box-width': function(element) { + var bWidth = this.get('border-box-width'), + mLeft = this.get('margin-left'), + mRight = this.get('margin-right'); + + if (bWidth <= 0) return 0; + + return bWidth + mLeft + mRight; + }, + + 'top': function(element) { + var offset = element.positionedOffset(); + return offset.top; + }, + + 'bottom': function(element) { + var offset = element.positionedOffset(), + parent = element.getOffsetParent(), + pHeight = parent.measure('height'); + + var mHeight = this.get('border-box-height'); + + return pHeight - mHeight - offset.top; + }, + + 'left': function(element) { + var offset = element.positionedOffset(); + return offset.left; + }, + + 'right': function(element) { + var offset = element.positionedOffset(), + parent = element.getOffsetParent(), + pWidth = parent.measure('width'); + + var mWidth = this.get('border-box-width'); + + return pWidth - mWidth - offset.left; + }, + + 'padding-top': function(element) { + return getPixelValue(element, 'paddingTop'); + }, + + 'padding-bottom': function(element) { + return getPixelValue(element, 'paddingBottom'); + }, + + 'padding-left': function(element) { + return getPixelValue(element, 'paddingLeft'); + }, + + 'padding-right': function(element) { + return getPixelValue(element, 'paddingRight'); + }, + + 'border-top': function(element) { + return getPixelValue(element, 'borderTopWidth'); + }, + + 'border-bottom': function(element) { + return getPixelValue(element, 'borderBottomWidth'); + }, + + 'border-left': function(element) { + return getPixelValue(element, 'borderLeftWidth'); + }, + + 'border-right': function(element) { + return getPixelValue(element, 'borderRightWidth'); + }, + + 'margin-top': function(element) { + return getPixelValue(element, 'marginTop'); + }, + + 'margin-bottom': function(element) { + return getPixelValue(element, 'marginBottom'); + }, + + 'margin-left': function(element) { + return getPixelValue(element, 'marginLeft'); + }, + + 'margin-right': function(element) { + return getPixelValue(element, 'marginRight'); + } + } + }); + + if ('getBoundingClientRect' in document.documentElement) { + Object.extend(Element.Layout.COMPUTATIONS, { + 'right': function(element) { + var parent = hasLayout(element.getOffsetParent()); + var rect = element.getBoundingClientRect(), + pRect = parent.getBoundingClientRect(); + + return (pRect.right - rect.right).round(); + }, + + 'bottom': function(element) { + var parent = hasLayout(element.getOffsetParent()); + var rect = element.getBoundingClientRect(), + pRect = parent.getBoundingClientRect(); + + return (pRect.bottom - rect.bottom).round(); + } + }); + } + + Element.Offset = Class.create({ + initialize: function(left, top) { + this.left = left.round(); + this.top = top.round(); + + this[0] = this.left; + this[1] = this.top; + }, + + relativeTo: function(offset) { + return new Element.Offset( + this.left - offset.left, + this.top - offset.top + ); + }, + + inspect: function() { + return "#".interpolate(this); + }, + + toString: function() { + return "[#{left}, #{top}]".interpolate(this); + }, + + toArray: function() { + return [this.left, this.top]; + } + }); + + function getLayout(element, preCompute) { + return new Element.Layout(element, preCompute); + } + + function measure(element, property) { + return $(element).getLayout().get(property); + } + + function getDimensions(element) { + element = $(element); + var display = Element.getStyle(element, 'display'); + + if (display && display !== 'none') { + return { width: element.offsetWidth, height: element.offsetHeight }; + } + + var style = element.style; + var originalStyles = { + visibility: style.visibility, + position: style.position, + display: style.display + }; + + var newStyles = { + visibility: 'hidden', + display: 'block' + }; + + if (originalStyles.position !== 'fixed') + newStyles.position = 'absolute'; + + Element.setStyle(element, newStyles); + + var dimensions = { + width: element.offsetWidth, + height: element.offsetHeight + }; + + Element.setStyle(element, originalStyles); + + return dimensions; + } + + function getOffsetParent(element) { + element = $(element); + + if (isDocument(element) || isDetached(element) || isBody(element) || isHtml(element)) + return $(document.body); + + var isInline = (Element.getStyle(element, 'display') === 'inline'); + if (!isInline && element.offsetParent) return $(element.offsetParent); + + while ((element = element.parentNode) && element !== document.body) { + if (Element.getStyle(element, 'position') !== 'static') { + return isHtml(element) ? $(document.body) : $(element); + } + } + + return $(document.body); + } + + + function cumulativeOffset(element) { + element = $(element); + var valueT = 0, valueL = 0; + if (element.parentNode) { + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + element = element.offsetParent; + } while (element); + } + return new Element.Offset(valueL, valueT); + } + + function positionedOffset(element) { + element = $(element); + + var layout = element.getLayout(); + + var valueT = 0, valueL = 0; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + element = element.offsetParent; + if (element) { + if (isBody(element)) break; + var p = Element.getStyle(element, 'position'); + if (p !== 'static') break; + } + } while (element); + + valueL -= layout.get('margin-top'); + valueT -= layout.get('margin-left'); + + return new Element.Offset(valueL, valueT); + } + + function cumulativeScrollOffset(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.scrollTop || 0; + valueL += element.scrollLeft || 0; + element = element.parentNode; + } while (element); + return new Element.Offset(valueL, valueT); + } + + function viewportOffset(forElement) { + element = $(element); + var valueT = 0, valueL = 0, docBody = document.body; + + var element = forElement; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + if (element.offsetParent == docBody && + Element.getStyle(element, 'position') == 'absolute') break; + } while (element = element.offsetParent); + + element = forElement; + do { + if (element != docBody) { + valueT -= element.scrollTop || 0; + valueL -= element.scrollLeft || 0; + } + } while (element = element.parentNode); + return new Element.Offset(valueL, valueT); + } + + function absolutize(element) { + element = $(element); + + if (Element.getStyle(element, 'position') === 'absolute') { + return element; + } + + var offsetParent = getOffsetParent(element); + var eOffset = element.viewportOffset(), + pOffset = offsetParent.viewportOffset(); + + var offset = eOffset.relativeTo(pOffset); + var layout = element.getLayout(); + + element.store('prototype_absolutize_original_styles', { + left: element.getStyle('left'), + top: element.getStyle('top'), + width: element.getStyle('width'), + height: element.getStyle('height') + }); + + element.setStyle({ + position: 'absolute', + top: offset.top + 'px', + left: offset.left + 'px', + width: layout.get('width') + 'px', + height: layout.get('height') + 'px' + }); + + return element; + } + + function relativize(element) { + element = $(element); + if (Element.getStyle(element, 'position') === 'relative') { + return element; + } + + var originalStyles = + element.retrieve('prototype_absolutize_original_styles'); + + if (originalStyles) element.setStyle(originalStyles); + return element; + } + + if (Prototype.Browser.IE) { + getOffsetParent = getOffsetParent.wrap( + function(proceed, element) { + element = $(element); + + if (isDocument(element) || isDetached(element) || isBody(element) || isHtml(element)) + return $(document.body); + + var position = element.getStyle('position'); + if (position !== 'static') return proceed(element); + + element.setStyle({ position: 'relative' }); + var value = proceed(element); + element.setStyle({ position: position }); + return value; + } + ); + + positionedOffset = positionedOffset.wrap(function(proceed, element) { + element = $(element); + if (!element.parentNode) return new Element.Offset(0, 0); + var position = element.getStyle('position'); + if (position !== 'static') return proceed(element); + + var offsetParent = element.getOffsetParent(); + if (offsetParent && offsetParent.getStyle('position') === 'fixed') + hasLayout(offsetParent); + + element.setStyle({ position: 'relative' }); + var value = proceed(element); + element.setStyle({ position: position }); + return value; + }); + } else if (Prototype.Browser.Webkit) { + cumulativeOffset = function(element) { + element = $(element); + var valueT = 0, valueL = 0; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + if (element.offsetParent == document.body) + if (Element.getStyle(element, 'position') == 'absolute') break; + + element = element.offsetParent; + } while (element); + + return new Element.Offset(valueL, valueT); + }; + } + + + Element.addMethods({ + getLayout: getLayout, + measure: measure, + getDimensions: getDimensions, + getOffsetParent: getOffsetParent, + cumulativeOffset: cumulativeOffset, + positionedOffset: positionedOffset, + cumulativeScrollOffset: cumulativeScrollOffset, + viewportOffset: viewportOffset, + absolutize: absolutize, + relativize: relativize + }); + + function isBody(element) { + return element.nodeName.toUpperCase() === 'BODY'; + } + + function isHtml(element) { + return element.nodeName.toUpperCase() === 'HTML'; + } + + function isDocument(element) { + return element.nodeType === Node.DOCUMENT_NODE; + } + + function isDetached(element) { + return element !== document.body && + !Element.descendantOf(element, document.body); + } + + if ('getBoundingClientRect' in document.documentElement) { + Element.addMethods({ + viewportOffset: function(element) { + element = $(element); + if (isDetached(element)) return new Element.Offset(0, 0); + + var rect = element.getBoundingClientRect(), + docEl = document.documentElement; + return new Element.Offset(rect.left - docEl.clientLeft, + rect.top - docEl.clientTop); + } + }); + } +})(); +window.$$ = function() { + var expression = $A(arguments).join(', '); + return Prototype.Selector.select(expression, document); +}; + +Prototype.Selector = (function() { + + function select() { + throw new Error('Method "Prototype.Selector.select" must be defined.'); + } + + function match() { + throw new Error('Method "Prototype.Selector.match" must be defined.'); + } + + function find(elements, expression, index) { + index = index || 0; + var match = Prototype.Selector.match, length = elements.length, matchIndex = 0, i; + + for (i = 0; i < length; i++) { + if (match(elements[i], expression) && index == matchIndex++) { + return Element.extend(elements[i]); + } + } + } + + function extendElements(elements) { + for (var i = 0, length = elements.length; i < length; i++) { + Element.extend(elements[i]); + } + return elements; + } + + + var K = Prototype.K; + + return { + select: select, + match: match, + find: find, + extendElements: (Element.extend === K) ? K : extendElements, + extendElement: Element.extend + }; +})(); +Prototype._original_property = window.Sizzle; +/*! + * Sizzle CSS Selector Engine - v1.0 + * Copyright 2009, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){ + +var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, + done = 0, + toString = Object.prototype.toString, + hasDuplicate = false, + baseHasDuplicate = true; + +[0, 0].sort(function(){ + baseHasDuplicate = false; + return 0; +}); + +var Sizzle = function(selector, context, results, seed) { + results = results || []; + var origContext = context = context || document; + + if ( context.nodeType !== 1 && context.nodeType !== 9 ) { + return []; + } + + if ( !selector || typeof selector !== "string" ) { + return results; + } + + var parts = [], m, set, checkSet, check, mode, extra, prune = true, contextXML = isXML(context), + soFar = selector; + + while ( (chunker.exec(""), m = chunker.exec(soFar)) !== null ) { + soFar = m[3]; + + parts.push( m[1] ); + + if ( m[2] ) { + extra = m[3]; + break; + } + } + + if ( parts.length > 1 && origPOS.exec( selector ) ) { + if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { + set = posProcess( parts[0] + parts[1], context ); + } else { + set = Expr.relative[ parts[0] ] ? + [ context ] : + Sizzle( parts.shift(), context ); + + while ( parts.length ) { + selector = parts.shift(); + + if ( Expr.relative[ selector ] ) + selector += parts.shift(); + + set = posProcess( selector, set ); + } + } + } else { + if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && + Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { + var ret = Sizzle.find( parts.shift(), context, contextXML ); + context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0]; + } + + if ( context ) { + var ret = seed ? + { expr: parts.pop(), set: makeArray(seed) } : + Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); + set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set; + + if ( parts.length > 0 ) { + checkSet = makeArray(set); + } else { + prune = false; + } + + while ( parts.length ) { + var cur = parts.pop(), pop = cur; + + if ( !Expr.relative[ cur ] ) { + cur = ""; + } else { + pop = parts.pop(); + } + + if ( pop == null ) { + pop = context; + } + + Expr.relative[ cur ]( checkSet, pop, contextXML ); + } + } else { + checkSet = parts = []; + } + } + + if ( !checkSet ) { + checkSet = set; + } + + if ( !checkSet ) { + throw "Syntax error, unrecognized expression: " + (cur || selector); + } + + if ( toString.call(checkSet) === "[object Array]" ) { + if ( !prune ) { + results.push.apply( results, checkSet ); + } else if ( context && context.nodeType === 1 ) { + for ( var i = 0; checkSet[i] != null; i++ ) { + if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) { + results.push( set[i] ); + } + } + } else { + for ( var i = 0; checkSet[i] != null; i++ ) { + if ( checkSet[i] && checkSet[i].nodeType === 1 ) { + results.push( set[i] ); + } + } + } + } else { + makeArray( checkSet, results ); + } + + if ( extra ) { + Sizzle( extra, origContext, results, seed ); + Sizzle.uniqueSort( results ); + } + + return results; +}; + +Sizzle.uniqueSort = function(results){ + if ( sortOrder ) { + hasDuplicate = baseHasDuplicate; + results.sort(sortOrder); + + if ( hasDuplicate ) { + for ( var i = 1; i < results.length; i++ ) { + if ( results[i] === results[i-1] ) { + results.splice(i--, 1); + } + } + } + } + + return results; +}; + +Sizzle.matches = function(expr, set){ + return Sizzle(expr, null, null, set); +}; + +Sizzle.find = function(expr, context, isXML){ + var set, match; + + if ( !expr ) { + return []; + } + + for ( var i = 0, l = Expr.order.length; i < l; i++ ) { + var type = Expr.order[i], match; + + if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { + var left = match[1]; + match.splice(1,1); + + if ( left.substr( left.length - 1 ) !== "\\" ) { + match[1] = (match[1] || "").replace(/\\/g, ""); + set = Expr.find[ type ]( match, context, isXML ); + if ( set != null ) { + expr = expr.replace( Expr.match[ type ], "" ); + break; + } + } + } + } + + if ( !set ) { + set = context.getElementsByTagName("*"); + } + + return {set: set, expr: expr}; +}; + +Sizzle.filter = function(expr, set, inplace, not){ + var old = expr, result = [], curLoop = set, match, anyFound, + isXMLFilter = set && set[0] && isXML(set[0]); + + while ( expr && set.length ) { + for ( var type in Expr.filter ) { + if ( (match = Expr.match[ type ].exec( expr )) != null ) { + var filter = Expr.filter[ type ], found, item; + anyFound = false; + + if ( curLoop == result ) { + result = []; + } + + if ( Expr.preFilter[ type ] ) { + match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); + + if ( !match ) { + anyFound = found = true; + } else if ( match === true ) { + continue; + } + } + + if ( match ) { + for ( var i = 0; (item = curLoop[i]) != null; i++ ) { + if ( item ) { + found = filter( item, match, i, curLoop ); + var pass = not ^ !!found; + + if ( inplace && found != null ) { + if ( pass ) { + anyFound = true; + } else { + curLoop[i] = false; + } + } else if ( pass ) { + result.push( item ); + anyFound = true; + } + } + } + } + + if ( found !== undefined ) { + if ( !inplace ) { + curLoop = result; + } + + expr = expr.replace( Expr.match[ type ], "" ); + + if ( !anyFound ) { + return []; + } + + break; + } + } + } + + if ( expr == old ) { + if ( anyFound == null ) { + throw "Syntax error, unrecognized expression: " + expr; + } else { + break; + } + } + + old = expr; + } + + return curLoop; +}; + +var Expr = Sizzle.selectors = { + order: [ "ID", "NAME", "TAG" ], + match: { + ID: /#((?:[\w\u00c0-\uFFFF-]|\\.)+)/, + CLASS: /\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/, + NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/, + ATTR: /\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, + TAG: /^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/, + CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/, + POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/, + PSEUDO: /:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/ + }, + leftMatch: {}, + attrMap: { + "class": "className", + "for": "htmlFor" + }, + attrHandle: { + href: function(elem){ + return elem.getAttribute("href"); + } + }, + relative: { + "+": function(checkSet, part, isXML){ + var isPartStr = typeof part === "string", + isTag = isPartStr && !/\W/.test(part), + isPartStrNotTag = isPartStr && !isTag; + + if ( isTag && !isXML ) { + part = part.toUpperCase(); + } + + for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { + if ( (elem = checkSet[i]) ) { + while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} + + checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ? + elem || false : + elem === part; + } + } + + if ( isPartStrNotTag ) { + Sizzle.filter( part, checkSet, true ); + } + }, + ">": function(checkSet, part, isXML){ + var isPartStr = typeof part === "string"; + + if ( isPartStr && !/\W/.test(part) ) { + part = isXML ? part : part.toUpperCase(); + + for ( var i = 0, l = checkSet.length; i < l; i++ ) { + var elem = checkSet[i]; + if ( elem ) { + var parent = elem.parentNode; + checkSet[i] = parent.nodeName === part ? parent : false; + } + } + } else { + for ( var i = 0, l = checkSet.length; i < l; i++ ) { + var elem = checkSet[i]; + if ( elem ) { + checkSet[i] = isPartStr ? + elem.parentNode : + elem.parentNode === part; + } + } + + if ( isPartStr ) { + Sizzle.filter( part, checkSet, true ); + } + } + }, + "": function(checkSet, part, isXML){ + var doneName = done++, checkFn = dirCheck; + + if ( !/\W/.test(part) ) { + var nodeCheck = part = isXML ? part : part.toUpperCase(); + checkFn = dirNodeCheck; + } + + checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML); + }, + "~": function(checkSet, part, isXML){ + var doneName = done++, checkFn = dirCheck; + + if ( typeof part === "string" && !/\W/.test(part) ) { + var nodeCheck = part = isXML ? part : part.toUpperCase(); + checkFn = dirNodeCheck; + } + + checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML); + } + }, + find: { + ID: function(match, context, isXML){ + if ( typeof context.getElementById !== "undefined" && !isXML ) { + var m = context.getElementById(match[1]); + return m ? [m] : []; + } + }, + NAME: function(match, context, isXML){ + if ( typeof context.getElementsByName !== "undefined" ) { + var ret = [], results = context.getElementsByName(match[1]); + + for ( var i = 0, l = results.length; i < l; i++ ) { + if ( results[i].getAttribute("name") === match[1] ) { + ret.push( results[i] ); + } + } + + return ret.length === 0 ? null : ret; + } + }, + TAG: function(match, context){ + return context.getElementsByTagName(match[1]); + } + }, + preFilter: { + CLASS: function(match, curLoop, inplace, result, not, isXML){ + match = " " + match[1].replace(/\\/g, "") + " "; + + if ( isXML ) { + return match; + } + + for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { + if ( elem ) { + if ( not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0) ) { + if ( !inplace ) + result.push( elem ); + } else if ( inplace ) { + curLoop[i] = false; + } + } + } + + return false; + }, + ID: function(match){ + return match[1].replace(/\\/g, ""); + }, + TAG: function(match, curLoop){ + for ( var i = 0; curLoop[i] === false; i++ ){} + return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase(); + }, + CHILD: function(match){ + if ( match[1] == "nth" ) { + var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( + match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" || + !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); + + match[2] = (test[1] + (test[2] || 1)) - 0; + match[3] = test[3] - 0; + } + + match[0] = done++; + + return match; + }, + ATTR: function(match, curLoop, inplace, result, not, isXML){ + var name = match[1].replace(/\\/g, ""); + + if ( !isXML && Expr.attrMap[name] ) { + match[1] = Expr.attrMap[name]; + } + + if ( match[2] === "~=" ) { + match[4] = " " + match[4] + " "; + } + + return match; + }, + PSEUDO: function(match, curLoop, inplace, result, not){ + if ( match[1] === "not" ) { + if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { + match[3] = Sizzle(match[3], null, null, curLoop); + } else { + var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); + if ( !inplace ) { + result.push.apply( result, ret ); + } + return false; + } + } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { + return true; + } + + return match; + }, + POS: function(match){ + match.unshift( true ); + return match; + } + }, + filters: { + enabled: function(elem){ + return elem.disabled === false && elem.type !== "hidden"; + }, + disabled: function(elem){ + return elem.disabled === true; + }, + checked: function(elem){ + return elem.checked === true; + }, + selected: function(elem){ + elem.parentNode.selectedIndex; + return elem.selected === true; + }, + parent: function(elem){ + return !!elem.firstChild; + }, + empty: function(elem){ + return !elem.firstChild; + }, + has: function(elem, i, match){ + return !!Sizzle( match[3], elem ).length; + }, + header: function(elem){ + return /h\d/i.test( elem.nodeName ); + }, + text: function(elem){ + return "text" === elem.type; + }, + radio: function(elem){ + return "radio" === elem.type; + }, + checkbox: function(elem){ + return "checkbox" === elem.type; + }, + file: function(elem){ + return "file" === elem.type; + }, + password: function(elem){ + return "password" === elem.type; + }, + submit: function(elem){ + return "submit" === elem.type; + }, + image: function(elem){ + return "image" === elem.type; + }, + reset: function(elem){ + return "reset" === elem.type; + }, + button: function(elem){ + return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON"; + }, + input: function(elem){ + return /input|select|textarea|button/i.test(elem.nodeName); + } + }, + setFilters: { + first: function(elem, i){ + return i === 0; + }, + last: function(elem, i, match, array){ + return i === array.length - 1; + }, + even: function(elem, i){ + return i % 2 === 0; + }, + odd: function(elem, i){ + return i % 2 === 1; + }, + lt: function(elem, i, match){ + return i < match[3] - 0; + }, + gt: function(elem, i, match){ + return i > match[3] - 0; + }, + nth: function(elem, i, match){ + return match[3] - 0 == i; + }, + eq: function(elem, i, match){ + return match[3] - 0 == i; + } + }, + filter: { + PSEUDO: function(elem, match, i, array){ + var name = match[1], filter = Expr.filters[ name ]; + + if ( filter ) { + return filter( elem, i, match, array ); + } else if ( name === "contains" ) { + return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0; + } else if ( name === "not" ) { + var not = match[3]; + + for ( var i = 0, l = not.length; i < l; i++ ) { + if ( not[i] === elem ) { + return false; + } + } + + return true; + } + }, + CHILD: function(elem, match){ + var type = match[1], node = elem; + switch (type) { + case 'only': + case 'first': + while ( (node = node.previousSibling) ) { + if ( node.nodeType === 1 ) return false; + } + if ( type == 'first') return true; + node = elem; + case 'last': + while ( (node = node.nextSibling) ) { + if ( node.nodeType === 1 ) return false; + } + return true; + case 'nth': + var first = match[2], last = match[3]; + + if ( first == 1 && last == 0 ) { + return true; + } + + var doneName = match[0], + parent = elem.parentNode; + + if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { + var count = 0; + for ( node = parent.firstChild; node; node = node.nextSibling ) { + if ( node.nodeType === 1 ) { + node.nodeIndex = ++count; + } + } + parent.sizcache = doneName; + } + + var diff = elem.nodeIndex - last; + if ( first == 0 ) { + return diff == 0; + } else { + return ( diff % first == 0 && diff / first >= 0 ); + } + } + }, + ID: function(elem, match){ + return elem.nodeType === 1 && elem.getAttribute("id") === match; + }, + TAG: function(elem, match){ + return (match === "*" && elem.nodeType === 1) || elem.nodeName === match; + }, + CLASS: function(elem, match){ + return (" " + (elem.className || elem.getAttribute("class")) + " ") + .indexOf( match ) > -1; + }, + ATTR: function(elem, match){ + var name = match[1], + result = Expr.attrHandle[ name ] ? + Expr.attrHandle[ name ]( elem ) : + elem[ name ] != null ? + elem[ name ] : + elem.getAttribute( name ), + value = result + "", + type = match[2], + check = match[4]; + + return result == null ? + type === "!=" : + type === "=" ? + value === check : + type === "*=" ? + value.indexOf(check) >= 0 : + type === "~=" ? + (" " + value + " ").indexOf(check) >= 0 : + !check ? + value && result !== false : + type === "!=" ? + value != check : + type === "^=" ? + value.indexOf(check) === 0 : + type === "$=" ? + value.substr(value.length - check.length) === check : + type === "|=" ? + value === check || value.substr(0, check.length + 1) === check + "-" : + false; + }, + POS: function(elem, match, i, array){ + var name = match[2], filter = Expr.setFilters[ name ]; + + if ( filter ) { + return filter( elem, i, match, array ); + } + } + } +}; + +var origPOS = Expr.match.POS; + +for ( var type in Expr.match ) { + Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source ); + Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source ); +} + +var makeArray = function(array, results) { + array = Array.prototype.slice.call( array, 0 ); + + if ( results ) { + results.push.apply( results, array ); + return results; + } + + return array; +}; + +try { + Array.prototype.slice.call( document.documentElement.childNodes, 0 ); + +} catch(e){ + makeArray = function(array, results) { + var ret = results || []; + + if ( toString.call(array) === "[object Array]" ) { + Array.prototype.push.apply( ret, array ); + } else { + if ( typeof array.length === "number" ) { + for ( var i = 0, l = array.length; i < l; i++ ) { + ret.push( array[i] ); + } + } else { + for ( var i = 0; array[i]; i++ ) { + ret.push( array[i] ); + } + } + } + + return ret; + }; +} + +var sortOrder; + +if ( document.documentElement.compareDocumentPosition ) { + sortOrder = function( a, b ) { + if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { + if ( a == b ) { + hasDuplicate = true; + } + return 0; + } + + var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1; + if ( ret === 0 ) { + hasDuplicate = true; + } + return ret; + }; +} else if ( "sourceIndex" in document.documentElement ) { + sortOrder = function( a, b ) { + if ( !a.sourceIndex || !b.sourceIndex ) { + if ( a == b ) { + hasDuplicate = true; + } + return 0; + } + + var ret = a.sourceIndex - b.sourceIndex; + if ( ret === 0 ) { + hasDuplicate = true; + } + return ret; + }; +} else if ( document.createRange ) { + sortOrder = function( a, b ) { + if ( !a.ownerDocument || !b.ownerDocument ) { + if ( a == b ) { + hasDuplicate = true; + } + return 0; + } + + var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange(); + aRange.setStart(a, 0); + aRange.setEnd(a, 0); + bRange.setStart(b, 0); + bRange.setEnd(b, 0); + var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange); + if ( ret === 0 ) { + hasDuplicate = true; + } + return ret; + }; +} + +(function(){ + var form = document.createElement("div"), + id = "script" + (new Date).getTime(); + form.innerHTML = ""; + + var root = document.documentElement; + root.insertBefore( form, root.firstChild ); + + if ( !!document.getElementById( id ) ) { + Expr.find.ID = function(match, context, isXML){ + if ( typeof context.getElementById !== "undefined" && !isXML ) { + var m = context.getElementById(match[1]); + return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : []; + } + }; + + Expr.filter.ID = function(elem, match){ + var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); + return elem.nodeType === 1 && node && node.nodeValue === match; + }; + } + + root.removeChild( form ); + root = form = null; // release memory in IE +})(); + +(function(){ + + var div = document.createElement("div"); + div.appendChild( document.createComment("") ); + + if ( div.getElementsByTagName("*").length > 0 ) { + Expr.find.TAG = function(match, context){ + var results = context.getElementsByTagName(match[1]); + + if ( match[1] === "*" ) { + var tmp = []; + + for ( var i = 0; results[i]; i++ ) { + if ( results[i].nodeType === 1 ) { + tmp.push( results[i] ); + } + } + + results = tmp; + } + + return results; + }; + } + + div.innerHTML = ""; + if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && + div.firstChild.getAttribute("href") !== "#" ) { + Expr.attrHandle.href = function(elem){ + return elem.getAttribute("href", 2); + }; + } + + div = null; // release memory in IE +})(); + +if ( document.querySelectorAll ) (function(){ + var oldSizzle = Sizzle, div = document.createElement("div"); + div.innerHTML = "

"; + + if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { + return; + } + + Sizzle = function(query, context, extra, seed){ + context = context || document; + + if ( !seed && context.nodeType === 9 && !isXML(context) ) { + try { + return makeArray( context.querySelectorAll(query), extra ); + } catch(e){} + } + + return oldSizzle(query, context, extra, seed); + }; + + for ( var prop in oldSizzle ) { + Sizzle[ prop ] = oldSizzle[ prop ]; + } + + div = null; // release memory in IE +})(); + +if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){ + var div = document.createElement("div"); + div.innerHTML = "
"; + + if ( div.getElementsByClassName("e").length === 0 ) + return; + + div.lastChild.className = "e"; + + if ( div.getElementsByClassName("e").length === 1 ) + return; + + Expr.order.splice(1, 0, "CLASS"); + Expr.find.CLASS = function(match, context, isXML) { + if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { + return context.getElementsByClassName(match[1]); + } + }; + + div = null; // release memory in IE +})(); + +function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { + var sibDir = dir == "previousSibling" && !isXML; + for ( var i = 0, l = checkSet.length; i < l; i++ ) { + var elem = checkSet[i]; + if ( elem ) { + if ( sibDir && elem.nodeType === 1 ){ + elem.sizcache = doneName; + elem.sizset = i; + } + elem = elem[dir]; + var match = false; + + while ( elem ) { + if ( elem.sizcache === doneName ) { + match = checkSet[elem.sizset]; + break; + } + + if ( elem.nodeType === 1 && !isXML ){ + elem.sizcache = doneName; + elem.sizset = i; + } + + if ( elem.nodeName === cur ) { + match = elem; + break; + } + + elem = elem[dir]; + } + + checkSet[i] = match; + } + } +} + +function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { + var sibDir = dir == "previousSibling" && !isXML; + for ( var i = 0, l = checkSet.length; i < l; i++ ) { + var elem = checkSet[i]; + if ( elem ) { + if ( sibDir && elem.nodeType === 1 ) { + elem.sizcache = doneName; + elem.sizset = i; + } + elem = elem[dir]; + var match = false; + + while ( elem ) { + if ( elem.sizcache === doneName ) { + match = checkSet[elem.sizset]; + break; + } + + if ( elem.nodeType === 1 ) { + if ( !isXML ) { + elem.sizcache = doneName; + elem.sizset = i; + } + if ( typeof cur !== "string" ) { + if ( elem === cur ) { + match = true; + break; + } + + } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { + match = elem; + break; + } + } + + elem = elem[dir]; + } + + checkSet[i] = match; + } + } +} + +var contains = document.compareDocumentPosition ? function(a, b){ + return a.compareDocumentPosition(b) & 16; +} : function(a, b){ + return a !== b && (a.contains ? a.contains(b) : true); +}; + +var isXML = function(elem){ + return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" || + !!elem.ownerDocument && elem.ownerDocument.documentElement.nodeName !== "HTML"; +}; + +var posProcess = function(selector, context){ + var tmpSet = [], later = "", match, + root = context.nodeType ? [context] : context; + + while ( (match = Expr.match.PSEUDO.exec( selector )) ) { + later += match[0]; + selector = selector.replace( Expr.match.PSEUDO, "" ); + } + + selector = Expr.relative[selector] ? selector + "*" : selector; + + for ( var i = 0, l = root.length; i < l; i++ ) { + Sizzle( selector, root[i], tmpSet ); + } + + return Sizzle.filter( later, tmpSet ); +}; + + +window.Sizzle = Sizzle; + +})(); + +;(function(engine) { + var extendElements = Prototype.Selector.extendElements; + + function select(selector, scope) { + return extendElements(engine(selector, scope || document)); + } + + function match(element, selector) { + return engine.matches(selector, [element]).length == 1; + } + + Prototype.Selector.engine = engine; + Prototype.Selector.select = select; + Prototype.Selector.match = match; +})(Sizzle); + +window.Sizzle = Prototype._original_property; +delete Prototype._original_property; + +var Form = { + reset: function(form) { + form = $(form); + form.reset(); + return form; + }, + + serializeElements: function(elements, options) { + if (typeof options != 'object') options = { hash: !!options }; + else if (Object.isUndefined(options.hash)) options.hash = true; + var key, value, submitted = false, submit = options.submit, accumulator, initial; + + if (options.hash) { + initial = {}; + accumulator = function(result, key, value) { + if (key in result) { + if (!Object.isArray(result[key])) result[key] = [result[key]]; + result[key].push(value); + } else result[key] = value; + return result; + }; + } else { + initial = ''; + accumulator = function(result, key, value) { + return result + (result ? '&' : '') + encodeURIComponent(key) + '=' + encodeURIComponent(value); + } + } + + return elements.inject(initial, function(result, element) { + if (!element.disabled && element.name) { + key = element.name; value = $(element).getValue(); + if (value != null && element.type != 'file' && (element.type != 'submit' || (!submitted && + submit !== false && (!submit || key == submit) && (submitted = true)))) { + result = accumulator(result, key, value); + } + } + return result; + }); + } +}; + +Form.Methods = { + serialize: function(form, options) { + return Form.serializeElements(Form.getElements(form), options); + }, + + getElements: function(form) { + var elements = $(form).getElementsByTagName('*'), + element, + arr = [ ], + serializers = Form.Element.Serializers; + for (var i = 0; element = elements[i]; i++) { + arr.push(element); + } + return arr.inject([], function(elements, child) { + if (serializers[child.tagName.toLowerCase()]) + elements.push(Element.extend(child)); + return elements; + }) + }, + + getInputs: function(form, typeName, name) { + form = $(form); + var inputs = form.getElementsByTagName('input'); + + if (!typeName && !name) return $A(inputs).map(Element.extend); + + for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) { + var input = inputs[i]; + if ((typeName && input.type != typeName) || (name && input.name != name)) + continue; + matchingInputs.push(Element.extend(input)); + } + + return matchingInputs; + }, + + disable: function(form) { + form = $(form); + Form.getElements(form).invoke('disable'); + return form; + }, + + enable: function(form) { + form = $(form); + Form.getElements(form).invoke('enable'); + return form; + }, + + findFirstElement: function(form) { + var elements = $(form).getElements().findAll(function(element) { + return 'hidden' != element.type && !element.disabled; + }); + var firstByIndex = elements.findAll(function(element) { + return element.hasAttribute('tabIndex') && element.tabIndex >= 0; + }).sortBy(function(element) { return element.tabIndex }).first(); + + return firstByIndex ? firstByIndex : elements.find(function(element) { + return /^(?:input|select|textarea)$/i.test(element.tagName); + }); + }, + + focusFirstElement: function(form) { + form = $(form); + var element = form.findFirstElement(); + if (element) element.activate(); + return form; + }, + + request: function(form, options) { + form = $(form), options = Object.clone(options || { }); + + var params = options.parameters, action = form.readAttribute('action') || ''; + if (action.blank()) action = window.location.href; + options.parameters = form.serialize(true); + + if (params) { + if (Object.isString(params)) params = params.toQueryParams(); + Object.extend(options.parameters, params); + } + + if (form.hasAttribute('method') && !options.method) + options.method = form.method; + + return new Ajax.Request(action, options); + } +}; + +/*--------------------------------------------------------------------------*/ + + +Form.Element = { + focus: function(element) { + $(element).focus(); + return element; + }, + + select: function(element) { + $(element).select(); + return element; + } +}; + +Form.Element.Methods = { + + serialize: function(element) { + element = $(element); + if (!element.disabled && element.name) { + var value = element.getValue(); + if (value != undefined) { + var pair = { }; + pair[element.name] = value; + return Object.toQueryString(pair); + } + } + return ''; + }, + + getValue: function(element) { + element = $(element); + var method = element.tagName.toLowerCase(); + return Form.Element.Serializers[method](element); + }, + + setValue: function(element, value) { + element = $(element); + var method = element.tagName.toLowerCase(); + Form.Element.Serializers[method](element, value); + return element; + }, + + clear: function(element) { + $(element).value = ''; + return element; + }, + + present: function(element) { + return $(element).value != ''; + }, + + activate: function(element) { + element = $(element); + try { + element.focus(); + if (element.select && (element.tagName.toLowerCase() != 'input' || + !(/^(?:button|reset|submit)$/i.test(element.type)))) + element.select(); + } catch (e) { } + return element; + }, + + disable: function(element) { + element = $(element); + element.disabled = true; + return element; + }, + + enable: function(element) { + element = $(element); + element.disabled = false; + return element; + } +}; + +/*--------------------------------------------------------------------------*/ + +var Field = Form.Element; + +var $F = Form.Element.Methods.getValue; + +/*--------------------------------------------------------------------------*/ + +Form.Element.Serializers = (function() { + function input(element, value) { + switch (element.type.toLowerCase()) { + case 'checkbox': + case 'radio': + return inputSelector(element, value); + default: + return valueSelector(element, value); + } + } + + function inputSelector(element, value) { + if (Object.isUndefined(value)) + return element.checked ? element.value : null; + else element.checked = !!value; + } + + function valueSelector(element, value) { + if (Object.isUndefined(value)) return element.value; + else element.value = value; + } + + function select(element, value) { + if (Object.isUndefined(value)) + return (element.type === 'select-one' ? selectOne : selectMany)(element); + + var opt, currentValue, single = !Object.isArray(value); + for (var i = 0, length = element.length; i < length; i++) { + opt = element.options[i]; + currentValue = this.optionValue(opt); + if (single) { + if (currentValue == value) { + opt.selected = true; + return; + } + } + else opt.selected = value.include(currentValue); + } + } + + function selectOne(element) { + var index = element.selectedIndex; + return index >= 0 ? optionValue(element.options[index]) : null; + } + + function selectMany(element) { + var values, length = element.length; + if (!length) return null; + + for (var i = 0, values = []; i < length; i++) { + var opt = element.options[i]; + if (opt.selected) values.push(optionValue(opt)); + } + return values; + } + + function optionValue(opt) { + return Element.hasAttribute(opt, 'value') ? opt.value : opt.text; + } + + return { + input: input, + inputSelector: inputSelector, + textarea: valueSelector, + select: select, + selectOne: selectOne, + selectMany: selectMany, + optionValue: optionValue, + button: valueSelector + }; +})(); + +/*--------------------------------------------------------------------------*/ + + +Abstract.TimedObserver = Class.create(PeriodicalExecuter, { + initialize: function($super, element, frequency, callback) { + $super(callback, frequency); + this.element = $(element); + this.lastValue = this.getValue(); + }, + + execute: function() { + var value = this.getValue(); + if (Object.isString(this.lastValue) && Object.isString(value) ? + this.lastValue != value : String(this.lastValue) != String(value)) { + this.callback(this.element, value); + this.lastValue = value; + } + } +}); + +Form.Element.Observer = Class.create(Abstract.TimedObserver, { + getValue: function() { + return Form.Element.getValue(this.element); + } +}); + +Form.Observer = Class.create(Abstract.TimedObserver, { + getValue: function() { + return Form.serialize(this.element); + } +}); + +/*--------------------------------------------------------------------------*/ + +Abstract.EventObserver = Class.create({ + initialize: function(element, callback) { + this.element = $(element); + this.callback = callback; + + this.lastValue = this.getValue(); + if (this.element.tagName.toLowerCase() == 'form') + this.registerFormCallbacks(); + else + this.registerCallback(this.element); + }, + + onElementEvent: function() { + var value = this.getValue(); + if (this.lastValue != value) { + this.callback(this.element, value); + this.lastValue = value; + } + }, + + registerFormCallbacks: function() { + Form.getElements(this.element).each(this.registerCallback, this); + }, + + registerCallback: function(element) { + if (element.type) { + switch (element.type.toLowerCase()) { + case 'checkbox': + case 'radio': + Event.observe(element, 'click', this.onElementEvent.bind(this)); + break; + default: + Event.observe(element, 'change', this.onElementEvent.bind(this)); + break; + } + } + } +}); + +Form.Element.EventObserver = Class.create(Abstract.EventObserver, { + getValue: function() { + return Form.Element.getValue(this.element); + } +}); + +Form.EventObserver = Class.create(Abstract.EventObserver, { + getValue: function() { + return Form.serialize(this.element); + } +}); +(function() { + + var Event = { + KEY_BACKSPACE: 8, + KEY_TAB: 9, + KEY_RETURN: 13, + KEY_ESC: 27, + KEY_LEFT: 37, + KEY_UP: 38, + KEY_RIGHT: 39, + KEY_DOWN: 40, + KEY_DELETE: 46, + KEY_HOME: 36, + KEY_END: 35, + KEY_PAGEUP: 33, + KEY_PAGEDOWN: 34, + KEY_INSERT: 45, + + cache: {} + }; + + var docEl = document.documentElement; + var MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED = 'onmouseenter' in docEl + && 'onmouseleave' in docEl; + + + + var isIELegacyEvent = function(event) { return false; }; + + if (window.attachEvent) { + if (window.addEventListener) { + isIELegacyEvent = function(event) { + return !(event instanceof window.Event); + }; + } else { + isIELegacyEvent = function(event) { return true; }; + } + } + + var _isButton; + + function _isButtonForDOMEvents(event, code) { + return event.which ? (event.which === code + 1) : (event.button === code); + } + + var legacyButtonMap = { 0: 1, 1: 4, 2: 2 }; + function _isButtonForLegacyEvents(event, code) { + return event.button === legacyButtonMap[code]; + } + + function _isButtonForWebKit(event, code) { + switch (code) { + case 0: return event.which == 1 && !event.metaKey; + case 1: return event.which == 2 || (event.which == 1 && event.metaKey); + case 2: return event.which == 3; + default: return false; + } + } + + if (window.attachEvent) { + if (!window.addEventListener) { + _isButton = _isButtonForLegacyEvents; + } else { + _isButton = function(event, code) { + return isIELegacyEvent(event) ? _isButtonForLegacyEvents(event, code) : + _isButtonForDOMEvents(event, code); + } + } + } else if (Prototype.Browser.WebKit) { + _isButton = _isButtonForWebKit; + } else { + _isButton = _isButtonForDOMEvents; + } + + function isLeftClick(event) { return _isButton(event, 0) } + + function isMiddleClick(event) { return _isButton(event, 1) } + + function isRightClick(event) { return _isButton(event, 2) } + + function element(event) { + event = Event.extend(event); + + var node = event.target, type = event.type, + currentTarget = event.currentTarget; + + if (currentTarget && currentTarget.tagName) { + if (type === 'load' || type === 'error' || + (type === 'click' && currentTarget.tagName.toLowerCase() === 'input' + && currentTarget.type === 'radio')) + node = currentTarget; + } + + if (node.nodeType == Node.TEXT_NODE) + node = node.parentNode; + + return Element.extend(node); + } + + function findElement(event, expression) { + var element = Event.element(event); + + if (!expression) return element; + while (element) { + if (Object.isElement(element) && Prototype.Selector.match(element, expression)) { + return Element.extend(element); + } + element = element.parentNode; + } + } + + function pointer(event) { + return { x: pointerX(event), y: pointerY(event) }; + } + + function pointerX(event) { + var docElement = document.documentElement, + body = document.body || { scrollLeft: 0 }; + + return event.pageX || (event.clientX + + (docElement.scrollLeft || body.scrollLeft) - + (docElement.clientLeft || 0)); + } + + function pointerY(event) { + var docElement = document.documentElement, + body = document.body || { scrollTop: 0 }; + + return event.pageY || (event.clientY + + (docElement.scrollTop || body.scrollTop) - + (docElement.clientTop || 0)); + } + + + function stop(event) { + Event.extend(event); + event.preventDefault(); + event.stopPropagation(); + + event.stopped = true; + } + + + Event.Methods = { + isLeftClick: isLeftClick, + isMiddleClick: isMiddleClick, + isRightClick: isRightClick, + + element: element, + findElement: findElement, + + pointer: pointer, + pointerX: pointerX, + pointerY: pointerY, + + stop: stop + }; + + var methods = Object.keys(Event.Methods).inject({ }, function(m, name) { + m[name] = Event.Methods[name].methodize(); + return m; + }); + + if (window.attachEvent) { + function _relatedTarget(event) { + var element; + switch (event.type) { + case 'mouseover': + case 'mouseenter': + element = event.fromElement; + break; + case 'mouseout': + case 'mouseleave': + element = event.toElement; + break; + default: + return null; + } + return Element.extend(element); + } + + var additionalMethods = { + stopPropagation: function() { this.cancelBubble = true }, + preventDefault: function() { this.returnValue = false }, + inspect: function() { return '[object Event]' } + }; + + Event.extend = function(event, element) { + if (!event) return false; + + if (!isIELegacyEvent(event)) return event; + + if (event._extendedByPrototype) return event; + event._extendedByPrototype = Prototype.emptyFunction; + + var pointer = Event.pointer(event); + + Object.extend(event, { + target: event.srcElement || element, + relatedTarget: _relatedTarget(event), + pageX: pointer.x, + pageY: pointer.y + }); + + Object.extend(event, methods); + Object.extend(event, additionalMethods); + + return event; + }; + } else { + Event.extend = Prototype.K; + } + + if (window.addEventListener) { + Event.prototype = window.Event.prototype || document.createEvent('HTMLEvents').__proto__; + Object.extend(Event.prototype, methods); + } + + function _createResponder(element, eventName, handler) { + var registry = Element.retrieve(element, 'prototype_event_registry'); + + if (Object.isUndefined(registry)) { + CACHE.push(element); + registry = Element.retrieve(element, 'prototype_event_registry', $H()); + } + + var respondersForEvent = registry.get(eventName); + if (Object.isUndefined(respondersForEvent)) { + respondersForEvent = []; + registry.set(eventName, respondersForEvent); + } + + if (respondersForEvent.pluck('handler').include(handler)) return false; + + var responder; + if (eventName.include(":")) { + responder = function(event) { + if (Object.isUndefined(event.eventName)) + return false; + + if (event.eventName !== eventName) + return false; + + Event.extend(event, element); + handler.call(element, event); + }; + } else { + if (!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED && + (eventName === "mouseenter" || eventName === "mouseleave")) { + if (eventName === "mouseenter" || eventName === "mouseleave") { + responder = function(event) { + Event.extend(event, element); + + var parent = event.relatedTarget; + while (parent && parent !== element) { + try { parent = parent.parentNode; } + catch(e) { parent = element; } + } + + if (parent === element) return; + + handler.call(element, event); + }; + } + } else { + responder = function(event) { + Event.extend(event, element); + handler.call(element, event); + }; + } + } + + responder.handler = handler; + respondersForEvent.push(responder); + return responder; + } + + function _destroyCache() { + for (var i = 0, length = CACHE.length; i < length; i++) { + Event.stopObserving(CACHE[i]); + CACHE[i] = null; + } + } + + var CACHE = []; + + if (Prototype.Browser.IE) + window.attachEvent('onunload', _destroyCache); + + if (Prototype.Browser.WebKit) + window.addEventListener('unload', Prototype.emptyFunction, false); + + + var _getDOMEventName = Prototype.K, + translations = { mouseenter: "mouseover", mouseleave: "mouseout" }; + + if (!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED) { + _getDOMEventName = function(eventName) { + return (translations[eventName] || eventName); + }; + } + + function observe(element, eventName, handler) { + element = $(element); + + var responder = _createResponder(element, eventName, handler); + + if (!responder) return element; + + if (eventName.include(':')) { + if (element.addEventListener) + element.addEventListener("dataavailable", responder, false); + else { + element.attachEvent("ondataavailable", responder); + element.attachEvent("onlosecapture", responder); + } + } else { + var actualEventName = _getDOMEventName(eventName); + + if (element.addEventListener) + element.addEventListener(actualEventName, responder, false); + else + element.attachEvent("on" + actualEventName, responder); + } + + return element; + } + + function stopObserving(element, eventName, handler) { + element = $(element); + + var registry = Element.retrieve(element, 'prototype_event_registry'); + if (!registry) return element; + + if (!eventName) { + registry.each( function(pair) { + var eventName = pair.key; + stopObserving(element, eventName); + }); + return element; + } + + var responders = registry.get(eventName); + if (!responders) return element; + + if (!handler) { + responders.each(function(r) { + stopObserving(element, eventName, r.handler); + }); + return element; + } + + var i = responders.length, responder; + while (i--) { + if (responders[i].handler === handler) { + responder = responders[i]; + break; + } + } + if (!responder) return element; + + if (eventName.include(':')) { + if (element.removeEventListener) + element.removeEventListener("dataavailable", responder, false); + else { + element.detachEvent("ondataavailable", responder); + element.detachEvent("onlosecapture", responder); + } + } else { + var actualEventName = _getDOMEventName(eventName); + if (element.removeEventListener) + element.removeEventListener(actualEventName, responder, false); + else + element.detachEvent('on' + actualEventName, responder); + } + + registry.set(eventName, responders.without(responder)); + + return element; + } + + function fire(element, eventName, memo, bubble) { + element = $(element); + + if (Object.isUndefined(bubble)) + bubble = true; + + if (element == document && document.createEvent && !element.dispatchEvent) + element = document.documentElement; + + var event; + if (document.createEvent) { + event = document.createEvent('HTMLEvents'); + event.initEvent('dataavailable', bubble, true); + } else { + event = document.createEventObject(); + event.eventType = bubble ? 'ondataavailable' : 'onlosecapture'; + } + + event.eventName = eventName; + event.memo = memo || { }; + + if (document.createEvent) + element.dispatchEvent(event); + else + element.fireEvent(event.eventType, event); + + return Event.extend(event); + } + + Event.Handler = Class.create({ + initialize: function(element, eventName, selector, callback) { + this.element = $(element); + this.eventName = eventName; + this.selector = selector; + this.callback = callback; + this.handler = this.handleEvent.bind(this); + }, + + start: function() { + Event.observe(this.element, this.eventName, this.handler); + return this; + }, + + stop: function() { + Event.stopObserving(this.element, this.eventName, this.handler); + return this; + }, + + handleEvent: function(event) { + var element = Event.findElement(event, this.selector); + if (element) this.callback.call(this.element, event, element); + } + }); + + function on(element, eventName, selector, callback) { + element = $(element); + if (Object.isFunction(selector) && Object.isUndefined(callback)) { + callback = selector, selector = null; + } + + return new Event.Handler(element, eventName, selector, callback).start(); + } + + Object.extend(Event, Event.Methods); + + Object.extend(Event, { + fire: fire, + observe: observe, + stopObserving: stopObserving, + on: on + }); + + Element.addMethods({ + fire: fire, + + observe: observe, + + stopObserving: stopObserving, + + on: on + }); + + Object.extend(document, { + fire: fire.methodize(), + + observe: observe.methodize(), + + stopObserving: stopObserving.methodize(), + + on: on.methodize(), + + loaded: false + }); + + if (window.Event) Object.extend(window.Event, Event); + else window.Event = Event; +})(); + +(function() { + /* Support for the DOMContentLoaded event is based on work by Dan Webb, + Matthias Miller, Dean Edwards, John Resig, and Diego Perini. */ + + var timer; + + function fireContentLoadedEvent() { + if (document.loaded) return; + if (timer) window.clearTimeout(timer); + document.loaded = true; + document.fire('dom:loaded'); + } + + function checkReadyState() { + if (document.readyState === 'complete') { + document.stopObserving('readystatechange', checkReadyState); + fireContentLoadedEvent(); + } + } + + function pollDoScroll() { + try { document.documentElement.doScroll('left'); } + catch(e) { + timer = pollDoScroll.defer(); + return; + } + fireContentLoadedEvent(); + } + + if (document.addEventListener) { + document.addEventListener('DOMContentLoaded', fireContentLoadedEvent, false); + } else { + document.observe('readystatechange', checkReadyState); + if (window == top) + timer = pollDoScroll.defer(); + } + + Event.observe(window, 'load', fireContentLoadedEvent); +})(); + +Element.addMethods(); + +/*------------------------------- DEPRECATED -------------------------------*/ + +Hash.toQueryString = Object.toQueryString; + +var Toggle = { display: Element.toggle }; + +Element.Methods.childOf = Element.Methods.descendantOf; + +var Insertion = { + Before: function(element, content) { + return Element.insert(element, {before:content}); + }, + + Top: function(element, content) { + return Element.insert(element, {top:content}); + }, + + Bottom: function(element, content) { + return Element.insert(element, {bottom:content}); + }, + + After: function(element, content) { + return Element.insert(element, {after:content}); + } +}; + +var $continue = new Error('"throw $continue" is deprecated, use "return" instead'); + +var Position = { + includeScrollOffsets: false, + + prepare: function() { + this.deltaX = window.pageXOffset + || document.documentElement.scrollLeft + || document.body.scrollLeft + || 0; + this.deltaY = window.pageYOffset + || document.documentElement.scrollTop + || document.body.scrollTop + || 0; + }, + + within: function(element, x, y) { + if (this.includeScrollOffsets) + return this.withinIncludingScrolloffsets(element, x, y); + this.xcomp = x; + this.ycomp = y; + this.offset = Element.cumulativeOffset(element); + + return (y >= this.offset[1] && + y < this.offset[1] + element.offsetHeight && + x >= this.offset[0] && + x < this.offset[0] + element.offsetWidth); + }, + + withinIncludingScrolloffsets: function(element, x, y) { + var offsetcache = Element.cumulativeScrollOffset(element); + + this.xcomp = x + offsetcache[0] - this.deltaX; + this.ycomp = y + offsetcache[1] - this.deltaY; + this.offset = Element.cumulativeOffset(element); + + return (this.ycomp >= this.offset[1] && + this.ycomp < this.offset[1] + element.offsetHeight && + this.xcomp >= this.offset[0] && + this.xcomp < this.offset[0] + element.offsetWidth); + }, + + overlap: function(mode, element) { + if (!mode) return 0; + if (mode == 'vertical') + return ((this.offset[1] + element.offsetHeight) - this.ycomp) / + element.offsetHeight; + if (mode == 'horizontal') + return ((this.offset[0] + element.offsetWidth) - this.xcomp) / + element.offsetWidth; + }, + + + cumulativeOffset: Element.Methods.cumulativeOffset, + + positionedOffset: Element.Methods.positionedOffset, + + absolutize: function(element) { + Position.prepare(); + return Element.absolutize(element); + }, + + relativize: function(element) { + Position.prepare(); + return Element.relativize(element); + }, + + realOffset: Element.Methods.cumulativeScrollOffset, + + offsetParent: Element.Methods.getOffsetParent, + + page: Element.Methods.viewportOffset, + + clone: function(source, target, options) { + options = options || { }; + return Element.clonePosition(target, source, options); + } +}; + +/*--------------------------------------------------------------------------*/ + +if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){ + function iter(name) { + return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]"; + } + + instanceMethods.getElementsByClassName = Prototype.BrowserFeatures.XPath ? + function(element, className) { + className = className.toString().strip(); + var cond = /\s/.test(className) ? $w(className).map(iter).join('') : iter(className); + return cond ? document._getElementsByXPath('.//*' + cond, element) : []; + } : function(element, className) { + className = className.toString().strip(); + var elements = [], classNames = (/\s/.test(className) ? $w(className) : null); + if (!classNames && !className) return elements; + + var nodes = $(element).getElementsByTagName('*'); + className = ' ' + className + ' '; + + for (var i = 0, child, cn; child = nodes[i]; i++) { + if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) || + (classNames && classNames.all(function(name) { + return !name.toString().blank() && cn.include(' ' + name + ' '); + })))) + elements.push(Element.extend(child)); + } + return elements; + }; + + return function(className, parentElement) { + return $(parentElement || document.body).getElementsByClassName(className); + }; +}(Element.Methods); + +/*--------------------------------------------------------------------------*/ + +Element.ClassNames = Class.create(); +Element.ClassNames.prototype = { + initialize: function(element) { + this.element = $(element); + }, + + _each: function(iterator) { + this.element.className.split(/\s+/).select(function(name) { + return name.length > 0; + })._each(iterator); + }, + + set: function(className) { + this.element.className = className; + }, + + add: function(classNameToAdd) { + if (this.include(classNameToAdd)) return; + this.set($A(this).concat(classNameToAdd).join(' ')); + }, + + remove: function(classNameToRemove) { + if (!this.include(classNameToRemove)) return; + this.set($A(this).without(classNameToRemove).join(' ')); + }, + + toString: function() { + return $A(this).join(' '); + } +}; + +Object.extend(Element.ClassNames.prototype, Enumerable); + +/*--------------------------------------------------------------------------*/ + +(function() { + window.Selector = Class.create({ + initialize: function(expression) { + this.expression = expression.strip(); + }, + + findElements: function(rootElement) { + return Prototype.Selector.select(this.expression, rootElement); + }, + + match: function(element) { + return Prototype.Selector.match(element, this.expression); + }, + + toString: function() { + return this.expression; + }, + + inspect: function() { + return "#"; + } + }); + + Object.extend(Selector, { + matchElements: function(elements, expression) { + var match = Prototype.Selector.match, + results = []; + + for (var i = 0, length = elements.length; i < length; i++) { + var element = elements[i]; + if (match(element, expression)) { + results.push(Element.extend(element)); + } + } + return results; + }, + + findElement: function(elements, expression, index) { + index = index || 0; + var matchIndex = 0, element; + for (var i = 0, length = elements.length; i < length; i++) { + element = elements[i]; + if (Prototype.Selector.match(element, expression) && index === matchIndex++) { + return Element.extend(element); + } + } + }, + + findChildElements: function(element, expressions) { + var selector = expressions.toArray().join(', '); + return Prototype.Selector.select(selector, element || document); + } + }); +})(); diff --git a/WebContent/webcontent/birt/ajax/mh/BirtBaseResponseHandler.js b/WebContent/webcontent/birt/ajax/mh/BirtBaseResponseHandler.js new file mode 100644 index 0000000..2cd26a9 --- /dev/null +++ b/WebContent/webcontent/birt/ajax/mh/BirtBaseResponseHandler.js @@ -0,0 +1,52 @@ +/****************************************************************************** + * Copyright (c) 2004 Actuate Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Actuate Corporation - Initial implementation. + *****************************************************************************/ + +/** + * BirtBaseResponseHandler + * ... + */ +BirtBaseResponseHandler = function(){}; + +BirtBaseResponseHandler.prototype = +{ + + associations: {}, //map of response types, handlers + + /** + * Add handler for response target types + * Holds one handlerObject per targetType with newer handlerObject overwriting existing handlerObject + * @param targetType String name of target, length 5 + * @param handlerObject + */ + addAssociation: function(targetType, handlerObject) + { + this.associations[targetType] = handlerObject; + }, + + + /** + * Process update response message. Trigger necessary UI updates. + * See response schema for details. + * + * @message, update response DOM. + * @return, void + */ + __process: function( message ) + { + this.__process( message ); + } + + //////////////////////////////////////////////////////////////////////////// + // Local methods + /////////////////////////////////////////////////////////////////////////// + + +} \ No newline at end of file diff --git a/WebContent/webcontent/birt/ajax/mh/BirtGetUpdatedObjectsResponseHandler.js b/WebContent/webcontent/birt/ajax/mh/BirtGetUpdatedObjectsResponseHandler.js new file mode 100644 index 0000000..868b4c0 --- /dev/null +++ b/WebContent/webcontent/birt/ajax/mh/BirtGetUpdatedObjectsResponseHandler.js @@ -0,0 +1,177 @@ +/****************************************************************************** + * Copyright (c) 2004 Actuate Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Actuate Corporation - Initial implementation. + *****************************************************************************/ + +/** + * birtGetUpdatedObjectsResponseHandler + * ... + */ +BirtGetUpdatedObjectsResponseHandler = function( ){ }; + +BirtGetUpdatedObjectsResponseHandler.prototype = Object.extend( new BirtBaseResponseHandler( ), +{ + /** + * Process update response message. Trigger necessary UI updates. + * See response schema for details. + * + * @message, update response DOM. + * @return, void + */ + __process: function( message ) + { + if ( !message ) return; + this.__processUpdateContent( message.getElementsByTagName( 'UpdateContent' ) ); + this.__processUpdateData( message.getElementsByTagName( 'UpdateData' ) ); + }, + + /** + * Process update response message. Trigger necessary UI updates. + * See response schema for details. + * + * @message, update response DOM. + * @return, void + */ + __processUpdateContent: function( updates ) + { + if ( !updates ) return; + + for ( var i = 0; i < updates.length; i++ ) + { + try + { + var target = updates[i].getElementsByTagName( 'Target' )[0]; //assumes only 1 target per UpdateContent + var targetData = target.firstChild.data + var targetType = targetData.substring( 0, 5 ); + var handler = this.associations[targetType]; + + if ( !handler ) + { + var error = { name : "CustomError", + message : ( "__processUpdateContent no handler registered for type: " + targetType ) }; + throw error; + } + + var content = updates[i].getElementsByTagName( 'Content' )[0]; //assumes only 1 context per UpdateContent + if ( !content ) + { + var error = { name : "CustomError", + message : ( " __processUpdateContent empty contents" ) }; + throw error; + } + + /************************************************************** + * Data is too large, seems firefox will wrap the content into + * several children nodes of text type. Need more verification. + **************************************************************/ + + // firefox can use textContent to retrieve the complete node content, + // check this property first to avoid string concatation which is very + // slow for large node. + var contentData = content.textContent; + + if (!contentData) + { + // for non-fireforx browser, we still use string concatation + // to retrieve the complete content. + + contentData = ""; + + if ( content.hasChildNodes ) + { + for( var j = 0; j < content.childNodes.length; j++ ) + { + if( content.childNodes[j].nodeType == 3 ) //Text type + { + contentData += content.childNodes[j].data; + } + } + } + } + + if ( contentData ) + { + handler.__cb_disposeEventHandlers( targetData ); + handler.__cb_render( targetData, contentData ); + var inits = updates[i].getElementsByTagName( 'InitializationId' ); + var bookmarks = updates[i].getElementsByTagName( 'Bookmark' ); + if ( bookmarks.length > 0 ) + { + handler.__cb_installEventHandlers( targetData, inits, bookmarks[0].firstChild.data ); + } + else + { + handler.__cb_installEventHandlers( targetData, inits ); + } + } + } + catch( error ) + { + debug( "ERROR in birtGetUpdatedObjectsResponseHandler" ); + + for( var i in error ) + { + debug( "ERROR " + i + " : " + error[i] ); + } + } + } + }, + + /** + * Process update response message. Trigger necessary UI updates. + * See response schema for details. + * + * @message, update response DOM. + * @return, void + */ + __processUpdateData: function( updates ) + { + if ( !updates ) return; + + for ( var i = 0; i < updates.length; i++ ) + { + var targets = updates[i].getElementsByTagName( 'Target' ); + if ( !targets || targets.length <= 0 ) continue; + + var datas = updates[i].getElementsByTagName( 'Data' ); + if ( !datas || datas.length <= 0 ) continue; + + var handler = null; + try + { + handler = eval( targets[0].firstChild.data ); + } + catch ( e ) + { + } + if ( !handler || !handler.__cb_bind ) continue; + + handler.__cb_bind( datas[0] ); + } + }, + + /** + * Helper function to handle "Init" type + * @param init "Init" element + */ + initList: function( init ) + { + var initData = init.firstChild.data; + var targetType = init.firstChild.data.substring( 0, 5 ); + var handler = this.associations[targetType]; + if ( !handler ) + { + var error = {name:"CustomError", message: ("initList invalid Init")}; + throw error; + } + handler.__cb_installEventHandlers( initData ); + } +} ); + +var birtGetUpdatedObjectsResponseHandler = new BirtGetUpdatedObjectsResponseHandler( ); \ No newline at end of file diff --git a/WebContent/webcontent/birt/ajax/taglib/CascadingParameter.js b/WebContent/webcontent/birt/ajax/taglib/CascadingParameter.js new file mode 100644 index 0000000..45c7ef3 --- /dev/null +++ b/WebContent/webcontent/birt/ajax/taglib/CascadingParameter.js @@ -0,0 +1,193 @@ +/****************************************************************************** + * Copyright (c) 2004 Actuate Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Actuate Corporation - Initial implementation. + *****************************************************************************/ + +/** + * Utility functions for BIRT JSP Cascading parameter tag. + */ + +CascadingParameter = Class.create( ); + +CascadingParameter.prototype = +{ + __active : false, + __requesterId : '', + __parameter : null, + __paramNames : null, + __group : null, + __data : null, + __targetId : '', + __action : null, + + /** + * Initialization routine required by "ProtoType" lib. + * @return, void + */ + initialize : function( id, parameter, names, group ) + { + this.__requesterId = id; + this.__parameter = parameter; + this.__paramNames = names; + this.__group = group; + this.__data = new Array( ); + + this.__initialize( ); + }, + + /** + * Initialize cascading parameter + * + * @return, void + */ + __initialize : function( ) + { + var oDiv = $( this.__requesterId ); + if( !oDiv ) return; + + var forms = oDiv.getElementsByTagName( "FORM" ); + if( !forms || forms.length <= 0 ) return; + this.__action = forms[0].action; + }, + + /** + * Insert a option into select + * + * @param, list + * @param, index + * @param, text + * @param, value + * @return, void + */ + __insertOption : function( list, index, text, value ) + { + var i = 0; + for ( i = list.options.length; i > index; i-- ) + { + list.options[i] = new Option( list.options[i-1].text, list.options[i-1].value ); + } + + list.options[index] = new Option( text, value ); + }, + + /** + * return action string + * + * @return, action + */ + getAction : function( ) + { + return this.__action; + }, + + /** + * process to get cascading parameter + * @return, void + */ + process : function( ) + { + if( !this.__group || !this.__paramNames ) return; + + // If target select doesn't exist, return + var targetName = this.__paramNames[ this.__paramNames.length -1 ]; + this.__targetId = this.__group.getParameterIdByName( targetName ); + var target = $( this.__targetId ); + if( !target ) return; + + for( var i=0; i 0 ) + { + // if taskid existed, show 'Cancel' button + this.__l_show_cancel_button( ); + + // enable 'cancel' button + var oCancel = this.__loc_cancel_button( ); + if( oCancel ) + oCancel.disabled = false; + } + else + { + // hide 'Cancel' button + this.__l_hide_cancel_button( ); + } + + this.__timer = window.setTimeout( this.__cb_bind_closure, this.__interval ); + }, + + /** + * Install native/birt event handlers. + * + * @id, response id + * @return, void + */ + __stop : function( ) + { + window.clearTimeout( this.__timer ); + this.__l_hide( ); + + // clear taskid + birtUtility.clearTaskId( ); + }, + + /** + * Create progress bar mask. + * + * @return, __mask + */ + __create_mask : function( maskId ) + { + var oMask = $( maskId ); + if( !oMask ) return null; + + oMask.style.position = 'absolute'; + oMask.style.top = '0px'; + oMask.style.left = '0px'; + oMask.style.width = '50%'; + var height = BirtPosition.viewportHeight( ); + oMask.style.height = height + 'px'; + oMask.style.backgroundColor = '#dbe4ee'; + oMask.style.filter = 'alpha( opacity = 0.0 )'; + oMask.style.opacity = '.0'; + oMask.scrolling = 'no'; + oMask.marginHeight = '0px'; + oMask.marginWidth = '0px'; + oMask.style.display = 'none'; + oMask.style.MozOpacity = 0; + + return oMask; + }, + + /** + * Show progress bar. + */ + __l_show : function( ) + { + [ this.__mask, this.__instance ].each( Element.show ); + BirtPosition.center( this.__instance ); + }, + + /** + * Hide progress bar. + */ + __l_hide : function( ) + { + [ this.__instance, this.__mask ].each( Element.hide ); + }, + + /** + * Returns 'cancel' button + * @return, INPUT + */ + __loc_cancel_button: function( ) + { + var oIEC = this.__instance.getElementsByTagName( "input" ); + var oCancel; + if( oIEC && oIEC.length > 0 ) + { + for( var i = 0 ; i < oIEC.length; i++ ) + { + if( oIEC[i].type == 'button' ) + { + oCancel = oIEC[i]; + break; + } + } + } + + return oCancel; + }, + + /** + * Handle click "Cancel" button. + * + * @event, incoming browser native event + * @return, void + */ + __neh_click: function( event ) + { + var oTaskId = document.getElementById( this.__task_id ); + if( oTaskId && window.confirm( "Do you want to cancel current task?" ) ) + { + Event.element( event ).disabled = true; + + // cancel task + birtSoapRequest.addOperation( Constants.documentId, Constants.Document, "CancelTask", null, { name : Constants.PARAM_TASKID, value : oTaskId.value } ); + birtSoapRequest.setURL( this.__handler.getAction( ) ); + + if ( !birtSoapRequest.getURL( ) ) return; + + var myAjax = new Ajax.Request( birtSoapRequest.getURL( ), { method: 'post', postBody: birtSoapRequest.__xml_document, + contentType: 'text/xml; charset=utf-8', + onSuccess: this.responseHandler, onFailure: this.invalidResponseHandler, + requestHeaders: ['SOAPAction', '""', 'request-type', 'SOAP', 'Connection', 'keep-alive' ] } ); + birtSoapRequest.reset( ); + } + }, + + /** + * Callback function triggered when reponse is ready, status is 200. + * + * @request, httpXmlRequest instance + * @return, void + */ + responseHandler: function( request ) + { + progressBar.__stop( ); + }, + + /** + * Callback function triggered when reponse is ready status is not 200. + * Process any http (non-200) errors. Note this is not exception from + * server side. + * + * @request, httpXmlRequest instance + * @return, void + */ + invalidResponseHandler: function( request ) + { + progressBar.__stop( ); + }, + + /** + * Show "Cancel" button. + * + * @return, void + */ + __l_show_cancel_button: function( ) + { + var container = document.getElementById( this.__cancel_button ); + if( container ) + container.style.display = 'block'; + }, + + /** + * Hide "Cancel" button. + * + * @return, void + */ + __l_hide_cancel_button: function( ) + { + var container = document.getElementById( this.__cancel_button ); + if( container ) + container.style.display = 'none'; + } +} \ No newline at end of file diff --git a/WebContent/webcontent/birt/ajax/taglib/SoapResponseHelper.js b/WebContent/webcontent/birt/ajax/taglib/SoapResponseHelper.js new file mode 100644 index 0000000..f86a9e5 --- /dev/null +++ b/WebContent/webcontent/birt/ajax/taglib/SoapResponseHelper.js @@ -0,0 +1,155 @@ +/****************************************************************************** + * Copyright (c) 2004 Actuate Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Actuate Corporation - Initial implementation. + *****************************************************************************/ + +/** + * Helper to handle soap response + */ +SoapResponseHelper = Class.create( ); + +SoapResponseHelper.prototype = +{ + __parameterGroup : null, + + /** + * Initialization routine required by "ProtoType" lib. + * + * @return, void + */ + initialize: function( ) + { + }, + + /** + * Set current parameter group object + * + * @param, group cascading parameter group + * @return, void + */ + setParameterGroup : function( group ) + { + this.__parameterGroup = group; + }, + + /** + * Process the soap response, dispatcher message content to designated + * message handlers. + * + * @message, incoming soap message DOM + * @return, void + */ + processCascadingParameter : function( message ) + { + if( !message || !this.__parameterGroup ) return; + + //alert( birtSoapRequest.prettyPrintXML( message ) ); + var soapBody = message.getElementsByTagName( 'soapenv:Body' )[ 0 ]; + if ( !soapBody ) + { + soapBody = message.getElementsByTagName( 'Body' )[ 0 ]; + } + + if ( soapBody ) + { + for ( var i = 0; i < soapBody.childNodes.length; i++ ) + { + if ( soapBody.childNodes[i].nodeType == 1 ) // Need to use NodeType definition. + { + if ( soapBody.childNodes[i].tagName == 'soapenv:Fault' ) + { + // error message + this.__handleErrorMessage( soapBody.childNodes[i] ); + } + else + { + var datas = soapBody.childNodes[i].getElementsByTagName( 'Data' ); + if( !datas || datas.length<=0 ) return; + + var data = datas[0];//assume there is only one data + var cascade_param = data.getElementsByTagName( 'CascadeParameter' )[0];//assume there is only one cascadeparameter + var selectionLists = data.getElementsByTagName( 'SelectionList' ); + if ( !selectionLists ) + { + return; + } + + for ( var k = 0; k < selectionLists.length; k++ ) + { + var paramName = selectionLists[k].getElementsByTagName( 'Name' )[0].firstChild.data; + var selections = selectionLists[k].getElementsByTagName( 'Selections' ); + + var paramId = this.__parameterGroup.getParameterIdByName( paramName ); + var append_selection = document.getElementById( paramId ); + var len = append_selection.options.length; + + // Clear our selection list. + for( var i = 0, index = 0; i < len; i++ ) + { + append_selection.remove( index ); + } + + // Add new options based on server response. + for( var i = 0; i < selections.length; i++ ) + { + if ( !selections[i].firstChild ) + { + continue; + } + + var oOption = document.createElement( "OPTION" ); + var oLabel = selections[i].getElementsByTagName( 'Label' )[0].firstChild; + if( oLabel ) + oOption.text = oLabel.data; + else + oOption.text = ""; + + var oValue = selections[i].getElementsByTagName( 'Value' )[0].firstChild; + if( oValue ) + oOption.value = oValue.data; + else + oOption.value = ""; + append_selection.options[append_selection.options.length] = oOption; + } + } + } + } + } + } + + // reset parameter group + this.__parameterGroup = null; + }, + + /** + * handle error message + * + * @param, data incoming soap error message DOM + * @return, void + */ + __handleErrorMessage : function( data ) + { + if( !data ) return; + + // Prepare fault string (reason) + var faultStrings = data.getElementsByTagName( 'faultstring' ); + if ( faultStrings[0] && faultStrings[0].firstChild ) + { + alert( faultStrings[0].firstChild.data ); + } + else + { + alert( Constants.error.unknownError ); + } + }, + + noComma : "" //just to avoid javascript syntax errors +} + +var soapResponseHelper = new SoapResponseHelper( ); \ No newline at end of file diff --git a/WebContent/webcontent/birt/ajax/ui/app/AbstractBaseToc.js b/WebContent/webcontent/birt/ajax/ui/app/AbstractBaseToc.js new file mode 100644 index 0000000..a332e50 --- /dev/null +++ b/WebContent/webcontent/birt/ajax/ui/app/AbstractBaseToc.js @@ -0,0 +1,471 @@ +/****************************************************************************** + * Copyright (c) 2004-2008 Actuate Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Actuate Corporation - Initial implementation. + *****************************************************************************/ + +/** + * AbstractBaseToc + * ... + */ +AbstractBaseToc = function( ) { }; + +AbstractBaseToc.prototype = Object.extend( new AbstractUIComponent( ), +{ + __neh_click_closure : null, + __neh_resize_closure : null, + __beh_toc_closure : null, + __beh_toc_image_closure : null, + __neh_img_click_closure : null, + + __nodeid : '0', + __neh_item_mouse_over : null, + __neh_item_mouse_out : null, + __neh_item_click : null, + + __clickcount : 0, + + /** + * Install native/birt event handlers. + * + * @id, TOC id (optional since there is only one nav bar) + * @return, void + */ + __cb_installEventHandlers : function( ) + { + var oImgs = this.__instance.getElementsByTagName( "img" ); + if ( oImgs ) + { + for ( var i = 0; i < oImgs.length; i++ ) + { + Event.observe( oImgs[i], 'click', this.__neh_click_closure, false ); + } + } + // Birt event handler + Event.observe( window, 'resize', this.__neh_resize_closure, false ); + birtEventDispatcher.registerEventHandler( birtEvent.__E_TOC, this.__instance.id, this.__beh_toc_closure ); + birtEventDispatcher.registerEventHandler( birtEvent.__E_TOC_IMAGE_CLICK, this.__instance.id, this.__beh_toc_image_closure ); + }, + + /** + * Handle mouse over. + */ + __neh_mousemove : function ( event ) + { + var obj = Event.element( event ); + obj.style.filter = 'alpha( opacity=80)'; + obj.style.opacity = 0.8; + obj.style.MozOpacity = 0.8; + }, + + /** + * Handle mouse out. + */ + __neh_mouseout : function ( event ) + { + var obj = Event.element( event ); + obj.style.filter = 'alpha( opacity=100)'; + obj.style.opacity = 1; + obj.style.MozOpacity = 1; + }, + + /** + * Binding data to the TOC UI. Data includes a TOC tree. + * + * @data, data DOM tree (Schema TBD) + * @return, void + */ + __cb_bind : function( data ) + { + var datas = data.getElementsByTagName( 'Child' ); + var len = datas.length; + if( len == 0 ) + { + return ; + } + + var tableEle = document.createElement( "table" ); + tableEle.border = '0'; + tableEle.cellspacing = '0'; + tableEle.cellpadding = '0'; + var tbody = document.createElement( "tbody" ); + for( i = 0; i < len; i++ ) + { + var imgid = this.__nodeid + '_' + i ; + var tr1 = document.createElement( "tr" ); + var td11 = document.createElement( "td" ); + td11.valign = "top"; + td11.id = "td" + imgid; + + var tmp = datas[i]; + + var displaynames = tmp.getElementsByTagName( 'DisplayName' ); + var displayname = displaynames[0].firstChild; + var s_displayname = ""; + if( displayname ) + s_displayname = displayname.data; + + var isLeafs = tmp.getElementsByTagName( 'IsLeaf' ); + var img = document.createElement( "input" ); + img.type = "image"; + img.style.backgroundRepeat = 'no-repeat'; + img.style.paddingLeft = '0px'; + img.style.width = '8px'; + img.style.height = '8px'; + img.plusMinus = '+'; //default it is collapsed + img.id = imgid; + img.query = '0'; //default it needs to communicate with the server. + img.title = birtUtility.htmlDecode( s_displayname ); + + if ( isLeafs[0].firstChild.data == "false" ) + { + img.src = "birt/images/Expand.gif" ; + img.style.cursor = 'pointer'; + Event.observe( img, 'click', this.__neh_img_click_closure, false ); + } + else + { + img.src = "birt/images/Leaf.gif" ; + img.style.cursor = 'default'; + Event.observe( img, 'click', this.__neh_item_click, false ); + } + + Event.observe( img, 'keydown', this.__neh_item_click, false ); + + td11.width = "10px"; + td11.appendChild( img ); + + var td12 = document.createElement( "td" ); + td12.valign = "top"; + + var nodeIds = tmp.getElementsByTagName( 'Id' ); + img.nodeId = nodeIds[0].firstChild.data; + + var bookmarks = tmp.getElementsByTagName( 'Bookmark' ); + img.bookmark = bookmarks[0].firstChild.data; + + var tocitem = document.createElement( "div" ); + tocitem.title = birtUtility.htmlDecode( s_displayname ); + tocitem.id = 'span_' + imgid; + tocitem.innerHTML = s_displayname ? s_displayname : " "; + + var cssText = "cursor:pointer;border:0px;font-family:Verdana;font-size:9pt;background-color:#FFFFFF;overflow:visible;"; + var styles = tmp.getElementsByTagName( 'Style' ); + if( styles && styles.length > 0 ) + { + if( styles[0].firstChild ) + tocitem.style.cssText = cssText + styles[0].firstChild.data; + else + tocitem.style.cssText = cssText; + } + + td12.appendChild( tocitem ); + td12.noWrap = true; + + tr1.appendChild( td11 ); + tr1.appendChild( td12 ); + + var tr2 = document.createElement( "tr" ); + var td2 = document.createElement( "td" ); + td2.id = 'display' + imgid; + td2.style.paddingLeft = '16px'; + td2.style.display = 'none'; + td2.colSpan = 2; + tr2.appendChild( td2 ); + + tbody.appendChild( tr1 ); + tbody.appendChild( tr2 ); + + //observe the text so that when click the text ,we can expand or collapse the toc + Event.observe( tocitem, 'mouseover', this.__neh_item_mouse_over, false ); + Event.observe( tocitem, 'mouseout', this.__neh_item_mouse_out, false ); + Event.observe( tocitem, 'click', this.__neh_item_click, false ); + Event.observe( tocitem, 'keydown', this.__neh_item_click, false ); + } + tableEle.appendChild( tbody ); + var displayid = 'display' + this.__nodeid; + var ele= $( displayid ); + var childLength = ele.childNodes.length; + if ( childLength == 0 ) + { + ele.appendChild( tableEle ); + } + else + { + ele.replaceChild( tableEle, ele.childNodes[0] ); + } + + this.__neh_resize( ); // hack + }, + + /** + * when click the text ,also need to collapse or expand the toc + */ + __neh_text_click : function ( event ) + { + var clickElement = Event.element( event ); + var clickId = clickElement.id; + var imgid; + + if( clickElement.type == "image" ) + { + //get the img id + imgid = clickId; + + if( clickElement.src.indexOf( "Expand" ) > -1 ) + { + // keydown on Expand img + if( event.type == 'keydown' ) + { + if( event.keyCode == 39 ) + this.__neh_img_click( event ); + } + } + else if( clickElement.src.indexOf( "Collapse" ) > -1 ) + { + // keydown on Collapse img + if( event.type == 'keydown' ) + { + if( event.keyCode == 37 ) + this.__neh_img_click( event ); + } + } + } + else + { + //as the clicktextid is 'span_' + id, so we need to substr to get the imgid + var len = "span_".length; + imgid = clickId.substr( len ); + } + + if( event.type == 'keydown' ) + { + // Press "Enter" and "Space" + if( event.keyCode != 13 && event.keyCode != 32) + return; + } + + var clickImg = $( imgid ); + var query = clickImg.query; + var plusMinus = clickImg.plusMinus; + var bookmark = clickImg.bookmark; + + var params = new Array( ); + params[0] = { }; + params[0].name = Constants.PARAM_BOOKMARK; + params[0].value = bookmark; + + // passed bookmark name is not a TOC name. + params[1] = { }; + params[1].name = Constants.PARAM_ISTOC; + params[1].value = "false"; + + birtEventDispatcher.broadcastEvent( birtEvent.__E_GETPAGE, params ); + Event.stop(event); + }, + + /** + * when click the img , collpase or expand the toc + */ + __neh_img_click : function( event ) + { + var clickImg = Event.element( event ); + var query = clickImg.query; + var nodeId = clickImg.nodeId; + var clickId = this.__neh_click_process( clickImg, 0 ); + this.__neh_click_broadcast( query, nodeId ); + }, + + /** + * Process click. + */ + __neh_click_process : function ( clickImg, textClick ) + { + var clickId = clickImg.id; + this.__nodeid = clickId; + var plusMinus = clickImg.plusMinus; + var query = clickImg.query; + if( textClick == 1 && plusMinus != '+' ) + { + } + else + { + clickImg.src = this.__icon_change( plusMinus ); + } + + clickImg.plusMinus = this.__state_change( plusMinus ); + var displayid = 'display' + clickId; + var elem = $( displayid ); + if( ( textClick == 1 && plusMinus == '+' ) || textClick == 0 ) + { + if( clickImg.plusMinus == '+' ) + { + //collapse + elem.style.display = 'none'; + } + else + { + //expand + elem.style.display = ''; + } + } + + if( query == '0' ) + { + clickImg.query = '1'; + } + + return clickId; + }, + + /** + * Broadcast event. + */ + __neh_click_broadcast : function( query, realId ) + { + birtSoapRequest.setURL( soapURL ); + if( query == '0' ) + { + birtSoapRequest.addOperation( Constants.documentId, Constants.Document, + "GetToc", null, + { name : "realId", value : realId } ); + birtEventDispatcher.broadcastEvent( birtEvent.__E_TOC_IMAGE_CLICK ); + } + }, + + /* + * change the img plusMinus + * + to - + * - to + + * 0 to 0 + */ + __state_change : function ( plusMinus ) + { + var stat = '+'; + if( plusMinus == '+' ) + { + stat = '-'; + } + else if( plusMinus == '-' ) + { + stat = '+'; + } + else if( plusMinus == '0' ) + { + stat = '0'; + } + return stat; + }, + + /** + * change the img icon + */ + __icon_change : function ( plusMinus ) + { + var srcLoc = "birt/images/Expand.gif"; + if( plusMinus == '+' ) + { + srcLoc = "birt/images/Collapse.gif"; + } + else if( plusMinus == '-' ) + { + srcLoc = "birt/images/Expand.gif"; + } + + return srcLoc; + }, + + /** + * Handle native event 'click'. + * + * @event, incoming browser native event + * @return, void + */ + __neh_resize : function( event ) + { + //var width = BirtPosition.viewportWidth( ) - ( this.__instance.offsetLeft >= 250 ? 250 : 0 ) - 3; + //this.__instance.style.width = width + "px"; + var height = BirtPosition.viewportHeight( ) - this.__instance.offsetTop - 2; + this.__instance.style.height = height + "px"; + if ( rtl && + ( BrowserUtility.isIE6 || BrowserUtility.isIE7 || + BrowserUtility.isOpera || BrowserUtility.isKHTML || + BrowserUtility.isSafari + ) ) + { + this.__instance.style.position = "absolute"; + if ( birtReportDocument && birtReportDocument.__rtl ) + { + this.__instance.style.left = BirtPosition.viewportWidth( ) - this.getWidth(); + } + else + { + this.__instance.style.left = "0px"; + } + } + }, + + /** + * what is this? + */ + __beh_toc_image : function ( ) + { + return true; + }, + + /** + * Handle native event 'click'. + * + * @event, incoming browser native event + * @return, void + */ + __neh_click: function( event ) + { + var clickId = Event.element( event ).id; + var clickName = Event.element( event ).name; + + if ( Event.element( event ).name == 'close' ) + { + birtEventDispatcher.broadcastEvent( birtEvent.__E_TOC ); + } + + }, + + /** + * Handle native event 'click'. + * + * @event, incoming browser native event + * @return, void + */ + __beh_toc: function( id ) + { + Element.toggle( this.__instance ); + + this.__nodeid = '0'; + this.__clickcount = 0; + var displayid = 'display' + this.__nodeid; + + var root = $( displayid ); + if( root.query != 1 ) + { + root.query = '1'; + birtSoapRequest.setURL( soapURL ); + birtSoapRequest.addOperation( Constants.documentId, Constants.Document, "GetToc", null ); + return true; + } + else + { + root.query = '0'; + } + }, + + getWidth : function() + { + return this.__instance.offsetWidth; + } +} ); diff --git a/WebContent/webcontent/birt/ajax/ui/app/AbstractBaseToolbar.js b/WebContent/webcontent/birt/ajax/ui/app/AbstractBaseToolbar.js new file mode 100644 index 0000000..f5f877b --- /dev/null +++ b/WebContent/webcontent/birt/ajax/ui/app/AbstractBaseToolbar.js @@ -0,0 +1,93 @@ +/****************************************************************************** + * Copyright (c) 2004 Actuate Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Actuate Corporation - Initial implementation. + *****************************************************************************/ + +/** + * AbstractBaseToolbar. + * ... + */ +AbstractBaseToolbar = function( ) { }; + +AbstractBaseToolbar.prototype = Object.extend( new AbstractUIComponent( ), +{ + /** + * Closure for native click event. + */ + __neh_click_closure : null, + + /** + * instance variable for preloading images + */ + toolbarImagesOff : null, + + /** + * instance variable for preloading images + */ + toolbarImagesOn : null, + + /** + * + */ + toolbarImageState : null, + + /** + * Loads image in off state and stores on and off src strings + * @param source + */ + preloadImages : function( source ) + { + var image; + var strFront; + var strExtension; + + image = new Image( ); + strFront = source.substring( 0, source.lastIndexOf( '.' ) ); + strExtension = source.substring( source.lastIndexOf( '.' ), source.length ); + image.src = strFront + "Off" + strExtension; + this.toolbarImagesOff.push( image.src ); + this.toolbarImagesOn.push( source ); + }, + + /** + * Determines if an image is in disabled state by examining name for "Off." + * @param name + */ + isEnabled : function( name ) + { + var i = name.indexOf( 'Off.' ); + if( i > -1 ) + { + return false; + } + return true; + }, + + /** + * Changes state from enabled to disabled + * @param button IMG + * @param enable true to enable, false to disable + */ + toggleButton : function( button, enable ) + { + if( enable ) + { + this.toolbarImageState[button.name] = true; + button.parentNode.className = "toolbarButton"; + Event.observe( button, 'click', this.__neh_click_closure, false ); + } + else + { + this.toolbarImageState[button.name] = false; + button.parentNode.className = "toolbarButtonOff"; + Event.stopObserving( button, 'click', this.__neh_click_closure, false ); + } + } +} +); \ No newline at end of file diff --git a/WebContent/webcontent/birt/ajax/ui/app/AbstractUIComponent.js b/WebContent/webcontent/birt/ajax/ui/app/AbstractUIComponent.js new file mode 100644 index 0000000..d6770a3 --- /dev/null +++ b/WebContent/webcontent/birt/ajax/ui/app/AbstractUIComponent.js @@ -0,0 +1,34 @@ +/****************************************************************************** + * Copyright (c) 2004 Actuate Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Actuate Corporation - Initial implementation. + *****************************************************************************/ + +/** + * AbstractUIComponentBase. + * Base class for all UI components. + */ +AbstractUIComponent = function( ) { }; + +AbstractUIComponent.prototype = +{ + /** + * UI component html instance. + */ + __instance : null, + + /** + * Initialization routine required by "ProtoType" lib. + * + * @return, void + */ + __initBase : function( id ) + { + this.__instance = $( id ); + } +} \ No newline at end of file diff --git a/WebContent/webcontent/birt/ajax/ui/app/BirtNavigationBar.js b/WebContent/webcontent/birt/ajax/ui/app/BirtNavigationBar.js new file mode 100644 index 0000000..b7bb98d --- /dev/null +++ b/WebContent/webcontent/birt/ajax/ui/app/BirtNavigationBar.js @@ -0,0 +1,252 @@ +/****************************************************************************** + * Copyright (c) 2004 Actuate Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Actuate Corporation - Initial implementation. + *****************************************************************************/ + +/** + * BirtNavigationBar + * ... + */ +BirtNavigationBar = Class.create( ); +BirtNavigationBar.prototype = Object.extend( new AbstractUIComponent( ), +{ + _IMAGE_PATH : "birt/images/", + _IMAGE_EXTENSION : ".gif", + _IMAGE_FIRST_PAGE : !rtl?"FirstPage":"LastPage", + _IMAGE_LAST_PAGE : !rtl?"LastPage":"FirstPage", + _IMAGE_PREVIOUS_PAGE : !rtl?"PreviousPage":"NextPage", + _IMAGE_NEXT_PAGE : !rtl?"NextPage":"PreviousPage", + _IMAGE_DISABLED_SUFFIX : "_disabled", + + /** + * Total number of pages. + */ + __oTotalPage : null, + + /** + * Current page number. + */ + __oPageNumber : null, + + /** + * Initialization routine required by "ProtoType" lib. + * @return, void + */ + initialize : function( id ) + { + this.__initBase( id ); + this.__oPageNumber = $( 'pageNumber' ); + this.__oTotalPage = $( 'totalPage' ); + this.__cb_installEventHandlers( ); + }, + + /** + * Binding data to the navigation bar UI. Data includes page number, total + * page number (optional). + * + * @data, data DOM tree (Schema TBD) + * @return, void + */ + __cb_bind : function( data ) + { + if ( !data ) + { + return; + } + + var oPageNumbers = data.getElementsByTagName( 'PageNumber' ); + if ( !oPageNumbers && !oPageNumbers[0] ) + { + return; + } + + this.__oPageNumber.innerHTML = oPageNumbers[0].firstChild.data; + + var oTotalPages = data.getElementsByTagName( 'TotalPage' ); + this.__oTotalPage.innerHTML = ( oTotalPages && oTotalPages[0] )? oTotalPages[0].firstChild.data : '+'; + + var pageNumber = parseInt( this.__oPageNumber.firstChild.data ); + var totalPage = ( this.__oTotalPage.firstChild.data == '+' )? '+' : parseInt( this.__oTotalPage.firstChild.data ); + + var oImgs = this.__instance.getElementsByTagName( "INPUT" ); + + var isFirstPage = !( pageNumber > 1 ); + var isLastPage = !( totalPage == '+' || pageNumber < totalPage ); + + oImgs[0].style.cursor = (!isFirstPage)? "pointer" : "default"; + oImgs[1].style.cursor = (!isFirstPage)? "pointer" : "default"; + oImgs[2].style.cursor = (!isLastPage)? "pointer" : "default"; + oImgs[3].style.cursor = (!isLastPage)? "pointer" : "default"; + + oImgs[0].src = this._getImageFileName( this._IMAGE_FIRST_PAGE, isFirstPage ); + oImgs[1].src = this._getImageFileName( this._IMAGE_PREVIOUS_PAGE, isFirstPage ); + oImgs[2].src = this._getImageFileName( this._IMAGE_NEXT_PAGE, isLastPage ); + oImgs[3].src = this._getImageFileName( this._IMAGE_LAST_PAGE, isLastPage ); + }, + + _getImageFileName : function( base, disabled ) + { + return this._IMAGE_PATH + base + ( disabled?this._IMAGE_DISABLED_SUFFIX:"" ) + this._IMAGE_EXTENSION; + }, + + /** + * Install native/birt event handlers. + * + * @id, navigation bar id (optional since there is only one nav bar) + * @return, void + */ + __cb_installEventHandlers : function( ) + { + var oImgs = this.__instance.getElementsByTagName( 'INPUT' ); + + if ( oImgs ) + { + for ( var i = 0; i < oImgs.length; i++ ) + { + if ( oImgs[i].type == 'image' ) + { + Event.observe( oImgs[i], 'click', this.__neh_click.bindAsEventListener( this ), false ); + } + } + } + + // Observe "keydown" event + this.keydown_closure = this.__neh_keydown.bindAsEventListener(this); + Event.observe($('gotoPage'), 'keydown', this.keydown_closure, false); + }, + + /** + * Handle press "Enter" key. + * + * @event, incoming browser native event + * @return, void + */ + __neh_keydown: function( event ) + { + // If press 'Enter' key + if( event.keyCode == 13 ) + { + this.__gotoGage( ); + Event.stop( event ); + } + }, + + /** + * Handle clicking 'Goto' event. + * + * @return, void + */ + __gotoGage : function( ) + { + var iPageNo = -1; + var totalPage = ( this.__oTotalPage.firstChild.data == '+' )? '+' : parseInt( this.__oTotalPage.firstChild.data ); + + var oGotoPage = $( 'gotoPage' ); + var pageNo = oGotoPage.value; + if ( pageNo != null && birtUtility.trim( pageNo ).length > 0 ) + { + iPageNo = parseInt( pageNo ); + } + if ( iPageNo > 0 && iPageNo <= totalPage ) + { + birtEventDispatcher.broadcastEvent( birtEvent.__E_GETPAGE, { name : Constants.PARAM_PAGE, value : oGotoPage.value } ); + } + else + { + alert( Constants.error.invalidPageNumber ); + oGotoPage.focus( ); + } + }, + + /** + * Handle native event 'click'. + * + * @event, incoming browser native event + * @return, void + */ + __neh_click : function( event ) + { + var pageNumber = parseInt( this.__oPageNumber.firstChild.data ); + var totalPage = ( this.__oTotalPage.firstChild.data == '+' )? '+' : parseInt( this.__oTotalPage.firstChild.data ); + + var oBtn = Event.element( event ); + if ( oBtn ) + { + switch ( oBtn.name ) + { + case 'first': + { + if ( pageNumber > 1 ) + { + birtEventDispatcher.broadcastEvent( birtEvent.__E_GETPAGE, { name : Constants.PARAM_PAGE, value : 1 } ); + } + break; + } + case 'previous': + { + if ( pageNumber > 1 ) + { + birtEventDispatcher.broadcastEvent( birtEvent.__E_GETPAGE, { name : Constants.PARAM_PAGE, value : pageNumber - 1 } ); + } + break; + } + case 'next': + { + if ( totalPage == '+' || pageNumber < totalPage ) + { + birtEventDispatcher.broadcastEvent( birtEvent.__E_GETPAGE, { name : Constants.PARAM_PAGE, value : pageNumber + 1 } ); + } + break; + } + case 'last': + { + if ( totalPage == '+' || pageNumber < totalPage ) + { + birtEventDispatcher.broadcastEvent( birtEvent.__E_GETPAGE, { name : Constants.PARAM_PAGE, value : totalPage } ); + } + break; + } + case 'goto': + { + this.__gotoGage( ); + break; + } + default: + { + break; + } + } + } + }, + + __get_current_page : function( ) + { + return this.__oPageNumber.innerHTML; + }, + + /** + * Load current page. Triggered by init. + */ + __init_page : function( ) + { + if( birtParameterDialog.collect_parameter( ) ) + { + if ( this.__oPageNumber.firstChild ) + { + var pageNumber = parseInt( this.__oPageNumber.firstChild.data ); + birtEventDispatcher.broadcastEvent( birtEvent.__E_GETPAGE_INIT, { name : Constants.PARAM_PAGE, value : pageNumber } ); + } + else + { + birtEventDispatcher.broadcastEvent( birtEvent.__E_GETPAGE_INIT ); + } + } + } +} +); \ No newline at end of file diff --git a/WebContent/webcontent/birt/ajax/ui/app/BirtProgressBar.js b/WebContent/webcontent/birt/ajax/ui/app/BirtProgressBar.js new file mode 100644 index 0000000..e90ec5e --- /dev/null +++ b/WebContent/webcontent/birt/ajax/ui/app/BirtProgressBar.js @@ -0,0 +1,314 @@ +/****************************************************************************** + * Copyright (c) 2004 Actuate Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Actuate Corporation - Initial implementation. + *****************************************************************************/ + +/** + * BirtProgressBar + * ... + */ +BirtProgressBar = Class.create( ); +BirtProgressBar.prototype = Object.extend( new AbstractUIComponent( ), +{ + /** + * Latency that will trigger the progress bar. + */ + __interval : 300, + + /** + * Timer instance. + */ + __timer : null, + + /** + * mask instance. + */ + __mask : null, + + /** + * Closures + */ + __cb_bind_closure : null, + + /** + * Event handler for click 'cancel' button + */ + __neh_click_closure : null, + + /** + * 'Cancel' button container + */ + __cancel_button : 'cancelTaskButton', + + /** + * The input control to save 'taskid' + */ + __task_id : 'taskid', + + /** + * When click cancel button, indicate whether redirect a cancel page + */ + __redirect : false, + + /** + * Initialization routine required by "ProtoType" lib. + * @return, void + */ + initialize : function( id ) + { + this.__initBase( id ); + this.__mask = this.__create_mask( ); + this.__cb_bind_closure = this.__cb_bind.bindAsEventListener( this ); + this.__neh_click_closure = this.__neh_click.bindAsEventListener( this ); + + this.__installEventHandlers( id ); + }, + + /** + * Binding data to the dialog UI. Data includes zoom scaling factor. + * + * @return, void + */ + __cb_bind : function( ) + { + if( birtCommunicationManager.__active ) + { + this.__timer = window.setTimeout( this.__cb_bind_closure, this.__interval ); + this.__l_show( ); + } + else + { + window.clearTimeout( this.__timer ); + this.__l_hide( ); + } + }, + + /** + * Install native/birt event handlers. + * + * @id, response id + * @return, void + */ + __installEventHandlers : function( id ) + { + var oCancel = this.__loc_cancel_button( ); + if( oCancel ) + Event.observe( oCancel, 'click', this.__neh_click_closure, false ); + }, + + /** + * Install native/birt event handlers. + * + * @id, response id + * @return, void + */ + __start : function( ) + { + // check taskid + var taskid = birtUtility.getTaskId( ); + if( taskid.length > 0 ) + { + // if taskid existed, show 'Cancel' button + this.__l_show_cancel_button( ); + + // enable 'cancel' button + var oCancel = this.__loc_cancel_button( ); + if( oCancel ) + oCancel.disabled = false; + } + else + { + // hide 'Cancel' button + this.__l_hide_cancel_button( ); + } + + this.__timer = window.setTimeout( this.__cb_bind_closure, this.__interval ); + }, + + /** + * Install native/birt event handlers. + * + * @id, response id + * @return, void + */ + __stop : function( ) + { + window.clearTimeout( this.__timer ); + this.__l_hide( ); + + // clear taskid + birtUtility.clearTaskId( ); + }, + + /** + * Install native/birt event handlers. + * + * @id, response id + * @return, void + */ + __create_mask : function( ) + { + var oMask = document.createElement( 'iframe' ); + // Workaround for IE https secure warning + oMask.src = "birt/pages/common/blank.html"; + oMask.style.position = 'absolute'; + oMask.style.top = '0px'; + oMask.style.left = '0px'; + oMask.style.width = '100%'; + var height = BirtPosition.viewportHeight( ); + oMask.style.height = height + 'px'; + oMask.style.zIndex = '300'; + oMask.style.backgroundColor = '#dbe4ee'; + oMask.style.filter = 'alpha( opacity = 0.0 )'; + oMask.style.opacity = '.0'; + oMask.scrolling = 'no'; + oMask.marginHeight = '0px'; + oMask.marginWidth = '0px'; + oMask.style.display = 'none'; + document.body.appendChild( oMask ); + + return oMask; + }, + + /** + * Show progress bar. + */ + __l_show : function( ) + { + [ this.__mask, this.__instance ].each( Element.show ); + BirtPosition.center( this.__instance ); + }, + + /** + * Hide progress bar. + */ + __l_hide : function( ) + { + [ this.__instance, this.__mask ].each( Element.hide ); + }, + + /** + * Returns 'cancel' button + * @return, INPUT + */ + __loc_cancel_button: function( ) + { + var oIEC = this.__instance.getElementsByTagName( "input" ); + var oCancel; + if( oIEC && oIEC.length > 0 ) + { + for( var i = 0 ; i < oIEC.length; i++ ) + { + if( oIEC[i].type == 'button' ) + { + oCancel = oIEC[i]; + break; + } + } + } + + return oCancel; + }, + + /** + * Handle click "Cancel" button. + * + * @event, incoming browser native event + * @return, void + */ + __neh_click: function( event ) + { + var oTaskId = document.getElementById( this.__task_id ); + if( oTaskId && window.confirm( Constants.error.confirmCancelTask ) ) + { + if( this.__redirect ) + { + this.cancel( oTaskId.value ); + } + else + { + birtEventDispatcher.broadcastEvent( birtEvent.__E_CANCEL_TASK, { name : Constants.PARAM_TASKID, value : oTaskId.value } ); + Event.element( event ).disabled = true; + } + } + }, + + /** + * Try to cancel the process. + * + * @return, void + */ + cancel: function( taskid ) + { + if( !taskid ) + { + var oTaskId = document.getElementById( this.__task_id ); + if( oTaskId ) + taskid = oTaskId.value; + } + + if( !taskid || taskid.length <= 0 ) + return; + + var hiddenForm = document.createElement( 'form' ); + hiddenForm.method = 'post'; + hiddenForm.target = '_self'; + var url = soapURL; + url = url.replace( /[\/][a-zA-Z]+[?]/, '/CancelTask.jsp?' ); + hiddenForm.action = url; + + var taskidInput = document.createElement( 'input' ); + taskidInput.type = 'hidden'; + taskidInput.name = Constants.PARAM_TASKID; + taskidInput.value = taskid; + hiddenForm.appendChild( taskidInput ); + + var divObj = document.createElement( "DIV" ); + document.body.appendChild( divObj ); + divObj.style.display = "none"; + divObj.appendChild( hiddenForm ); + + hiddenForm.submit( ); + }, + + /** + * Show "Cancel" button. + * + * @return, void + */ + __l_show_cancel_button: function( ) + { + var container = document.getElementById( this.__cancel_button ); + if( container ) + container.style.display = 'block'; + }, + + /** + * Hide "Cancel" button. + * + * @return, void + */ + __l_hide_cancel_button: function( ) + { + var container = document.getElementById( this.__cancel_button ); + if( container ) + container.style.display = 'none'; + }, + + /** + * Set redirect flag + * + * @param, flag + * @return, void + */ + setRedirect : function( flag ) + { + this.__redirect = flag; + } +} ); \ No newline at end of file diff --git a/WebContent/webcontent/birt/ajax/ui/app/BirtToc.js b/WebContent/webcontent/birt/ajax/ui/app/BirtToc.js new file mode 100644 index 0000000..61a60c6 --- /dev/null +++ b/WebContent/webcontent/birt/ajax/ui/app/BirtToc.js @@ -0,0 +1,41 @@ +/****************************************************************************** + * Copyright (c) 2004 Actuate Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Actuate Corporation - Initial implementation. + *****************************************************************************/ + +/** + * BirtToc + * ... + */ +BirtToc = Class.create( ); + +BirtToc.prototype = Object.extend( new AbstractBaseToc( ), +{ + /** + * Initialization routine required by "ProtoType" lib. + * @return, void + */ + initialize : function( id ) + { + this.__initBase( id ); + + this.__neh_click_closure = this.__neh_click.bindAsEventListener( this ); + this.__beh_toc_closure = this.__beh_toc.bindAsEventListener( this ); + + this.__beh_toc_image_closure = this.__beh_toc_image.bindAsEventListener( this ); + this.__neh_img_click_closure = this.__neh_img_click.bindAsEventListener( this ); + this.__neh_resize_closure = this.__neh_resize.bindAsEventListener( this ); + + this.__neh_item_mouse_over = this.__neh_mousemove.bindAsEventListener( this ); + this.__neh_item_mouse_out = this.__neh_mouseout.bindAsEventListener( this ); + this.__neh_item_click = this.__neh_text_click.bindAsEventListener( this ); + + this.__cb_installEventHandlers( ); + } +} ); \ No newline at end of file diff --git a/WebContent/webcontent/birt/ajax/ui/app/BirtToolbar.js b/WebContent/webcontent/birt/ajax/ui/app/BirtToolbar.js new file mode 100644 index 0000000..8e9eb1e --- /dev/null +++ b/WebContent/webcontent/birt/ajax/ui/app/BirtToolbar.js @@ -0,0 +1,115 @@ +/****************************************************************************** + * Copyright (c) 2004 Actuate Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Actuate Corporation - Initial implementation. + *****************************************************************************/ + +/** + * BirtToolbar + * ... + */ +BirtToolbar = Class.create( ); + +BirtToolbar.prototype = Object.extend( new AbstractBaseToolbar( ), +{ + /** + * Initialization routine required by "ProtoType" lib. + * @return, void + */ + initialize : function( id ) + { + this.__initBase( id ); + this.__neh_click_closure = this.__neh_click.bindAsEventListener( this ); + this.__cb_installEventHandlers( ); + }, + + /** + * Binding data to the toolbar UI. Data includes zoom scaling factor. + * + * @data, data DOM tree (schema TBD) + * @return, void + */ + __cb_bind : function( data ) + { + }, + + /** + * Install native/birt event handlers. + * + * @id, toolbar id (optional since there is only one toolbar) + * @return, void + */ + __cb_installEventHandlers : function( ) + { + var oImgs = this.__instance.getElementsByTagName( 'INPUT' ); + if ( oImgs ) + { + for ( var i = 0; i < oImgs.length; i++ ) + { + if ( oImgs[i].type == 'image' ) + { + Event.observe( oImgs[i], 'click', this.__neh_click_closure, false ); + } + } + } + }, + + /** + * Handle native event 'click'. + * + * @event, incoming browser native event + * @return, void + */ + __neh_click : function( event ) + { + var oBtn = Event.element( event ); + + if ( oBtn ) + { + switch ( oBtn.name ) + { + case 'print': + { + birtEventDispatcher.broadcastEvent( birtEvent.__E_PRINT ); + break; + } + case 'printServer': + { + birtEventDispatcher.broadcastEvent( birtEvent.__E_PRINT_SERVER ); + break; + } + case 'exportReport': + { + birtEventDispatcher.broadcastEvent( birtEvent.__E_EXPORT_REPORT ); + break; + } + case 'export': + { + birtEventDispatcher.fireEvent( birtEvent.__E_QUERY_EXPORT ); + break; + } + case 'toc': + { + birtEventDispatcher.broadcastEvent( birtEvent.__E_TOC ); + break; + } + case 'parameter': + { + birtEventDispatcher.broadcastEvent( birtEvent.__E_PARAMETER ); + break; + } + default: + { + alert( oBtn.name ); + break; + } + } + } + } +} +); \ No newline at end of file diff --git a/WebContent/webcontent/birt/ajax/ui/dialog/AbstractBaseDialog.js b/WebContent/webcontent/birt/ajax/ui/dialog/AbstractBaseDialog.js new file mode 100644 index 0000000..af59541 --- /dev/null +++ b/WebContent/webcontent/birt/ajax/ui/dialog/AbstractBaseDialog.js @@ -0,0 +1,482 @@ +/****************************************************************************** + * Copyright (c) 2004 Actuate Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Actuate Corporation - Initial implementation. + *****************************************************************************/ + +/** + * Dialog base class + */ +AbstractBaseDialog = function(){}; + +AbstractBaseDialog.prototype = +{ + contentHolderWidth: 500, //TODO - move to display constants? Default width in pixels + visible: null, //Is the dialog currently visible + __operationCancelled: false, + __allowSelection: false, + + /** + Initialize dialog base + */ + __initBase: function(htmlId, contentWidth) + { + this.__instance = $(htmlId); + this.htmlId = htmlId; + this.visible = false; + + //references will be set for okay button so it can be enabled/disabled + this.okButton = null; + this.okButtonLeft = null; + this.okButtonRight = null; + + //Instance is given a location within screen to avoid + //extra scroll bar creation + this.__instance.style.top = '0px'; + this.__instance.style.left = '0px'; + + //Sizing + this.contentHolderName = htmlId + "dialogContentContainer"; + if(contentWidth) + { + this.contentHolderWidth = parseInt(contentWidth); + } + + this.__neh_resize_closure = this.__neh_resize.bindAsEventListener( this ); + + // Initialize event handler closures + this.__neh_okay_closure = this.__neh_okay.bind(this); + this.__neh_cancel_closure = this.__neh_cancel.bind(this); + this.mousedown_closure = this.__neh_mousedown.bindAsEventListener(this); + this.mouseup_closure = this.__neh_mouseup.bindAsEventListener(this); + this.drag_closure = this.__neh_drag.bindAsEventListener(this); + this.disposeSelection_closure = this.__neh_disposeSelection.bindAsEventListener(this); + this.enableSelection_closure = this.__neh_enableSelection.bindAsEventListener(this); + + this.__beh_cancelOperation_closure = this.__beh_cancelOperation.bindAsEventListener( this ); + + birtEventDispatcher.registerEventHandler( birtEvent.__E_CANCEL_TASK, this.htmlId, this.__beh_cancelOperation_closure ); + + this.__operationCancelled = false; + + // Initialize shared events + this.__base_installEventHandlers(htmlId); + }, + + /** + Install event handlers shared across all dialogs. + Buttons (close, cancel, ok), move dialog (drag and drop), screen resize. + */ + __base_installEventHandlers : function( id ) + { + //Initialize iframe + this.__iframe = $(id + "iframe"); + + // Close button + var closeBtn = $(id + "dialogCloseBtn"); + Event.observe( closeBtn, 'click', this.__neh_cancel_closure, false ); + Event.observe( closeBtn, 'mousedown', this.__neh_stopEvent.bindAsEventListener(this), false ); + + // OK and Cancel buttons + this.okBtn = $(id + "okButton"); + var cancelBtn = $(id + "cancelButton"); + + this.okBtnLeft = $(id + "okButtonLeft"); //left part of background image + this.okBtnRight = $(id + "okButtonRight"); //right part of background image + + //set OK button to enabled as default + this.okBtn.className = "dialogBtnBarButtonEnabled"; + if ( this.okBtnLeft ) + { + this.okBtnLeft.className = "dialogBtnBarButtonLeftBackgroundEnabled"; + } + if ( this.okBtnRight ) + { + this.okBtnRight.className = "dialogBtnBarButtonRightBackgroundEnabled"; + } + + Event.observe( this.okBtn, 'click', this.__neh_okay_closure , false ); + //Cancel + Event.observe( cancelBtn, 'click', this.__neh_cancel_closure , false ); + + //Drag and Drop + this.dragBarName = id + "dialogTitleBar"; + var dragArea = $(this.dragBarName); + Event.observe(dragArea, 'mousedown', this.mousedown_closure, false); + + //work around for IE, enable selection for dialog text controls + var oInputs = this.__instance.getElementsByTagName( 'INPUT' ); + for ( var i = 0; i < oInputs.length ; i++ ) + { + if(oInputs[i].type != 'button') + { + this.__enableSelection( oInputs[i] ); + } + } + + var oTextAreas = this.__instance.getElementsByTagName( 'TEXTAREA' ); + for ( var i = 0; i < oTextAreas.length ; i++ ) + { + this.__enableSelection( oTextAreas[i] ); + } + }, + + /** + * Binding data to the dialog UI. + * + * @data, data DOM tree (schema TBD) + * @return, void + */ + __cb_bind : function( data ) + { + this.__bind( data ); + + this.__l_show( ); + }, + + /** + ABSTRACT - must be implemented by extending class + Gets xml data before dialog is shown + */ + __bind: function(data) + { + + }, + + /** + Trigger dialog from client (bypasses bind step) + */ + showDialog: function() + { + this.__l_show( ); + }, + + /** + * + * + * @event, incoming browser native event + * @return, void + */ + __l_show : function( ) + { + // reset cancelled flag + this.__operationCancelled = false; + this.__preShow(); + + //check if the dialog is already shown + if(!this.visible) + { + var zIndex = Mask.show(); + debug("showing at zIndex " + zIndex); + this.__instance.style.zIndex = zIndex; + + Element.show( this.__instance ); + this.visible = true; + + //workaround for Mozilla bug https://bugzilla.mozilla.org/show_bug.cgi?id=167801 + if(BrowserUtility.useIFrame()) + { + //show iframe under dialog + Element.show( this.__iframe ); + } + + this.__setWidth(); + + BirtPosition.center( this.__instance ); + + // workaround for IE7 in rtl mode + if ( BrowserUtility.isIE7 && rtl ) + { + // force refreshing the DIV elements, + // else their positioning might become brokem after opening + // the same dialog box twice... + var titleContainer = $(this.htmlId + "dialogTitleBar"); + if ( titleContainer ) + { + titleContainer.style.direction = "rtl"; + var elements = titleContainer.getElementsByTagName("div"); + for ( var i = 0; i < elements.length; i++ ) + { + var el = elements[i]; + el.style.display = "none"; + el.style.display = "block"; + } + } + } + + Event.observe( window, 'resize', this.__neh_resize_closure, false ); + Event.observe( document, 'mouseup', this.disposeSelection_closure, false ); + } + + this.__postShow(); + }, + + + /** + Called right before element is shown + */ + __preShow: function() + { + //implementation is left to extending class + }, + + /** + Called after element is shown + */ + __postShow: function() + { + //implementation is left to extending class + }, + + /** + * Handle native event 'click'. + * + * @event, incoming browser native event + * @return, void + */ + __l_hide : function( ) + { + this.__preHide(); + Event.stopObserving( window, 'resize', this.__neh_resize_closure, false ); + Event.stopObserving( document, 'mouseup', this.disposeSelection_closure, false ); + [ this.__instance, this.__iframe ].each( Element.hide ); + this.visible = false; + Mask.hide(); + }, + + /** + Called before element is hidden + */ + __preHide: function() + { + //implementation is left to extending class + }, + + /** + Enables/disabled OK button + @param boolean enabled + */ + __setOKButtonState: function(enabled) + { + if(enabled) + { + if(this.okBtn.className == "dialogBtnBarButtonDisabled") + { + this.okBtn.className = "dialogBtnBarButtonEnabled"; + if ( this.okBtnLeft ) + { + this.okBtnLeft.className = "dialogBtnBarButtonLeftBackgroundEnabled"; + } + if ( this.okBtnRight ) + { + this.okBtnRight.className = "dialogBtnBarButtonRightBackgroundEnabled"; + } + Event.observe( this.okBtn, 'click', this.__neh_okay_closure , false ); + } + } + else + { + this.okBtn.className = "dialogBtnBarButtonDisabled"; + if ( this.okBtnLeft ) + { + this.okBtnLeft.className = "dialogBtnBarButtonLeftBackgroundDisabled"; + } + if ( this.okBtnRight ) + { + this.okBtnRight.className = "dialogBtnBarButtonRightBackgroundDisabled"; + } + Event.stopObserving( this.okBtn, 'click', this.__neh_okay_closure , false ); + } + }, + + /** + Stop event + */ + __neh_stopEvent: function(event) + { + Event.stop(event); + }, + + /** + Handle mouse down + */ + __neh_mousedown: function(event) + { + debug("AbstractBaseDialog __neh_mousedown"); + + //Event.stop(event); + var target = Event.element( event ); + + Event.observe( target, 'mouseup', this.mouseup_closure , false ); + Event.observe( target, 'mousemove', this.drag_closure , false ); + }, + + /** + Handle mouse up + */ + __neh_mouseup: function(event) + { + var target = Event.element( event ); + + Event.stopObserving( target, 'mouseup', this.mouseup_closure , false ); + Event.stopObserving( target, 'mousemove', this.drag_closure , false ); + }, + + /** + Handle mousemove + */ + __neh_drag: function(event) + { + debug("Mouse move"); + Event.stop( event ); + + var target = Event.element( event ); + Event.stopObserving( target, 'mouseup', this.mouseup_closure , false ); + Event.stopObserving( target, 'mousemove', this.drag_closure , false ); + + DragDrop.startDrag(this.__instance, event, null); + }, + + /** + * Handle cancel selection + */ + __neh_disposeSelection: function(event) + { + if ( !this.__allowSelection ) + { + if(document.selection) + { + document.selection.empty(); + } + else if(window.getSelection) + { + var selection = window.getSelection(); + if(selection) + { + selection.removeAllRanges(); + } + } + } + }, + + /** + * Handle enable selection for dialog controls. + * + * @obj, incoming target object + * @return, void + */ + __enableSelection: function( obj ) + { + Event.observe( obj, 'select', this.enableSelection_closure , false ); + Event.observe( obj, 'selectstart', this.enableSelection_closure , false ); + Event.observe( obj, 'mouseup', this.enableSelection_closure , false ); + }, + + /** + * Handle enable selection event. + * + * @event, incoming browser native event + * @return, void + */ + __neh_enableSelection: function( event ) + { + event.cancelBubble = true; + }, + + /** + * Handle native event 'resize'. + * + * @event, incoming browser native event + * @return, void + */ + __neh_resize : function( event ) + { + BirtPosition.center( this.__instance ); + }, + + __neh_cancel: function() + { + this.__l_hide( ); + }, + + __neh_okay: function() + { + this.__okPress( ); + }, + + /** + ABSTRACT - Handle clicking on ok. + */ + __okPress: function( ) + { + //ABSTRACT - needs to be implemented by extending class + }, + + //TODO change so called once + __setWidth: function() + { + // In Mozilla 1.4 or lower version, if don't set overflow as "auto",then + // clientWidth/clientHeight always return zero. The display is incorrect. + // So add the following section. + if ( this.__instance.clientWidth <= 0) + { + this.__instance.style.overflow = "auto"; + } + + var contentHolder = $(this.contentHolderName); + var innerWidth = contentHolder.offsetWidth; + var outerWidth = this.__instance.clientWidth; + var difference = outerWidth - innerWidth; + contentHolder.style.width = this.contentHolderWidth + 'px'; + var newOuterWidth = contentHolder.offsetWidth + difference; + this.__instance.style.width = newOuterWidth + 'px'; + + this.__iframe.style.width = this.__instance.offsetWidth + 'px'; + this.__iframe.style.height = this.__instance.offsetHeight + 'px'; + + //move iframe to true top, left + //assumes that top/bottom left/right borders are same width + if(this.__iframe.clientWidth > 0) + { + this.__iframe.style.top = (this.__instance.clientHeight - this.__instance.offsetHeight)/2 + 'px'; + this.__iframe.style.left = (this.__instance.clientWidth - this.__instance.offsetWidth)/2 + 'px'; + } + }, + + /** + * Shows or hide the title bar. + * @param visible visibility flag + */ + __setTitleBarVisibile : function(visible) + { + // Hide dialog title bar if embedded in designer. + var titleBar = $( this.htmlId + 'dialogTitleBar' ); + titleBar.style.display = visible?'inline':'none'; + }, + + /** + @returns html id attribute of associated html element for this dialog + */ + getHtmlId: function() + { + return this.htmlId; + }, + + /** + * This event handler is called whenever an operation has been cancelled. + * If the dialog box is visible, sets the cancelled flag to true. + */ + __beh_cancelOperation : function() + { + if ( this.visible ) + { + this.__operationCancelled = true; + } + } + +} \ No newline at end of file diff --git a/WebContent/webcontent/birt/ajax/ui/dialog/AbstractExceptionDialog.js b/WebContent/webcontent/birt/ajax/ui/dialog/AbstractExceptionDialog.js new file mode 100644 index 0000000..4ba6be8 --- /dev/null +++ b/WebContent/webcontent/birt/ajax/ui/dialog/AbstractExceptionDialog.js @@ -0,0 +1,126 @@ +/****************************************************************************** + * Copyright (c) 2004 Actuate Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Actuate Corporation - Initial implementation. + *****************************************************************************/ + +/** + * Birt error dialog. + */ +AbstractExceptionDialog = function( ) { }; + +AbstractExceptionDialog.prototype = Object.extend( new AbstractBaseDialog( ), +{ + __faultCode : "", + + __setFaultContainersWidth: function( width ) + { + document.getElementById("faultStringContainer").style.width = width; + document.getElementById("exceptionTraceContainer").style.width = width; + }, + + + /** + * Formats the given stack trace for HTML output. + * @param data stack trace + * @return formatted HTML data + */ + __formatStackTrace : function( data ) + { + if ( !data ) + { + return ""; + } + return data.replace(/\r?\n/g,"
").replace(/[\s]{1}at/g,"   at"); + }, + + /** + * Binding data to the dialog UI. Data includes zoom scaling factor. + * + * @data, data DOM tree (schema TBD) + * @return, void + */ + __bind: function( data ) + { + if( !data ) + { + return; + } + + var oSpans = this.__instance.getElementsByTagName( 'SPAN' ); + + // Prepare fault string (reason) + var faultStrings = data.getElementsByTagName( 'faultstring' ); + if ( faultStrings[0] && faultStrings[0].firstChild ) + { + oSpans[0].innerHTML = faultStrings[0].firstChild.data; + } + else + { + oSpans[0].innerHTML = ""; + } + + // Prepare fault detail (Stack traces) + var faultDetail = data.getElementsByTagName( 'string' ); + if ( faultDetail && faultDetail.length > 0 ) + { + var detailSpan = oSpans[1]; + for ( var detailIndex = 0; detailIndex < faultDetail.length; detailIndex++ ) + { + if ( faultDetail[detailIndex].hasChildNodes() ) + { + var detailNodes = faultDetail[detailIndex].childNodes; + if ( detailIndex > 0 ) + { + detailSpan.appendChild( document.createElement("hr") ); + } + var detailElement = document.createElement("div"); + detailElement.style.whiteSpace = "nowrap"; + if ( detailIndex > 0 ) + { + detailElement.style.borderTopStyle = "solid"; + detailElement.style.borderTopWidth = "1px"; + } + + for ( var textIndex = 0; textIndex < detailNodes.length; textIndex++ ) + { + var stackTrace = detailNodes[textIndex].data; + stackTrace = this.__formatStackTrace( stackTrace ) + var stackTraceElement = document.createElement("span"); + stackTraceElement.innerHTML = stackTrace; + detailElement.appendChild( stackTraceElement ); + detailSpan.appendChild(detailElement); + } + } + } + } + else + { + oSpans[1].innerHTML = ""; + } + + var faultCodeElement = data.getElementsByTagName( 'faultcode' ); + if ( faultCodeElement[0] && faultCodeElement[0].firstChild ) + { + this.__faultCode = faultCodeElement[0].firstChild.data; + } + else + { + this.__faultCode = ""; + } + + if ( this.__faultCode == "DocumentProcessor.getPageNumber( )" ) + { + birtEventDispatcher.broadcastEvent( + birtEvent.__E_GETPAGE_INIT, + { name : Constants.PARAM_PAGE, value : 1 } + ); + } + + } +} ); \ No newline at end of file diff --git a/WebContent/webcontent/birt/ajax/ui/dialog/AbstractParameterDialog.js b/WebContent/webcontent/birt/ajax/ui/dialog/AbstractParameterDialog.js new file mode 100644 index 0000000..3314cfa --- /dev/null +++ b/WebContent/webcontent/birt/ajax/ui/dialog/AbstractParameterDialog.js @@ -0,0 +1,278 @@ +/****************************************************************************** + * Copyright (c) 2004 Actuate Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Actuate Corporation - Initial implementation. + *****************************************************************************/ + +/** + * BirtParameterDialog + * ... + */ +AbstractParameterDialog = function( ) { }; + +AbstractParameterDialog.prototype = Object.extend( new AbstractBaseDialog( ), +{ + /** + *__parameter to store "name" and "value" pairs + */ + __parameter : [], + + /** + *__cascadingParameter to store "name" and "value" pairs + */ + __cascadingParameter : [], + + /** + * Event handler closures. + */ + __neh_click_radio_closure : null, + __neh_change_select_closure : null, + + /** + * Initialize dialog base. + * @return, void + */ + initializeBase : function( id ) + { + this.__initBase( id, '500px' ); + this.__z_index = 200; + + this.__neh_click_radio_closure = this.__neh_click_radio.bindAsEventListener( this ); + this.__neh_change_select_closure = this.__neh_change_select.bindAsEventListener( this ); + + this.__local_installEventHandlers(id); + }, + + /** + * Binding data to the dialog UI. Data includes zoom scaling factor. + * @data, data DOM tree (schema TBD) + * @return, void + */ + __bind : function( data ) + { + this.__propogateCascadeParameter( data ); + }, + + /** + * Binding data to the dialog UI. Data includes zoom scaling factor. + * @data, data DOM tree (schema TBD) + * @return, void + */ + __propogateCascadeParameter : function( data ) + { + if ( this.__operationCancelled ) + { + return; + } + + if( data ) + { + var cascade_param = data.getElementsByTagName( 'CascadeParameter' )[0];//assume there is only one cascadeparameter + var selectionLists = data.getElementsByTagName( 'SelectionList' ); + if ( !selectionLists ) + { + return; + } + + for ( var k = 0; k < selectionLists.length; k++ ) + { + var param_name = selectionLists[k].getElementsByTagName( 'Name' )[0].firstChild.data; + var selections = selectionLists[k].getElementsByTagName( 'Selections' ); + + var append_selection = document.getElementById( param_name + "_selection" ); + append_selection.title = ""; + var len = append_selection.options.length; + + // Clear our selection list. + for( var i = 0, index = 0; i < len; i++ ) + { + /* + if ( append_selection.options[index].value == "" ) + { + index++; + continue; + } + */ + append_selection.remove( index ); + } + + // Add new options based on server response. + for( var i = 0; i < selections.length; i++ ) + { + if ( !selections[i].firstChild ) + { + continue; + } + + var oOption = document.createElement( "OPTION" ); + var oLabel = selections[i].getElementsByTagName( 'Label' ) + if ( oLabel && oLabel.length > 0 ) + { + oLabel = oLabel[0].firstChild; + } + if( oLabel ) + oOption.text = oLabel.data; + else + oOption.text = ""; + + var oValue = selections[i].getElementsByTagName( 'Value' ); + if ( oValue && oValue.length > 0 ) + { + oValue = oValue[0].firstChild; + } + if( oValue ) + oOption.value = oValue.data; + else + oOption.value = ""; + append_selection.options[append_selection.options.length] = oOption; + } + } + } + }, + + /** + * Install native/birt event handlers. + * + * @id, toolbar id (optional since there is only one toolbar) + * @return, void + */ + __local_installEventHandlers : function( id ) + { + //install UIComponent native handler + var oTBC = document.getElementById("parameter_table").getElementsByTagName( 'TABLE' ); + for( var k = 0, counter = 0; k < oTBC.length; k++ ) + { + var temp = oTBC[k].getElementsByTagName( 'TABLE' ); + if( !temp.length ) + { + //install select event handler in cascade parameters + this.__install_cascade_parameter_event_handler( oTBC[k], counter++ ); + } + } + + var oTRC = document.getElementById( "parameter_table" ).getElementsByTagName( "TR" ); + for( var i = 0; i < oTRC.length; i++ ) + { + var oInput = oTRC[i].getElementsByTagName( "input" ); + var oTable = oTRC[i].getElementsByTagName( "table" ); + if( oTable.length > 0 ) + { + continue; + } + //find radio with textbox or select items to install event listener. + var flag = false; + for( var j = 0; j < oInput.length; j++ ) + { + if( oInput[j].type == "radio" && !flag ) + { + var tempRadio = oInput[j]; + flag = true; + continue; + } + + if( oInput[j].type == "radio" && tempRadio != {} && oInput[j].id != tempRadio.id ) + { + Event.observe( tempRadio, 'click', this.__neh_click_radio_closure, false ); + Event.observe( oInput[j], 'click', this.__neh_click_radio_closure, false ); + } + } + } + }, + + /** + * Handle clicking on ok. + * + * @event, incoming browser native event + * @return, void + */ + __okPress : function( ) + { + if( birtParameterDialog.collect_parameter( ) ) + { + birtEventDispatcher.broadcastEvent( birtEvent.__E_CHANGE_PARAMETER ); + this.__l_hide( ); + } + }, + + /** + * Handle clicking on radio. + * + * @event, incoming browser native event + * @return, void + */ + __neh_click_radio : function( event ) + { + var temp = Event.element( event ); + var oInput = temp.parentNode.getElementsByTagName( "input" ); + var oSelect = temp.parentNode.getElementsByTagName( "select" ); + + for( var i = 0; i < oInput.length; i++ ) + { + if( oInput[i].id == temp.id ) + { + //enable the next component + oInput[i].checked = true; + if( oInput[i+1] && ( oInput[i+1].type == "text" || oInput[i+1].type == "password" ) ) + { + oInput[i+1].disabled = false; + oInput[i+1].focus( ); + } + else if( oSelect[0] ) + { + oSelect[0].disabled = false; + oSelect[0].focus( ); + } + } + else if( oInput[i].type == "radio" && oInput[i].id != temp.id ) + { + //disable the next component and clear the radio + oInput[i].checked = false; + if( oInput[i+1] && ( oInput[i+1].type == "text" || oInput[i+1].type == "password" ) ) + { + oInput[i+1].disabled = true; + } + else if( oSelect[0] ) + { + oSelect[0].disabled = true; + } + } + } + }, + + /** + * Handle change event when clicking on select. + * + * @event, incoming browser native event + * @return, void + */ + __neh_change_select : function( event ) + { + var matrix = new Array( ); + var m = 0; + for( var i = 0; i < this.__cascadingParameter.length; i++ ) + { + for( var j = 0; j < this.__cascadingParameter[i].length; j++ ) + { + if( this.__cascadingParameter[i][j].name == Event.element( event ).id.substr( 0, Event.element( event ).id.length - 10 ) ) + { + this.__cascadingParameter[i][j].value = Event.element( event ).options[Event.element( event ).selectedIndex].value; + for( var m = 0; m <= j; m++ ) + { + if( !matrix[m] ) + { + matrix[m] = {}; + } + matrix[m].name = this.__cascadingParameter[i][m].name; + matrix[m].value = this.__cascadingParameter[i][m].value; + } + birtEventDispatcher.broadcastEvent( birtEvent.__E_CASCADING_PARAMETER, matrix ); + } + } + } + } +} ); \ No newline at end of file diff --git a/WebContent/webcontent/birt/ajax/ui/dialog/BirtConfirmationDialog.js b/WebContent/webcontent/birt/ajax/ui/dialog/BirtConfirmationDialog.js new file mode 100644 index 0000000..c8183d6 --- /dev/null +++ b/WebContent/webcontent/birt/ajax/ui/dialog/BirtConfirmationDialog.js @@ -0,0 +1,63 @@ +/****************************************************************************** + * Copyright (c) 2004 Actuate Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Actuate Corporation - Initial implementation. + *****************************************************************************/ + +/** + * Birt confirmation dialog. + */ +BirtConfirmationDialog = Class.create( ); + +BirtConfirmationDialog.prototype = Object.extend( new AbstractBaseDialog( ), +{ + + /** + * Initialization routine required by "ProtoType" lib. + * @return, void + */ + initialize : function( id ) + { + this.__initBase( id ); + this.__z_index = 200; + }, + + /** + * Handle clicking on ok. + * + * @return, void + */ + __okPress : function( ) + { + this.__l_hide( ); + }, + + /** + Called right before element is shown + */ + __preShow: function() + { + // disable the toolbar buttons + birtUtility.setButtonsDisabled ( "toolbar", true ); + + // disable the Navigation Bar buttons + birtUtility.setButtonsDisabled ( "navigationBar", true ); + }, + + /** + Called before element is hidden + */ + __preHide: function() + { + // enable the toolbar buttons + birtUtility.setButtonsDisabled ( "toolbar", false ); + + // enable the Navigation Bar buttons + birtUtility.setButtonsDisabled ( "navigationBar", false ); + } +} ); \ No newline at end of file diff --git a/WebContent/webcontent/birt/ajax/ui/dialog/BirtExceptionDialog.js b/WebContent/webcontent/birt/ajax/ui/dialog/BirtExceptionDialog.js new file mode 100644 index 0000000..cd90044 --- /dev/null +++ b/WebContent/webcontent/birt/ajax/ui/dialog/BirtExceptionDialog.js @@ -0,0 +1,202 @@ +/****************************************************************************** + * Copyright (c) 2004 Actuate Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Actuate Corporation - Initial implementation. + *****************************************************************************/ + +/** + * Birt error dialog. + */ +BirtExceptionDialog = Class.create( ); + +BirtExceptionDialog.prototype = Object.extend( new AbstractExceptionDialog( ), +{ + /** + * indicate whether exception detail is show or not. + */ + __isShow: false, + + /** + * control id definitions + */ + __TRACE_CONTAINER: 'exceptionTraceContainer', + __LABEL_SHOW_TRACE: 'showTraceLabel', + __LABEL_HIDE_TRACE: 'hideTraceLabel', + + _showTraceLabel : null, + _hideTraceLabel : null, + + /** + * Event handler closures. + */ + __neh_click_input_closurre : null, + + /** + * Initialization routine required by "ProtoType" lib. + * + * @return, void + */ + initialize : function( id ) + { + var dialogWidth = (Constants.request.servletPath == Constants.SERVLET_PARAMETER)?500:600; + if ( BrowserUtility.isIE && !BrowserUtility.isIE7 ) + { + dialogWidth -= 55; + } + + this.__initBase( id, dialogWidth + "px" ); + this.__allowSelection = true; // allow selecting text with the mouse + + // it looks like IE 6 handles the width differently + var faultDetailContainer = $( "faultdetail" ); + var faultStringContainer = $("faultStringContainer"); + if ( BrowserUtility.isIE && !BrowserUtility.isIE7 ) + { + this.__setFaultContainersWidth( ( dialogWidth - 20 ) + "px" ); + faultStringContainer.style.overflowX = "auto"; + faultStringContainer.style.paddingBottom = "20px"; + faultDetailContainer.parentNode.style.width = ( dialogWidth - 30 ) + "px"; + faultDetailContainer.style.width = "100%"; + } + else + { + this.__setFaultContainersWidth( ( dialogWidth - 80 ) + "px" ); + faultStringContainer.style.overflow = "auto"; + } + + // Bugzilla 225924: Fix overflow issue in the stack trace container + if ( BrowserUtility.isSafari || BrowserUtility.isIE7 || ( BrowserUtility.isGecko && !BrowserUtility.isFirefox2 ) ) + { + faultDetailContainer.parentNode.style.width = (dialogWidth - 90 ) + "px"; + } + + if ( Constants.request.servletPath == Constants.SERVLET_PARAMETER ) + { + // Hide dialog title bar if embedded in designer. + this.__setTitleBarVisibile(false); + // expand the dialog's height + var contentContainer = $( id + "dialogContentContainer"); + contentContainer.style.height = "355px"; + } + + this.__z_index = 300; + + // click event on input control + this._showTraceLabel = $( this.__LABEL_SHOW_TRACE ); + this._showTraceLabel.tabIndex = 0; + this._hideTraceLabel = $( this.__LABEL_HIDE_TRACE ); + this._hideTraceLabel.tabIndex = 0; + + this.__neh_click_input_closure = this.__neh_click_input.bindAsEventListener( this ); + this.__neh_key_input_closure = this.__neh_key_input.bindAsEventListener( this ); + Event.observe( this._showTraceLabel, 'click', this.__neh_click_input_closure, false ); + Event.observe( this._showTraceLabel, 'keyup', this.__neh_key_input_closure, false ); + Event.observe( $( this._hideTraceLabel ), 'click', this.__neh_click_input_closure, false ); + Event.observe( this._hideTraceLabel, 'keyup', this.__neh_key_input_closure, false ); + }, + + __neh_key_input: function( event ) + { + if ( event.keyCode == 13 || event.keyCode == 32 ) + { + this.__neh_click_input(); + } + }, + + /** + * Handle clicking on input control. + * + * @return, void + */ + __neh_click_input: function( event ) + { + if( !this.__isShow ) + { + $( this.__TRACE_CONTAINER ).style.display = "block"; + $( this.__LABEL_SHOW_TRACE ).style.display = "none"; + $( this.__LABEL_HIDE_TRACE ).style.display = "block"; + var that = this; + window.setTimeout( function() { that._hideTraceLabel.focus(); }, 0 ); + } + else + { + $( this.__TRACE_CONTAINER ).style.display = "none"; + $( this.__LABEL_SHOW_TRACE ).style.display = "block"; + $( this.__LABEL_HIDE_TRACE ).style.display = "none"; + var that = this; + window.setTimeout( function() { that._showTraceLabel.focus(); }, 0 ); + } + + this.__isShow = !this.__isShow; + + // refresh the dialog size (Mozilla/Firefox element resize bug) + birtUtility.refreshElement(this.__instance); + + if ( Constants.request.servletPath == Constants.SERVLET_PARAMETER ) + { + // in designer mode, recenter the dialog + BirtPosition.center( this.__instance ); + } + }, + + __bind : function( data ) + { + // call to super + AbstractExceptionDialog.prototype.__bind.apply( this, arguments ); + + var label = this._showTraceLabel; + // defer + setTimeout(function(){ + // cause any focussed element to lose focus + // (ex: opened drop-down lists) + label.focus(); + label.blur(); + },50); + }, + + /** + * Handle clicking on ok. + * + * @return, void + */ + __okPress: function( ) + { + this.__l_hide( ); + }, + + /** + Called right before element is shown + */ + __preShow: function() + { + // disable the toolbar buttons + birtUtility.setButtonsDisabled ( "toolbar", true ); + + // disable the Navigation Bar buttons + birtUtility.setButtonsDisabled ( "navigationBar", true ); + + // close the exception stack trace + $( this.__TRACE_CONTAINER ).style.display = 'none'; + $( this.__LABEL_SHOW_TRACE ).style.display = "block"; + $( this.__LABEL_HIDE_TRACE ).style.display = "none"; + + this.__isShow = false; + }, + + /** + Called before element is hidden + */ + __preHide: function() + { + // enable the toolbar buttons + birtUtility.setButtonsDisabled ( "toolbar", false ); + + // enable the Navigation Bar buttons + birtUtility.setButtonsDisabled ( "navigationBar", false ); + } +} ); \ No newline at end of file diff --git a/WebContent/webcontent/birt/ajax/ui/dialog/BirtExportReportDialog.js b/WebContent/webcontent/birt/ajax/ui/dialog/BirtExportReportDialog.js new file mode 100644 index 0000000..4d64341 --- /dev/null +++ b/WebContent/webcontent/birt/ajax/ui/dialog/BirtExportReportDialog.js @@ -0,0 +1,314 @@ +/****************************************************************************** + * Copyright (c) 2004 Actuate Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Actuate Corporation - Initial implementation. + *****************************************************************************/ + +/** + * Birt export report dialog. + */ +BirtExportReportDialog = Class.create( ); + +BirtExportReportDialog.prototype = Object.extend( new AbstractBaseDialog( ), +{ + __neh_select_change_closure : null, + __neh_radio_click_closure : null, + + /** + * Initialization routine required by "ProtoType" lib. + * @return, void + */ + initialize : function( id ) + { + this.__initBase( id ); + this.__z_index = 200; + + this.__enableExtSection( ); + + // Binding + this.__neh_select_change_closure = this.__neh_select_change.bindAsEventListener( this ); + this.__neh_radio_click_closure = this.__neh_radio_click.bindAsEventListener( this ); + + this.__installEventHandlers( id ); + }, + + /** + * Install native/birt event handlers. + * + * @id, toolbar id (optional since there is only one toolbar) + * @return, void + */ + __installEventHandlers : function( id ) + { + var oSelects = this.__instance.getElementsByTagName( 'select' ); + Event.observe( oSelects[0], 'change', this.__neh_select_change_closure, false ); + + var oInputs = $( 'exportPageSetting' ).getElementsByTagName( 'input' ); + for( var i=0; i