87 lines
2.9 KiB
Plaintext
87 lines
2.9 KiB
Plaintext
<%@ page contentType="text/html; charset=GBK"%>
|
||
<%@ include file="/IncludeBegin.jsp"%><%
|
||
String RELATIVE_ID = CurPage.getParameter("RELATIVE_ID");
|
||
String RightType=CurComp.getParameter("RightType");
|
||
boolean isRead = "ReadOnly".equals(RightType);
|
||
|
||
String[][] sButtons = {
|
||
{!isRead?"true":"false","","Button","上传","","importRecord()","","","","btn_icon_up"},
|
||
{"true","","Button","返回","返回列表页面","goBack()","","","","btn_icon_return",""}
|
||
};
|
||
%>
|
||
<body style="overflow:hidden;" onresize="javascript:changeStyle();">
|
||
<div id="ButtonsDiv" style="margin-left:5px;">
|
||
<table><tr><%if(!isRead){%>
|
||
<td>
|
||
<iframe style="display:none;" name="import_excel_real_submit_frame"></iframe>
|
||
<form name="Attachment" style="margin-bottom:0px;" target="import_excel_real_submit_frame" enctype="multipart/form-data" action="<%=sWebRootPath%>/Tenwa/Comm/Board/BoardUpload.jsp?CompClientID=<%=CurComp.getClientID()%>" method="post">
|
||
<input type="file" name="File" />
|
||
<input type="hidden" name="RELATIVE_ID" value="<%=RELATIVE_ID%>" >
|
||
<input type="hidden" name="FileName" />
|
||
</form></td><%}%>
|
||
<td><%@ include file="/Frame/resources/include/ui/include_buttonset_dw.jspf"%></td>
|
||
</tr></table>
|
||
</div>
|
||
<iframe name="AttachmentList" id="AttachmentList" style="width: 100%;" frameborder="0"></iframe>
|
||
</body>
|
||
<script type="text/javascript">
|
||
setDialogTitle("附件管理");
|
||
|
||
$(document).ready(function(){
|
||
changeStyle();
|
||
//以list形式展示时,“查看内容”、“删除”这两个按钮才有效
|
||
AsControl.OpenView("/Tenwa/Comm/Board/LBDocListFiles.jsp", "RELATIVE_ID=<%=RELATIVE_ID%>&isRead=<%=isRead%>", "AttachmentList");
|
||
});
|
||
|
||
function changeStyle(){
|
||
document.getElementById("AttachmentList").style.height = document.body.clientHeight - document.getElementById("ButtonsDiv").offsetHeight;
|
||
}
|
||
//提交
|
||
function importRecord(){
|
||
var o = document.forms["Attachment"];
|
||
var sFileName = o.File.value;
|
||
var nameArr = sFileName.split("\\");
|
||
$("#FileName").val(encodeURI(nameArr[nameArr.length-1]));
|
||
if (typeof(sFileName) == "undefined" || sFileName==""){
|
||
alert("请选上传的附件!");
|
||
return false;
|
||
}
|
||
if(/[!@'"#$%&\^*]/.test(nameArr[nameArr.length-1])){
|
||
alert("文件名不合法");
|
||
return;
|
||
}
|
||
var flag=CheckStr(nameArr[nameArr.length-1]);
|
||
if(flag!="true"){
|
||
alert("只能上传后缀名为"+flag+"的文件");
|
||
return ;
|
||
}
|
||
var fileSize;
|
||
if(typeof(ActiveXObject) == "function"){ // IE
|
||
var fso = new ActiveXObject("Scripting.FileSystemObject");
|
||
var f1 = fso.GetFile(sFileName);
|
||
fileSize = f1.size;
|
||
}else{
|
||
fileSize = o.File.files[0].size;
|
||
}
|
||
if(fileSize > 50*1024*1024){
|
||
alert("文件大于50MB,不能上传!");
|
||
return false;
|
||
}
|
||
return o.submit();
|
||
}
|
||
function CheckStr(str){
|
||
var s="jpg,jpeg,png,pdf,doc,docx,xls,xlsx";
|
||
var flag="false";
|
||
var s2=s.split(",");
|
||
for(var i=0;i<s2.length;i++){
|
||
if(str.split(".")[1]==s2[i]){
|
||
return "true";
|
||
}
|
||
}
|
||
return s;
|
||
}
|
||
function goBack(){
|
||
parent.AsDialog.ClosePage();
|
||
}
|
||
</script>
|
||
<%@ include file="/IncludeEnd.jsp"%> |