<?xml version="1.0" encoding="UTF-8" ?>
<jsp:root
	xmlns:jsp="http://java.sun.com/JSP/Page"
	xmlns:og="hybs-taglib.tld"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions"
	version="2.0">
<jsp:directive.page language="java" contentType="text/html; charset=UTF-8" />

<!-- Required Parameter AN02_UNIQ(String) -->
<!-- Optional Parameter FGSHUBETSU(String,DISABLE(boolean),PREVIEW(boolean) -->

<og:value command="REMOVE" key="RSCODE" />
<og:value command="REMOVE" key="INIVAL" />
<og:value command="REMOVE" key="VDCDTN" />
<og:value command="SQL">
	select A.KBUNRUI
			,case
				when '{@DISABLE}' = 'true' then		'false'
				when A.FGMUST = '1' then			'true'
				else								'false' end MUST
			,case
				when '{@DISABLE}' = 'true' then		'4,30'
				else								'4,60' end PARAM
			,A.FGMUST
			,A.SUONELINE
			,A.RSCODE
			,A.INIVAL
			,A.VDCDTN
			,'{@SYS.SYSTEM_ID}_'||A.CDANK||'_'||A.CDSITSU CLM
			,'{@SYS.SYSTEM_ID}_'||A.CDANK CLM_SCL
	from AN02 A
	where UNIQ = '{@AN02_UNIQ}'
</og:value>

<og:value command="REMOVE" key="OPTIONATTR" />
<og:value command="REMOVE" key="CLAZZ" />

<og:equals val1="{@DISABLE}" val2="true">
	<og:equals val1="{@FGMUST}" val2="1">
		<og:value command="SET" key="OPTIONATTR" value="disabled='true' style='background-color:palegoldenrod;'" />
	</og:equals>
	<og:equals val1="{@FGMUST}" val2="1" notEquals="true">
		<og:value command="SET" key="OPTIONATTR" value="disabled='true' style='background-color:lightgrey;'" />
	</og:equals>
</og:equals>
<og:equals val1="{@DISABLE}" val2="true" notEquals="true">
	<og:equals val1="{@INIVAL}" nullCheck="true" notEquals="true">
		<og:value command="SET" key="OPTIONATTR" value="disabled='true' style='background-color:palegoldenrod;'" />
	</og:equals>
	<og:equals val1="{@VDCDTN}" nullCheck="true" notEquals="true">
		<og:value command="SET" key="OPTIONATTR" value="{@OPTIONATTR} vdcdtn='{@VDCDTN}'" />
		<og:value command="SET" key="CLAZZ" value="vdcdtn" />
	</og:equals>
	<og:equals val1="{@RSCODE}" nullCheck="true" notEquals="true">
		<og:value command="SET" key="CLAZZ" value="{@CLAZZ} rscode_{@RSCODE}" />
	</og:equals>
</og:equals>

<og:equals val1="CHBOX|RADIO|MENU|SCALE" val2="{@KBUNRUI}" contains="true" notEquals="true">
	<li>
		<og:value command="SET" key="VALUE"><og:value command="GET" key="INIVAL" /></og:value>
		<og:column name="{@CLM}" must="{@MUST}" td="false" value="{@VALUE}" clazz="{@CLAZZ}" optionAttributes="{@OPTIONATTR}" param="{@PARAM}" />

		<og:equals val1="{@INIVAL}" nullCheck="true" notEquals="true">
			<og:hidden name="{@CLM}" value="{@VALUE}" />
		</og:equals>
	</li>
</og:equals>

<og:equals val1="CHBOX|RADIO|MENU|SCALE" val2="{@KBUNRUI}" contains="true">
	<og:value command="SQL" action="ROW_APPEND">
		select B.UNIQ AN03_UNIQS
		from AN02 A inner join AN03 B
		on A.USERID = B.USERID
		and A.CDANK = B.CDANK
		and A.CDSITSU = B.CDSITSU
		and B.FGJ in ('0','1')
		where A.UNIQ = '{@AN02_UNIQ}'
		and A.FGJ in ('0','1')
		order by B.SEQNO
	</og:value>

	<og:equals val1="{@AN03_UNIQS}" nullCheck="true" notEquals="true">

		<og:equals val1="CHBOX|RADIO" val2="{@KBUNRUI}" contains="true">
			<c:forTokens items="${AN03_UNIQS}" delims="," var="AN03_UNIQ" varStatus="status">

				<og:value command="REMOVE" key="IMGKVAL" />
				<og:value command="REMOVE" key="RKCODE" />
				<og:value command="REMOVE" key="FGIMGK" />
				<og:value command="SQL">
					select
						A.KVAL,A.KNAME,A.IMGKVAL,A.FGOTHER,A.RKCODE,A.FGCORRECT
						,case when A.IMGKVAL like '%.png' or A.IMGKVAL like '%.PNG'
							or A.IMGKVAL like '%.jpg' or A.IMGKVAL like '%.JPG'
							or A.IMGKVAL like '%.jpeg' or A.IMGKVAL like '%.JPEG'
							or A.IMGKVAL like '%.gif' or A.IMGKVAL like '%.GIF'
							or A.IMGKVAL like '%.bmp' or A.IMGKVAL like '%.BMP' then '1' else '0' end FGIMGK
					from AN03 A
					where UNIQ = '{@AN03_UNIQ}'
				</og:value>

				<og:value command="REMOVE" key="CLAZZ_OTHER" />
				<og:equals val1="{@FGOTHER}" val2="1">
					<og:value command="SET" key="CLAZZ_OTHER" value="other" />
				</og:equals>

				<og:value command="REMOVE" key="CLAZZ_RKCODE" />
				<og:equals val1="{@RKCODE}" nullCheck="true" notEquals="true">
					<og:value command="SET" key="CLAZZ_RKCODE" value="rkcode_{@RKCODE}" />
				</og:equals>

				<og:value command="REMOVE" key="FGFLOAT" />
				<og:value command="SET" key="FGFLOAT">${status.count%SUONELINE}</og:value>

				<og:text>
				<li style="float:left; margin-right:20px;">
					<og:column name="{@CLM}" must="{@MUST}" value="{@KVAL}" td="false" clazz="{@CLAZZ} {@CLAZZ_OTHER} {@CLAZZ_RKCODE}" optionAttributes="{@OPTIONATTR}" />
					{@KNAME}

					<og:equals val1="{@IMGKVAL}" nullCheck="true" notEquals="true">
						<a href="/{@SYS.CONTEXT_NAME}/ankimages/{@IMGKVAL}" target="IMAGE">
							<og:equals val1="{@FGIMGK}" val2="1">
								<img src="/{@SYS.CONTEXT_NAME}/ankimages/{@IMGKVAL}" width="50px" height="50px" alt="{@KNAME}" />
							</og:equals>
							<og:equals val1="{@FGIMGK}" val2="0">
								<img src="/{@SYS.CONTEXT_NAME}/jsp/image/text.gif" width="30px" height="30px" />
							</og:equals>
						</a>
					</og:equals>
				</li>

				<og:equals val1="{@FGOTHER}" val2="1">
					<li style="float:left; margin-right:20px;">&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
						<og:column name="{@CLM}" editor="TEXT" td="false" clazz="{@CLAZZ} otherText" optionAttributes="{@OPTIONATTR}" />
					</li>
				</og:equals>

				<og:equals val1="{@FGSHUBETSU}" val2="2">
					<og:equals val1="{@DISABLE}{@PREVIEW}" nullCheck="true" notEquals="true">
						<og:equals val1="{@FGCORRECT}" val2="1">
							<!-- ANM0038:(正解) -->
							<span style="color:red; "><b><og:text>{@LBL.ANM0038}</og:text></b></span>
						</og:equals>
					</og:equals>
				</og:equals>

				<og:equals val1="{@FGFLOAT}" val2="0">
					<li><br style="clear:both;" /></li>
				</og:equals>

				</og:text>
			</c:forTokens>
		</og:equals>

		<og:equals val1="MENU" val2="{@KBUNRUI}" contains="true">
			<li>
				<span>
				<og:select name="{@CLM}" value="" must="{@MUST}" td="false" clazz="{@CLAZZ}" optionAttributes="{@OPTIONATTR}">
					<og:option value="" lbl="" />
					<c:forTokens items="${AN03_UNIQS}" delims="," var="AN03_UNIQ" >
						<og:value command="SQL">
							select A.KVAL,A.KNAME,A.RKCODE
							from AN03 A
							where UNIQ = '{@AN03_UNIQ}'
						</og:value>

						<og:value command="REMOVE" key="CLAZZ_RKCODE" />
						<og:equals val1="{@RKCODE}" nullCheck="true" notEquals="true">
							<og:value command="SET" key="CLAZZ_RKCODE" value="rkcode_{@RKCODE}" />
						</og:equals>

						<og:option value="{@KVAL}" lbl="{@KNAME}" clazz="{@CLAZZ_RKCODE}" />
					</c:forTokens>
				</og:select>
				</span>
			</li>
		</og:equals>

		<og:equals val1="SCALE" val2="{@KBUNRUI}">
			<li>
				<table>
					<c:forTokens items="${AN03_UNIQS}" delims="," var="AN03_UNIQ" varStatus="status">
						<og:value command="SQL">
							select A.KVAL,A.KNAME,A.KSCALE
								, case when A.KSCALE &lt; 0 then -1*A.KSCALE else A.KSCALE end KSCALE_ABS
							from AN03 A
							where UNIQ = '{@AN03_UNIQ}'
						</og:value>
						<og:equals val1="${status.index}" val2="0">
							<tr>
								<th class="row_h"></th>
								<og:equals val1="{@KNOTE}" val2="," contains="true" notEquals="true">
									<th class="row_h" colspan="${KSCALE}"><og:text>{@KNOTE}</og:text></th>
								</og:equals>
								<og:equals val1="{@KNOTE}" val2="," contains="true">
									<c:forTokens items="${KNOTE}" delims="," var="KNT">
										<th class="row_h" style="font-size:small;"><og:text>{@KNT}</og:text></th>
									</c:forTokens>
								</og:equals>
							</tr>
						</og:equals>
						<tr class="row_${status.index%2}">
							<td><og:text>{@KNAME}</og:text></td>
							<c:forEach var="i" begin="0" end="${KSCALE_ABS-1}">
								<td align="center">
									&amp;nbsp;&amp;nbsp;
									<og:equals val1="{@KSCALE}" val2="{@KSCALE_ABS}">
										${KSCALE_ABS-i}<og:column name="{@CLM_SCL}_{@KVAL}" editor="RADIO2" must="{@MUST}" value="${KSCALE_ABS-i}" td="false" clazz="{@CLAZZ}" optionAttributes="{@OPTIONATTR}" />
									</og:equals>
									<og:equals val1="{@KSCALE}" val2="{@KSCALE_ABS}" notEquals="true">
										${i+1}<og:column name="{@CLM_SCL}_{@KVAL}" editor="RADIO2" must="{@MUST}" value="${i+1}" td="false" clazz="{@CLAZZ}" optionAttributes="{@OPTIONATTR}" />
									</og:equals>
									&amp;nbsp;&amp;nbsp;
								</td>
							</c:forEach>
						</tr>
					</c:forTokens>
				</table>
			</li>
		</og:equals>
	</og:equals>

</og:equals>

<li style="clear:left;">&amp;nbsp;</li>

</jsp:root>
