<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="validator" uri="http://www.springmodules.org/tags/commons-validator"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<form:form commandName="weakPlaceVO" id="detailForm" name="detailForm" enctype="multipart/form-data">
	<form:hidden path="writer" />
	<c:forEach var="list" items="${wpNoMap}" varStatus="num">
		<input type="hidden" id="hdWpNo_${list.key}" value="${list.value}" />
	</c:forEach>
   	<div id="table">
   	<table class="tbl_add">
   		<colgroup>
   			<col width="150"/>
   			<col width="?"/>
   		</colgroup>
   		<tr>
   			<th>
   				<label for="title"><spring:message code="target.wp.wpNoStr" /></label>
   			</th>
   			<td>
   				<c:choose>
   					<c:when test="${weakPlaceVO.place1 == 'PS00' and registerFlag == 'create'}">
						<form:select path="place1" cssClass="use" onchange="changePlace(this.value);">
							<c:forEach var="result" items="${placeList}" varStatus="status">
								<form:option value="${result.code2}" label="${result.codenmYak}" />
							</c:forEach>
		    			</form:select>
   					</c:when>
   					<c:otherwise>
		   				<label>${weakPlaceVO.place1str}</label>
						<form:hidden path="place1" />
					</c:otherwise>	
				</c:choose>
				&nbsp;-&nbsp;
				<span id="spanWpNo">${weakPlaceVO.wpNo}</span>
				<form:hidden path="wpNo" />				
   			</td>
   		</tr>
   		<tr>
   			<th><label for="title"><spring:message code="target.wp.name" /></label></th>
   			<td class="tbtd_content">
   				<form:input path="name" cssClass="txt" />
   			</td>
   		</tr>   		
   		<tr>
   			<th><label for="title"><spring:message code="target.wp.location" /></label></th>
   			<td class="tbtd_content">
   				<form:input path="location" cssClass="txt" />
   			</td>
   		</tr>
   		<tr>
   			<th><label for="title"><spring:message code="target.wp.comments" /></label></th>
   			<td class="tbtd_content">
   				<form:textarea path="comments" cssClass="ta" />
   			</td>
   		</tr>   		
   		<tr>
   			<th><label for="title"><spring:message code="target.wp.filename1" /></label></th>
   			<td class="tbtd_content">
   				<c:choose>
			    	<c:when test="${registerFlag != 'modify'}">
			       		<p><input type="file" name="file1" class="input_file" size="60" /></p>
			       	</c:when>
			       	<c:otherwise>
			       		<form:hidden path="filename1" />
			      		<p>
			      			<c:choose>
				      			<c:when test="${fn:length(weakPlaceVO.filename1) > 0}">
				       				<input type="checkbox" name="deleteFile" value="1"/>
				       				<c:out value="${weakPlaceVO.filename1}"/>는 삭제합니다.
				       			</c:when>
				       			<c:otherwise>
				       				<input type="file" name="file1" class="input_file" size="60" />
			       				</c:otherwise>
		       				</c:choose>
				    	</p>
			       	</c:otherwise>
		       	</c:choose>
   			</td>
   		</tr>
   		<tr>
   			<th><label for="title"><spring:message code="target.wp.filename2" /></label></th>
   			<td class="tbtd_content">
   				<c:choose>
			    	<c:when test="${registerFlag != 'modify'}">
			       		<p><input type="file" name="file2" class="input_file" size="60" /></p>
			       	</c:when>
			       	<c:otherwise>
			       		<form:hidden path="filename2" />
			      		<p>
			      			<c:choose>
				      			<c:when test="${fn:length(weakPlaceVO.filename2) > 0}">
				       				<input type="checkbox" name="deleteFile" value="2"/>
				       				<c:out value="${weakPlaceVO.filename2}"/>는 삭제합니다.
				       			</c:when>
				       			<c:otherwise>
				       				<input type="file" name="file2" class="input_file" size="60" />
			       				</c:otherwise>
		       				</c:choose>
				    	</p>
			       	</c:otherwise>
		       	</c:choose>
   			</td>
   		</tr>
   	</table>
    </div>
    
    <div class="boardviewinfo">
		<ul class="right btn-style">
  			<li>
  				<a href="javascript:fn_selectList();"><spring:message code="button.goList" /></a>
            </li>
   			<li>
   				<c:choose>
	      			<c:when test="${registerFlag == 'modify'}">
	       				<a href="/target/weakplace/view.do?place1=<c:out value="${weakPlaceVO.place1}"/>&wpNo=<c:out value="${weakPlaceVO.wpNo}"/>"><spring:message code="button.cancel" /></a>
	       			</c:when>
	       			<c:otherwise>
	    			<a href="/target/weakplace/list.do"><spring:message code="button.cancel" /></a>
	    			</c:otherwise>
   				</c:choose>            	
            </li>
   			<li>
   				<a href="javascript:fn_save();">
                   	<c:if test="${registerFlag == 'create'}">
                   		<spring:message code="button.goCreate" />
                   	</c:if>
                   	<c:if test="${registerFlag == 'modify'}">
                   		<spring:message code="button.goModify" />
                   	</c:if>
               	</a>
            </li>
		</ul>	
	</div>
   	<!-- <div id="sysbtn">
   		<ul>
   			<li>
            	<span class="btn_blue_l">
                	<a href="javascript:fn_selectList();"><spring:message code="button.goList" /></a>
                    <img src="<c:url value='/images/rte/btn_bg_r.gif'/>" style="margin-left:6px;" alt="<spring:message code='button.goList' />"/>
               	</span>
            </li>
   			<li>
            	<span class="btn_blue_l">
	      			<c:choose>
		      			<c:when test="${registerFlag == 'modify'}">
		       				<a href="/target/weakplace/view.do?place1=<c:out value="${weakPlaceVO.place1}"/>&wpNo=<c:out value="${weakPlaceVO.wpNo}"/>"><spring:message code="button.cancel" /></a>
		       			</c:when>
		       			<c:otherwise>
			    			<a href="/target/weakplace/list.do"><spring:message code="button.cancel" /></a>
	       				</c:otherwise>
       				</c:choose>            	
                    <img src="<c:url value='/images/rte/btn_bg_r.gif'/>" style="margin-left:6px;" alt="<spring:message code="button.cancel" />"/>
               	</span>
            </li>            
   			<li>
            	<span class="btn_blue_l">
                   	<a href="javascript:fn_save();">
                       	<c:if test="${registerFlag == 'create'}">
                       		<spring:message code="button.goCreate" />
                       		<img src="<c:url value='/images/rte/btn_bg_r.gif'/>" style="margin-left:6px;" alt="<spring:message code="button.goCreate" />"/>
                       	</c:if>
                       	<c:if test="${registerFlag == 'modify'}">
                       		<spring:message code="button.goModify" />
                       		<img src="<c:url value='/images/rte/btn_bg_r.gif'/>" style="margin-left:6px;" alt="<spring:message code="button.goModify" />"/>
                       	</c:if>
                   	</a>
                   	
               	</span>
          	</li>
   		</ul>
   	</div> -->
</form:form>


<script type="text/javascript" src="<c:url value='/validator.do'/>"></script>
<validator:javascript formName="weakPlaceVO" staticJavascript="false" xhtml="true" cdata="false"/>
<script type="text/javaScript" defer="defer">
<!--
	function fn_selectList(){
		location.href = "<c:url value='/target/weakplace/list.do'/>";
	}
	
	function fn_save(){
    	frm = document.detailForm;
    	if(!validateWeakPlaceVO(frm)){
            return;
        }else{
           	frm.submit();
        }		
	}
	
	function changePlace(place1) {
		var wpNo = $('#hdWpNo_'+place1).val();
		
		$('#spanWpNo').html(wpNo);
		$('#wpNo').val(wpNo);	
	}
-->	
</script>