<%@ page language="java" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head> 
    <title>知识记录创建</title>
<style>
.table-null .table{
	margin-bottom: 0px;
}
.table-null .table > tbody > tr > td, .table-null .table > thead > tr > th{
	text-align: center;
 	width: 25%;
}
.table-null td:first-child{	
 	text-align: right;
 	width: 36%;
}
.table-null tr td:last-child .form-control,.table-null tr td:last-child table{
	width: 400px;
}
.file-box{ position:relative;}
.file{ position:absolute; top:0; height:30px; filter:alpha(opacity:0);opacity:0;width:470px;cursor: pointer; }

/* .file-box{ position:relative;width:340px} 
.txt{ height:22px; border:1px solid #cdcdcd; width:180px;} 
.btn{ background-color:#FFF; border:1px solid #CDCDCD;height:24px; width:70px;} 
.file{ position:absolute; top:0; right:80px; height:24px; filter:alpha(opacity:0);opacity: 0;width:260px } */ 

</style>
</head>
  
<body>
	<div class="container">
		<ol class="breadcrumb">
			<li><a href="${ctx}/index">首页</a></li>
			<li>即席查询</li>
			<li class="active">知识共享</li>
		</ol>
	</div>
	<div id="main-container main-tab-container">
		<div id="content" class="container">
			<div class="section">
				<div class="tab-content">

					<div class="tab-pane fade in active" id="home">
						<div class="row">
							<div class="col-xs-12">
								<div class="table-header">知识管理</div>
								<form action="#" class="form-horizontal" id="knowledgeCreateForm" method="post" enctype="multipart/form-data">
								<table id="knowledgeCreateTable" class="table-null">
									<tr><td>摘要:</td><td><input type="text"  class="form-control" name="summary" id="summary"/></td></tr>
									<tr><td>关键字(<font color="red">必填</font>):</td><td><input type="text" class="form-control" name="keyword" id="keyword"/></td></tr>
									<tr><td>知识内容(<font color="red">必填</font>):</td><td><input type="text" class="form-control" name="knowledgeContent" id="knowledgeContent"/></td></tr>
									<tr><td>知识来源:</td>
										<td><select class="form-control" name="knowledgeSource" id="knowledgeSource" >
			    								<c:forEach var="knowledgeSources" items="${knowledgeSourceList}">
			    									<option value="${knowledgeSources.knowledgeSourceId}">${knowledgeSources.knowledgeSourceName}</option>
			    								</c:forEach>
										    </select></td></tr>
									<tr><td>知识类型:</td>
										<td><select class="form-control" name="knowledgeType" id="knowledgeType">
			    								<c:forEach var="knowledgeTypes" items="${knowledgeTypeList}">
			    									<option value="${knowledgeTypes.knowledgeTypeId}">${knowledgeTypes.knowledgeTypeName}</option>
			    								</c:forEach>
										    </select></td></tr>
									<tr><td>知识文档类型:</td>
										<td><select class="form-control" name="knowledgeDocType" id="knowledgeDocType">
			    								<c:forEach var="knowledgeDocTypes" items="${knowledgeDocTypeList}">
			    									<option value="${knowledgeDocTypes.knowledgeDocTypeId}">${knowledgeDocTypes.knowledgeDocTypeName}</option>
			    								</c:forEach>
										    </select></td></tr>
									<tr><td>省份:</td>
										<td><select class="form-control" name="province" id="province">
													<option value="">全国</option>
			    								<c:forEach var="provinces" items="${provinceList}">
			    									<option value="${provinces.provinceId}">${provinces.provinceName}</option>
			    								</c:forEach>
										    </select></td></tr>
									<!-- <tr><td>发布日期:</td><td><input id="publish_time" name="publishTime" class="form-control" type="text" onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'valid_time\')}'})"> </td></tr> -->
									<tr><td>有效日期:</td><td><input type="text" class="form-control" id="valid_time" name="validTime" onfocus="WdatePicker({minDate:'#F{\'%y-%M-%d %H:%m:%s\'}'})" /></td></tr>
									<tr><td>录入人员:</td><td><input type="text" class="form-control" name="crtUser" id="crtUser"/></td></tr>
									<tr><td>知识文件1:</td><td>
									 	<div class="file-box">
 										<input type='text' id='knowledgeFileOne' class="form-control" style="display: inline;"/>
 										<input type='button' class="btn btn-default" value='浏  览' style="width:70px"/> 
    									<input type="file" name="uploadFile" class="file" id="fileField" onchange="document.getElementById('knowledgeFileOne').value=this.value" />
    									</div>
    								</td></tr>
    								<tr><td>知识文件2:</td><td>
									 	<div class="file-box">
 										<input type='text' id='knowledgeFileTwo' class="form-control" style="display: inline;"/>
 										<input type='button' class="btn btn-default" value='浏  览' style="width:70px"/> 
    									<input type="file" name="uploadFile" class="file" id="fileField" onchange="document.getElementById('knowledgeFileTwo').value=this.value" />
    									</div>
    								</td></tr>
    								<tr><td>知识文件3:</td><td>
									 	<div class="file-box">
 										<input type='text' id='knowledgeFileThree' class="form-control" style="display: inline;"/>
 										<input type='button' class="btn btn-default" value='浏  览' style="width:70px"/> 
    									<input type="file" name="uploadFile" class="file" id="fileField" onchange="document.getElementById('knowledgeFileThree').value=this.value" />
    									</div>
    								</td></tr>
    								<tr><td>知识文件4:</td><td>
									 	<div class="file-box">
 										<input type='text' id='knowledgeFileFour' class="form-control" style="display: inline;"/>
 										<input type='button' class="btn btn-default" value='浏  览' style="width:70px"/> 
    									<input type="file" name="uploadFile" class="file" id="fileField" onchange="document.getElementById('knowledgeFileFour').value=this.value" />
    									</div>
    								</td></tr>
    								<tr><td>知识文件5:</td><td>
									 	<div class="file-box">
 										<input type='text' id='knowledgeFileFive' class="form-control" style="display: inline;"/>
 										<input type='button' class="btn btn-default" value='浏  览' style="width:70px"/> 
    									<input type="file" name="uploadFile" class="file" id="fileField" onchange="document.getElementById('knowledgeFileFive').value=this.value" />
    									</div>
    								</td></tr>
    								
									<tr><td></td><td><button type="button" id="knowledgeSubmit" class="btn btn-primary">确定</button>
										<button type="reset" class="btn btn-default" id="knowledgeReset">清空</button>
										<button type="reset" class="btn btn-warning" id="knowledgeBack">返回</button>
										</td></tr>
	                            </table>
								</form>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
<script type="text/javascript">
	//返回按钮
	$("#knowledgeBack").click(function(){
		location.href="${ctx}/DataManage/KnowledgeShare";
	});
	
	//清空按钮
	$("#knowledgeReset").click(function(){
		$("#summary").attr("value","");
		$("#keyword").attr("value","");
		$("#content").attr("value","");
		$("#publish_time").attr("value","");
		$("#valid_time").attr("value","");
		$("#crtUser").attr("value","");
	});
	
	//确定按钮
	$("#knowledgeSubmit").click(function(){
		if(""==$.trim($("#keyword").val())){
			$.alert("关键词不能为空");
		}else if(""==$.trim($("#knowledgeContent").val())){
			$.alert("知识内容不能为空");
		}else if($("#knowledgeFileOne").val()=="" && $("#knowledgeFileTwo").val()=="" && $("#knowledgeFileThree").val()=="" && $("#knowledgeFileFour").val()=="" && $("#knowledgeFileFive").val()==""){
			$.alert("至少选择一个知识文件");
		}else{
			var createForm=$("#knowledgeCreateForm");
			createForm.attr("action","${ctx}/DataManage/KnowledgeCreate/saveKnowledgeForm");
			createForm.submit();
			createForm.attr("action","#");
		} 
	});
</script>
</body>
</html>