<?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="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="OPTIONATTR" value="{@OPTIONATTR} 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="CLAZZ_OTHER" />

				<og:value command="SQL">
					select A.KVAL,A.KNAME,A.IMGKVAL,A.FGOTHER,A.RKCODE,A.FGCORRECT
					from AN03 A
					where UNIQ = '{@AN03_UNIQ}'
				</og:value>

				<og:equals val1="{@FGOTHER}" val2="1">
					<og:value command="SET" key="CLAZZ_OTHER" value="other" />
				</og:equals>
				<og:equals val1="{@RKCODE}" nullCheck="true" notEquals="true">
					<og:value command="SET" key="OPTATTR_RKCODE" value="rkcode='{@RKCODE}'" />
				</og:equals>

				<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}" optionAttributes="{@OPTIONATTR} {@OPTATTR_RKCODE}" />
					{@KNAME}

					<og:equals val1="{@IMGKVAL}" nullCheck="true" notEquals="true">
						<a href="{@SYS.CONTEXT_URL}ankimages/{@IMGKVAL}" target="IMAGE">
							<img src="{@SYS.CONTEXT_URL}ankimages/{@IMGKVAL}" width="50px" height="50px" alt="{@KNAME}" />
						</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="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
							from AN03 A
							where UNIQ = '{@AN03_UNIQ}'
						</og:value>
						<og:option value="{@KVAL}" lbl="{@KNAME}" />
					</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>
