📄 uploadattachment.jsp
字号:
<%@ page contentType="text/html; charset=GBK" %>
<%@ include file="common/include/taglibs.jsp" %>
<html:html>
<head>
<title><lybbs:web key="forumName"/></title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="bookmark" href="favicon.ico" type="image/x-icon">
<%@ include file="common/include/header.jsp" %>
<script language="JavaScript">
var vbDOMtype = '';
if (document.getElementById) {
vbDOMtype = "std";
}
else if (document.all) {
vbDOMtype = "ie4";
}
else if (document.layers){
vbDOMtype = "ns4";
}
var openner=window.opener==null?parent:window.opener;
switch (vbDOMtype) {
case "std":{
var attachlist = openner.document.getElementById("attachList");
}
break;
case "ie4": {
var attachlist = openner.document.all["attachList"];
}
}
function verify_upload(formobj) {
var haveupload = false;
for (var i=0; i < formobj.elements.length; i++) {
var elm = formobj.elements[i];
if (elm.type == 'file'){
if (elm.value != ""){
haveupload = true;
}
}
}
if (haveupload){
toggle_display();
formobj.submit();
formobj.upload.disabled=true;
} else {
alert("Please select your file for upload.");
}
return false;
}
function toggle_display() {
var obj=uploading;
if (obj.style.display == "none") {
obj.style.display = "";
} else {
obj.style.display = "none";
}
}
</script>
</head>
<%
net.lybbs.upload.form.UploadForm uploadForm=(net.lybbs.upload.form.UploadForm)request.getAttribute("uploadForm");
//shoud be new at all the condition
//String action=uploadForm.getAction();
String postAction=uploadForm.getPostAction();
int postID=uploadForm.getPostID();
int currentSize=((java.util.List)request.getAttribute("uploadListBean")).size();
net.lybbs.util.PropertiesCache propertiesCache=net.lybbs.util.PropertiesCache.getInstance();
long uploadMaxTopicSize=propertiesCache.getUploadMaxTopicSize();
long uploadMaxReplySize=propertiesCache.getUploadMaxReplySize();
int uploadCurrentAllowedNumber=propertiesCache.getUploadPostMaxNumber()-currentSize;
int uploadAllowedNumber=uploadCurrentAllowedNumber>propertiesCache.getUploadAllowedNumber()?propertiesCache.getUploadAllowedNumber():uploadCurrentAllowedNumber;
String[] uploadAllowedExtArray=propertiesCache.getUploadAllowedExtArray();
%>
<body topmargin=0 leftmargin=0>
<form method=post name="uploadForm" action="bbs_upload.do" enctype="multipart/form-data">
<input type="hidden" name="postID" value="<%=postID%>">
<input type="hidden" name="postAction" value="<%=postAction%>">
<input type="hidden" name="action" value="new">
<input type="hidden" name="checkAction" value="yes">
<table class=tableCommonStyle cellpadding=3 cellspacing=1 border=0 align=center>
<tr>
<td class=catStyle align=center colspan=2><b><bean:message key="jsp.post.upload.admin"/></b></td>
</tr>
<lybbs:typeUserQuotaTag/>
<logic:notPresent name="notPreviousAuthor">
<tr>
<td class=forumColorOne width=40%>
<b><bean:message key="jsp.post.upload.title"/></b><br><bean:message key="jsp.post.upload.comment" arg0="<%=String.valueOf(uploadMaxTopicSize/1024)%>" arg1="<%=String.valueOf(uploadMaxReplySize/1024)%>"/>
</td>
<td class=forumColorTwo>
<%
for(int i=0;i<uploadAllowedNumber;i++) {
%>
<input type="file" size=30 name="addMe<%=i%>"><br>
<%
}
%>
<select>
<option value=#><bean:message key="jsp.post.upload.allowedext"/>:</option>
<option value=#>----------</option>
<%
for(int i=0,m=uploadAllowedExtArray.length;i<m;i++) {
out.println("<option>"+uploadAllowedExtArray[i]+"</option>");
}
%>
</select>
</td>
</tr>
<tr>
<td class=forumColorTwo align=center colspan=2>
<input type="button" name="upload" value="<bean:message key="common.lybbs.upload"/>" onclick="verify_upload(this.form);" />
</td>
</tr>
</logic:notPresent>
<%
if(currentSize>0) {
%>
<tr>
<td class=forumColorOne>
<b><bean:message key="jsp.post.upload.current"/></b>
</td>
<td class=forumColorTwo>
<script language="JavaScript">
<%if(postAction.equals("edit")) {%>openner.setAccessary('<bean:write name="accessary"/>');<%}else out.println("openner.setAccessary('1');");%>
var attachListStr="";
var insertText="";
<logic:iterate id="element" indexId="ind" name="uploadListBean">
<logic:equal name="ind" value="0">
openner.setAccessaryName('<bean:write name="element" property="filePath"/>');
</logic:equal>
insertText+="insertAttachment('<bean:write name="element" property="filePath"/>','<bean:write name="element" property="fileRealName"/>','<bean:write name="element" property="fileExt"/>');";
document.write("<a href=bbs_downloadAttachment.do?fileName=<bean:write name="element" property="filePath"/> target=_blank><bean:write name="element" property="fileRealName"/></a> (<bean:write name="element" property="fileSize"/> Bytes) <a href=bbs_upload.do?action=delete&postAction=<%=postAction%>&postID=<%=postID%>&uploadInfoID=<bean:write name="element" property="uploadInfoID"/>><bean:message key="common.lybbs.delete"/></a><br>");
attachListStr+="<a href=bbs_downloadAttachment.do?fileName=<bean:write name="element" property="filePath"/> target=_blank><bean:write name="element" property="fileRealName"/></a> (<bean:write name="element" property="fileSize"/> Bytes) <a href=javascript:insertAttachment('<bean:write name="element" property="filePath"/>','<bean:write name="element" property="fileRealName"/>','<bean:write name="element" property="fileExt"/>')><bean:message key="common.lybbs.insert"/></a><br>";
</logic:iterate>
attachlist.innerHTML = "<a href=javascript:insertAllAttachment(\""+insertText+"\");><bean:message key="common.lybbs.allinsert"/></a><br>"+attachListStr;
</script>
</td>
</tr>
<%
}
else {
out.println("<script>openner.setAccessary('0');attachlist.innerHTML='';</script>");
}
%>
<logic:messagesPresent>
<tr>
<td class=forumColorTwo align=center colspan=2>
<html:errors/>
</td>
</tr>
</logic:messagesPresent>
<tr id="uploading" style="display:none;">
<td class=forumColorTwo align=center colspan=2>
<strong>Uploading, please wait...</strong>
</td>
</tr>
<tr>
<td class=forumColorTwo align=center colspan=2>
<input type="button" value="<bean:message key="common.lybbs.close"/>" onclick="window.close();" />
</td>
</tr>
</table>
</form>
</body>
</html:html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -