<?xml version="1.0" encoding="UTF-8" ?>
<jsp:root
	xmlns:jsp="http://java.sun.com/JSP/Page"
	xmlns:og="hybs-taglib.tld" 
	version="2.0">
<jsp:directive.page language="java" contentType="application/x-javascript; charset=UTF-8;"
 import="java.util.HashMap,java.util.Map,org.opengion.hayabusa.db.DBEventColumn" />
<jsp:scriptlet>
<![CDATA[
	String key = request.getParameter( "key" );
	HashMap<String,DBEventColumn> ecmap = (HashMap<String, DBEventColumn>)( session.getAttribute( key ) );
	if( ecmap == null ){ return; }
	else { session.removeAttribute( key ); }

	response.setHeader("Cache-Control","max-age=0");

	out.println( "EC_NAME = new Array();" );
	out.println( "EC_EVCOL = new Array();" );

	int cnt = 0;
	for( Map.Entry<String, DBEventColumn> entry : ecmap.entrySet() ) {
		String name = entry.getKey();
		DBEventColumn evCol = entry.getValue();
		out.println( "EC_NAME[" + cnt + "] = \"" + name + "\";" );
		out.println( "EC_EVCOL[" + cnt + "] = \"" + evCol.getEventColumn() + "\";" );

		out.println( "EC_" + name + "_URL = \"" + evCol.getEventURL() + "\";" );
		out.println( "EC_" + name + "_RENDERER = \"" + ( evCol.getRenderer() == null ? "" : evCol.getRenderer() ) + "\";" );
		out.println( "EC_" + name + "_EDITOR = \"" + ( evCol.getEditor() == null ? "" : evCol.getEditor() ) + "\";" );
		// 改行はスペースに置換してしまう。"は\"に変更。
		String editParam = evCol.getEditParam();
		out.println( "EC_" + name + "_EDITPARAM = \"" + ( editParam == null ? "" : editParam.replace("\r","").replace("\n"," ").replace("\"", "\\\"") ) + "\";" );
		// 改行はスペースに置換してしまう。"は\"に変更。
		String rendParam = evCol.getRendParam();
		out.println( "EC_" + name + "_RENDPARAM = \"" + ( rendParam == null ? "" : rendParam.replace("\r","").replace("\n"," ").replace("\"", "\\\"") ) + "\";" );

		cnt++;
	}
]]>
</jsp:scriptlet>

</jsp:root>
