📄 addnew.asp
字号:
<% option explicit%>
<!-- #include virtual="include/DataEnvi.asp" -->
<!-- #include virtual="include/Page.asp" -->
<!-- #include virtual="include/File.asp" -->
<!-- #include virtual="include/SelectValue.asp" -->
<%
Dim ObjDB,ObjRS,StrSQL
Dim C
Dim StrSelectTrueName,IntParentID
Dim ObjFile,StrContentType,StrFileName,IntID
Dim StrExtName,IntSaveRe,IntFileSize
if session("AccountID")="" then
%>
<script language=javascript>
alert("因登录时间过长,会话失效,请退出重新登陆!")
</script>
<%
Response.End
end if
Set ObjDB = Server.CreateObject("ADODB.Connection")
OpenDB ObjDB
IntParentID = Request.QueryString("ParentID")
If Request.QueryString("F")<>"" Then
Set ObjFile = Server.CreateObject("LyfUpload.UploadFile")
StrContentType = ObjFile.FileType("File")
StrFileName = ObjFile.Request("File")
IntParentID = ObjFile.Request("_ParentID")
Set ObjRS = Server.CreateObject("Adodb.Recordset")
StrSQL = "Select Top 1 * From t_OA_Private_Data"
ObjRS.Open StrSQL,ObjDB,1,3
ObjRS.AddNew
ObjRS("AccountID") = Session("AccountID")
ObjRS("ParentID") = ObjFile.Request("_ParentID")
ObjRS("NodeType") = ObjFile.Request("_NodeType")
ObjRS("DirName") = ObjFile.Request("_DirName")
ObjRS("Title") = ObjFile.Request("_Title")
ObjRS("FileName") = ObjFile.Request("_FileName")
ObjRS("Body") = ObjFile.Request("_Body")
ObjRS("LinkTitle") = ObjFile.Request("_LinkTitle")
ObjRS("LinkURL") = ObjFile.Request("_LinkURL")
ObjRS("Keyword") = ObjFile.Request("_KeyWord")
ObjRS.Update
IntID = ObjRS("ID")
If Cint(ObjFile.Request("_NodeType")) = 1 Then
StrExtName = GetExtName(Cstr(ObjFile.Request("File")))
IntSaveRe = ObjFile.SaveFile("File",Server.MapPath("File"), true,IntID & "." & StrExtName) '保存文件到服务器
If IntSaveRe<>"" And IntSaveRe<>"1" And IntSaveRe<>"0" Then '上传成功
IntFileSize = ObjFile.FileSize
StrSQL = "Update t_OA_Private_Data Set ExtName = '" & StrExtName & "' , FileSize = " & IntFileSize & " Where ID = " & IntID
ObjDB.Execute StrSQL
Else '上传失败
StrSQL = "Delete From t_OA_Private_Data Where ID = " & IntID
ObjDB.Execute StrSQL
%>
<script language=javascript>
alert("文件上传错误,请通知管理员检查服务器是否正常!")
window.location = "List.asp"
</script>
<%
Response.End
End If
End if
ObjRS.Close
Set ObjRS = Nothing
ObjDB.Close
Set ObjDB = Nothing
Response.Redirect ("List.asp?ParentID=" & IntParentID)
End If
%>
<%'==================================================================%>
<%Sub Main%>
<%'------------------------------------------------------------------%>
<script language=javascript>
function ShowContent(t){
var theForm = document.forms[0]
Content0.style.display = "none"
Content11.style.display = "none"
Content12.style.display = "none"
Content21.style.display = "none"
Content22.style.display = "none"
Content31.style.display = "none"
Content32.style.display = "none"
theForm._DirName.Check = 0
theForm.File.Check = 0
theForm._Title.Check = 0
theForm._LinkTitle.Check = 0
theForm._LinkURL.Check = 0
theForm._FileName.Check =0
if(t==0){
Content0.style.display = ""
theForm._DirName.Check = 1
}
if(t==1){
Content11.style.display = ""
Content12.style.display = ""
theForm._FileName.Check = 1
theForm.File.Check = 1
}
if(t==2){
Content21.style.display = ""
Content22.style.display = ""
theForm._Title.Check = 1
}
if(t==3){
Content31.style.display = ""
Content32.style.display = ""
theForm._LinkTitle.Check = 1
theForm._LinkURL.Check = 1
}
}
</script>
<form action="Addnew.asp?F=0" enctype="multipart/form-data" method="post" onsubmit="return(CheckForm(this))">
<table class=Ltable cellspacing=1 cellpadding=3>
<tr class=LHtr>
<td width="15%">新增资料</td>
<td width="85%"> </td>
</tr>
<input Type=hidden name="_AccountID" value=<%=Session("AccountID")%>>
<input Type=hidden name="_ParentID" value=<%=IntParentID%>>
<tr class=Ltr>
<td>新增</td>
<td>
<table border=0>
<tr>
<td><input type=radio name=_NodeType value=0 checked onclick="ShowContent(0)"></td>
<td><img src="../../../images/oa/private/data/folder.gif"></td>
<td>文件夹 </td>
<td><input type=radio name=_NodeType value=1 onclick="ShowContent(1)"></td>
<td><img src="../../../images/oa/private/data/file.gif"></td>
<td>文件 </td>
<td><input type=radio name=_NodeType value=2 onclick="ShowContent(2)"></td>
<td><img src="../../../images/oa/private/data/text.gif"></td>
<td>文本文件 </td>
<td><input type=radio name=_NodeType value=3 onclick="ShowContent(3)"></td>
<td><img src="../../../images/oa/private/data/link.gif"></td>
<td>超级链接</td>
</tr>
</table>
</td>
</tr>
<tr class=Ltr id=Content0 style="display=''">
<td>文件夹名称</td>
<td><input type="text" size=28 class=Input Check=0 Show="资料夹名称" name="_DirName"></td>
</tr>
<tr class=Ltr id=Content11 style="display='none'">
<td>文件标题</td>
<td><input type="text" size=28 class=Input Check=0 Show="文件标题" name="_FileName"></td>
</tr>
<tr class=Ltr id=Content12 style="display='none'">
<td>上传文件</td>
<td><input type="file" size=28 class=Input Check=0 Show="文件" name="File"></td>
</tr>
<tr class=Ltr id=Content21 style="display='none'">
<td>标题</td>
<td><input type="text" size=28 class=Input Check=0 Show="标题" name="_Title"></td>
</tr>
<tr class=Ltr id=Content22 style="display='none'">
<td valign=top>内容</td>
<td><textarea name="_Body" rows=10 cols=22 class=Textarea Check=0 Show="内容"></textarea></td>
</tr>
<tr class=Ltr id=Content31 size=28 style="display='none'">
<td>链接标题</td>
<td><input type="text" size=28 class=Input Check=0 Show="链接标题" name="_LinkTitle"></td>
</tr>
<tr class=Ltr id=Content32 style="display='none'">
<td>链接地址</td>
<td><input type="text" size=28 class=Input Check=0 Show="链接地址" name="_LinkURL" value="http://"></td>
</tr>
<tr class=Ltr id=Content4 style="display=''">
<td>检索关键字</td>
<td><input type="text" size=28 class=Input name="_KeyWord"></td>
</tr>
</table>
<table cellspacing=1 cellpadding=3>
<tr>
<td>
<input type="submit" name="Submit" class=Button value="提 交">
<input type="button" class=Button value="取 消" onclick="doList()" id=button1 name=button1>
</td>
<td>
</td>
</tr>
</table>
</form>
<script language=javascript>
ShowContent(0)
</script>
<%
End Sub
%>
<!-- #include file="Templet.asp" -->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -