<!--#INCLUDE FILE="../HXINCLUDE/HXINCLUDEHEAD.ASP"--><!--#INCLUDE FILE="../HXINCLUDE/SelectDate.asp"--><!--#INCLUDE FILE="../HXINCLUDE/HX_photo.asp"-->
<%if WS_S.MemberPriv("WS_PublicAffairsDocumentAdd")<>1 then HX_GoBack "对不起,您的权限不够!",""
ColumnName="":Tablename="HX_Document":Tablename1="HX_DocumentClass":Orderby=" ORDER BY WS_DOid DESC"
set rs=WS_S.HX_SetRSD(ColumnName,Tablename,Orderby)
action=request("action")
DocumetFile=request("DocumetFile")
if action="saveinfo" then
set upload=new upload_file
DocumetFile=upload.form("DocumetFile")
DocumentName=upload.form("DocumentName")
DocumentClass=upload.form("DocumentClass")
DocumentInputDate=upload.form("DocumentInputDate")
DocumentExpose=upload.form("DocumentExpose")
DocumetLicManUid=upload.form("WS_DocumetLicManUid")
DocumetMemo=upload.form("DocumetMemo")
call WS_S.ChkIsOuter()
filepath="PublicAnnex/"
for each formName in upload.File
 set file=upload.File(formName)
 fileExt=lcase(file.FileExt)	'得到的文件扩展名不含有.
 if fileext<>"doc" and fileext<>"txt" and fileext<>"rar" then fileExt="gif":HX_GoBack "只能上传DOC、TXT、RAR格式的文件！",""
 if file.FileSize<10 then HX_GoBack "文件大小不能小于10字节！",""
 if file.filesize>(200000*1024) then HX_GoBack "文件大小不能超过200M！",""	
  randomize
  ranNum=int(90000*rnd)+10000
  filename=filepath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&fileExt 
  if file.FileSize>0 then         '如果 FileSize > 0 说明有文件数据
    WS_S.CheckDir filepath,True
    FileSeverPath=Server.mappath(filename)
    file.SaveToFile FileSeverPath
	if WS_S.HX_ScanFile(FileSeverPath) then
    WS_S.CheckFile FileSeverPath,True 
    HX_GoBack "对不起,您上传的文件中含有木马程序,所以不能上传!",""
    end if
  end if
  set file=nothing  
  next
  rs.addnew
    if FileName<>"" then  rs("WS_DocumetFile")=Filename
    rs("WS_DocumentName")=DocumentName
	if DocumentClass<>"" and isnumeric(DocumentClass) then   rs("WS_DCID")=DocumentClass
	if isdate(DocumentInputDate) then rs("WS_DocumentInputDate")=DocumentInputDate
    rs("WS_DocumentExpose")=DocumentExpose
	if DocumentExpose=1 then
	  if DocumetLicManUid<>"" then  rs("WS_DocumetLicManID")=DocumetLicManUid  else  HX_GoBack "您选择了半公开，必须要有授权用户！",""
	end if
    rs("WS_DocumetMemo")=DocumetMemo
	rs("WS_DocumetUID")=LOGINUID
	rs("WS_DocumetDate")=now
    rs.update
	call WS_S.HX_RSClose(rs)
	Call HX_ClosDB()
    set upload=nothing  
   response.write "<script>if(!confirm('创建成功！\n是否继续创建文档？')) location.href='viewdocument.asp';else location.href='newcreatedocument.asp';</script>"
   response.end
end if
response.write "<head><meta http-equiv='Content-Type' content='text/html; charset=gb2312'><title></title><link rel=stylesheet type=text/css href='../HXinclude/HX_Style.css'><script src='../HXinclude/HX_Function.js'></script><script language='JavaScript'>function docucheck(form){if(form.DocumentName.value==''){alert('请输入文件名!'); form.DocumentName.focus();return false;}return true}</script></head><body topmargin='20' leftmargin='0' bottommargin='0'><table width='596'  border='0' cellspacing='1' cellpadding='0' align=center bgcolor='#613c25'><tr><td colspan='2' bgcolor=FFFBE8><table width='100%'  border='0' cellspacing='0' cellpadding='0'><tr><td height='25' background='../hximages/titleline.gif'><font class='fontmenu'>新建文档</font></td></tr></table><table width='100%'  border='0' cellspacing='1' cellpadding='3' bgcolor=FFFBE8><form name='form1' method='post' action='newcreatedocument.asp?action=saveinfo' onSubmit='return docucheck(this);' enctype='multipart/form-data'><tr bgcolor='#FFFBE8'><td width='13%'>文挡名称</td><td width='33%'><input type='text' name='DocumentName' size='28'></td><td width='14%'>文档类别</td><td width='40%'><select name='DocumentClass'>"
set drs=WS_S.HX_SetRSD(ColumnName,Tablename1," Order by WS_OrderBy asc")
if drs.recordcount>0 then	
do until drs.eof
response.write "<option value='"&drs("WS_DCID")&"'>"&drs("WS_DocumentName")&"</option>"
drs.movenext
loop
end if	  
response.write "</select></td></tr><tr bgcolor='#FFFBE8'><td width='13%'>撰写时间</td><td width='33%'><input type='text' name='DocumentInputDate' size='15' maxlength='15' value='"&date&"' readonly> <input onclick=""popUpcalendar(this, form1.DocumentInputDate, 'yyyy-mm-dd ')"" type='button' value='选择' title='选择撰写时间'></td><td width='14%'>公开度</td><td width='40%'><select name='DocumentExpose' onChange=""if(document.form1.DocumentExpose.options[document.form1.DocumentExpose.selectedIndex].value!=1) {document.form1.checkuser.disabled = true;}else {document.all.form1.checkuser.disabled = false;}""><option value='2'>不公开</option><option value='1' selected>半公开</option><option value='0'>公开</option></select></td></tr><tr bgcolor='#FFFBE8'><td width='13%'>授权用户</td><td colspan='3'><input type='hidden' name='WS_DocumetLicManUid'><input type='text' name='WS_DocumetLicManName' size='31' readonly> <input onclick=""openwin(510,500,'../HXinclude/HX_Selectuser.asp?checkuser=DocumetLicMan')"" name='checkuser' type='button' value='选择' class='bdlogin' title='选择授权用户'></td></tr><tr bgcolor='#FFFBE8'><td width='13%' valign='top'>简要描述</td><td colspan='3'><textarea rows='8' name='DocumetMemo' cols='50' class='bgline'></textarea></td></tr><tr bgcolor='#FFFBE8'><td valign='top'>附件</td><td colspan='3'><input type='file' name='DocumetFile' size='42'></td></tr><tr bgcolor='#FFFBE8'><td valign='top'>&nbsp;</td><td colspan='3'><input type='submit' name='Submit' value=' 创 建 '></td></tr><tr bgcolor='#FFFBE8'><td colspan='4' valign='top'><font color='#FF0000'>* 说明：高级权限可查看所有公开和半公开的文档； <br>初级权限用户可查看所有公开的文档和自己建立的文档，也可查看对自己授过权的半公开文档 <br>具有中级权限的用户才可新建文档。</font></td></tr></form></table></td></tr></table>"
%>