roadinspectionform.jsp

来自「Java的框架」· JSP 代码 · 共 423 行 · 第 1/2 页

JSP
423
字号
<%@ include file="/common/taglibs.jsp"%>

<c:set var="datetimeformat"><fmt:message key="datetime.format"/></c:set>
<c:set var="defaultPicCnt" value="2" />
<c:set var="maxPicCnt" value="6"/>	
<c:url value="/images/delete.gif" var="deleteImageUrl" />
<c:url value="/images/empty.bmp" var="emptyImageUrl" />
<c:url value="/images/newpic.bmp" var="newImageUrl" />
<c:url var="pdfUrl" 
	value="/reports/roadInspectionReport.pdf?roadInspectionId=${roadInspection.id}"/>
<c:url var="excelUrl" 
	value="/reports/roadInspectionReport.xls?roadInspectionId=${roadInspection.id}"/>
<c:url var="htmlUrl" 
	value="/reports/roadInspectionReport.html?roadInspectionId=${roadInspection.id}"/>

<html>
	<c:if test="${param.method == 'add'}">
		<c:set var="title"><fmt:message key="addRoadInspection.title"/></c:set>
	  <c:set var="heading"><fmt:message key="addRoadInspection.heading"/></c:set>
	  <c:set var="message"><fmt:message key="addRoadInspection.message"/></c:set>
  </c:if>
	<c:if test="${param.method == 'edit'}">
		<c:set var="title"><fmt:message key="editRoadInspection.title"/></c:set>
	  <c:set var="heading"><fmt:message key="editRoadInspection.heading"/></c:set>
	  <c:set var="message"><fmt:message key="editRoadInspection.message"/></c:set>
  </c:if>
	<c:url var="deletePicUrl" 
		value="/deleteRoadInspectionPicture.action?roadInspectionId=${roadInspection.id}&pictureid="/>
	<head>
		<title><c:out value="${title}"/></title>
		<content tag="heading">
			<c:out value="${heading}"/>
		</content>
    <script type="text/javascript" src="<c:url value='/scripts/selectbox.js'/>"></script>
	</head>

	<script language="JavaScript">
		var maxImg = 6;
		
		function isImageExists(fileName){
			var flg = false;
			for (var i = 0; i <= maxImg; i++){
				var imgSpan = document.getElementById("imgSpan" + i);
				if (imgSpan != null){
							var imgName = imgSpan.innerHTML.replace("<p>","");
							imgName = imgName.replace("</p>","");
							imgName = imgName.replace("<font color=\"#0000ff\">","");
							imgName = imgName.replace("</font>","");
							var name = fileName.substring(fileName.lastIndexOf("\\")+1,fileName.length);
							flg = (imgName.toLowerCase() == name.toLowerCase());
							if (flg) return true;
				}
			}
			return false;
		}
		
		function displayImage(rowCnt,fileName){
			
			var shortFileName = fileName.substring(fileName.lastIndexOf('\\')+ 1,fileName.length);
		
			if (isImageExists(shortFileName)){
				alert('Picture ' + shortFileName + ' already exists.');
				var checkBox = eval("document.forms.roadInspectionForm.editCheckbox" + rowCnt);
				//uncheck and then recheck to clear the file input value
				editPicture(rowCnt,checkBox);
				editPicture(rowCnt,checkBox);
			return;
		}
			//If Microsoft
			if (navigator.userAgent.indexOf('MSIE') != -1){
				document.images["imgPicture" + rowCnt].src = fileName;
			}else{
				document.images["imgPicture" + rowCnt].src = "<c:out value="${newImageUrl}"/>";
			}
			
			var sp = document.getElementById('imgSpan' + rowCnt);
			var HTML = '<font color="#0000FF">' + shortFileName + '</font><p>';
			sp.innerHTML = HTML;
			
		}
		
		function editPicture(rowCnt,obj){
			
			var flg = obj.checked;
			var span = document.getElementById("span" + rowCnt);
			
			if (flg){
				if (span != null){
					var HTML = "<input type=\"file\" style=\"width:95%;\" name=\"fileInput" + rowCnt.toString() + "\" id=\"fileInput" + rowCnt.toString() + "\" size=\"60\" accept=\"image/*\" onchange=\"displayImage(" + rowCnt.toString() + ",this.value);\"/>";	
					span.innerHTML = HTML;
				}
			}else{
				//span.removeChild('Picture ' + rowCnt);
				span.innerHTML = "";
        }
    }
    
    function deletePicture(pictureName){
			bCancel=true;
			if (confirmDelete(pictureName)) {
				window.location='<c:out value="${deletePicUrl}" escapeXml="false"/>' + pictureName;
			}
		}


	</script>
	<body>
		<span id="message"><c:out value="${message}"/></span>
		<div class="separator"></div>
		<spring:bind path="roadInspection.*">
		    <c:if test="${not empty status.errorMessages}">
		    <div class="error">	
		        <c:forEach var="error" items="${status.errorMessages}">
		            <img src="<c:url value="/images/iconWarning.gif"/>"
		                alt="<fmt:message key="icon.warning"/>" class="icon" />
		            <c:out value="${error}" escapeXml="false"/><br />
		        </c:forEach>
		    </div>
		    </c:if>
		</spring:bind>
		<c:set var="pageButtons">
			<tr>
				<td width="15%" colspan="2" valign="top">&nbsp;
				</td>
				<td class="buttonBar" width="25%" valign="top">
					<c:if test="${param.method == 'add'}">
			      <input type="submit" class="button" name="save" onclick="bCancel=false" value="<fmt:message key="button.add"/>" />		
		   			<input type="submit" class="button" name="cancel" onclick="bCancel=true" value="<fmt:message key="button.cancel"/>" />
 			    </c:if>
					<c:if test="${param.method == 'edit'}">
			      <input type="submit" class="button" name="save" onsubmit="bCancel=false" value="<fmt:message key="button.save"/>" />
		   			<input type="submit" class="button" name="cancel" onclick="bCancel=true" value="<fmt:message key="button.cancel"/>" />
		      </c:if>
				</td>
				<td width="60%">
				</td>
			</tr>
		</c:set>
		<form method="post" action="<c:url value="/roadInspectionForm.action"/>" id="roadInspectionForm" onsubmit="return onFormSubmit(this)" enctype="multipart/form-data">
		 	<!-- If method not add, show last modified time and creation time. -->		
			<c:if test="${param.method != 'add'}">
					<table width="100%">
					<tr>
						<td align="left" width="94%">
				<spring:bind path="roadInspection.id">
								<p><h3><fmt:message key="roadInspection.fullid"/>: <c:out value="${status.value}"/></h3></p>
					<input type="hidden" 
					  		id="roadInspectionId" 
					  		name="roadInspectionId" 
					  		value="<c:out value="${status.value}"/>">
				</spring:bind> 
						</td>
						<td align="right" width="2%">
							<a target="pdfWindow" href="<c:out value="${pdfUrl}"/>" title="<fmt:message key="title.report.pdf"/>"> 
							<img src="<c:url value="/images/l_pdf.gif" />" class="icon" border="1"/>
					  	</a>
						</td>
						<td align="right" width="2%">
							<a target="excelWindow" href="<c:out value="${excelUrl}"/>" title="<fmt:message key="title.report.xls"/>">
							<img src="<c:url value="/images/l_xls.gif" />" class="icon" border="1"/>
					  	</a>
						</td>
						<td align="right" width="2%">
							<a target="htmlWindow" href="<c:out value="${htmlUrl}"/>" title="<fmt:message key="title.report.html"/>">
							<img src="<c:url value="/images/l_html.gif" />" class="icon" border="1"/>
					  	</a>
						</td>
					</tr>
					</table>
				<table>
					<tr>
						<td><fmt:message key="roadInspection.creationTime"/>:</td>
						<td><fmt:formatDate value="${roadInspection.creationTime}" pattern="${datetimeformat}"/></td>
					</tr>
					<tr>
						<td><fmt:message key="roadInspection.lastModifiedTime"/>:</td>
						<td><fmt:formatDate value="${roadInspection.lastModifiedTime}" pattern="${datetimeformat}"/></td>
					</tr>
				</table>	
							 
				
		 	</c:if>
		 	
		 	<p><h3><fmt:message key="roadInspection.subtitle"/></h3></p>
			
			<input type="hidden" name="from" value="<c:out value="${param.from}"/>" />
			<input type="hidden" name="method" value="<c:out value="${param.method}"/>" />
			<c:if test="${param.method == 'add'}">
				<spring:bind path="roadInspection.roadDefectId">
				  <input type="hidden" id="<c:out value="${status.expression}"/>" 
			  		name="<c:out value="${status.expression}"/>" value="<c:out value="${status.value}"/>">
				</spring:bind> 
				<spring:bind path="roadInspection.taskId">
				  <input type="hidden" id="<c:out value="${status.expression}"/>" 
			  		name="<c:out value="${status.expression}"/>" value="<c:out value="${status.value}"/>">
				</spring:bind> 
			</c:if>
			
			<table class="detail">
				<c:if test="${param.method != 'add'}">
				<tr>
					<th width="15%">
	        	<mcaps:label key="roadInspection.roadDefectId"/>
					</th>
					<td width="85%">
						<spring:bind path="roadInspection.roadDefectId">
							<a href="<c:url value="/roadDefect.action?from=list&roadDefectId=${status.value}"/>"><c:out value="${status.value}"/></a>
						  <input type="hidden" id="<c:out value="${status.expression}"/>" 
					  		name="<c:out value="${status.expression}"/>" value="<c:out value="${status.value}"/>">
						</spring:bind> 
					</td>					
				</tr>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?