133 lines
3.3 KiB
Plaintext
133 lines
3.3 KiB
Plaintext
<!--#include virtual="/common/lib/dbcon.asp"-->
|
|
<!--#include virtual="/common/lib/func.asp"-->
|
|
<%
|
|
Dim R_Fields, UploadForm
|
|
dim ct_idx, ct_code, ct_name, ct_ref, ct_depth, ct_chk, ct_wdate, ct_codeno, ct_codeno_ref, a_num
|
|
Dim strDir, ext_str, ct_file
|
|
Dim sql, R_Fields_i
|
|
|
|
|
|
'//------------------- 저장공간인 [DATA]폴더가 없다면 생성 한다. -------------------
|
|
FolderCreate( server.MapPath("/")&"\data\board_code\" )
|
|
'//------------------------------------------------------------------------------------
|
|
|
|
Set UploadForm = Server.CreateObject("DEXT.FileUpload")
|
|
UploadForm.DefaultPath = server.MapPath("/")&"\data\board_code\"
|
|
|
|
|
|
R_Fields = "ct_idx, ct_code, ct_name, ct_ref, ct_depth, ct_chk, ct_wdate, ct_codeno, ct_codeno_ref, a_num"
|
|
|
|
Call RequestAll(R_Fields, "UploadForm")
|
|
|
|
|
|
|
|
|
|
If ct_idx = "" then '//저장
|
|
|
|
'//이미지파일저장
|
|
'//*****************************************
|
|
strDir = UploadForm.DefaultPath
|
|
ext_str = "jpg,gif"
|
|
ct_file = wfile2("ct_file", 10, strDir, ext_str)
|
|
'//*****************************************
|
|
|
|
|
|
'//순서
|
|
'//*****************************************
|
|
sql = "select max(ct_code) as ct_code from board_code WHERE ct_ref = " & ct_ref
|
|
'response.write sql
|
|
'response.end
|
|
Set rs = dbcon.execute( sql )
|
|
|
|
ct_code = rs("ct_code")
|
|
|
|
if IsNull(ct_code) then
|
|
ct_code = 1
|
|
else
|
|
ct_code = ct_code + 1
|
|
End if
|
|
'//*****************************************
|
|
|
|
|
|
R_Fields_i = "ct_code, ct_name, ct_ref, ct_depth, ct_chk, ct_wdate,a_num, ct_file"
|
|
|
|
ct_wdate = getDateFm(Now(), 3)
|
|
|
|
Call InsertQuery (R_Fields_i, "board_code")
|
|
|
|
'//메뉴값 적용-----------------------------------------------------------------------------
|
|
sql = "select max(ct_idx) as ct_idx from board_code"
|
|
Set rs1 = dbcon.execute( sql )
|
|
|
|
max_ct_idx = rs1("ct_idx")
|
|
|
|
Set rs1 = nothing
|
|
|
|
ct_codeno = ct_codeno_ref & "C" & max_ct_idx & ";"
|
|
|
|
sql = "update board_code set ct_codeno='" & ct_codeno & "' WHERE ct_idx = " & max_ct_idx
|
|
dbcon.execute sql
|
|
'//-----------------------------------------------------------------------------------------
|
|
|
|
If ct_ref = "0" then ct_ref = ""
|
|
ok_url = "write_ui.asp?a_num=" & a_num & "&ct_idx=" & ct_ref
|
|
|
|
|
|
Else '{ //수정
|
|
ct_name = inputValue( UploadForm( "ct_name_" & ct_idx ) )
|
|
'ct_file = inputValue( UploadForm( "ct_file_" & ct_idx ) )
|
|
'ct_file_name = inputValue( UploadForm( "ct_file_" & ct_idx ) )
|
|
ct_file_org = inputValue( UploadForm( "ct_file_org_" & ct_idx ) )
|
|
ct_file_del = inputValue( UploadForm( "ct_file_del_" & ct_idx ) )
|
|
|
|
|
|
strDir = UploadForm.DefaultPath
|
|
|
|
|
|
'//체크하면 첨부파일 삭제
|
|
If ct_file_del <> "" then '//첨부파일만 삭제
|
|
Call dfile( strDir, ct_file_org )
|
|
|
|
ct_file = ""
|
|
ct_file_org = ""
|
|
|
|
End if
|
|
|
|
|
|
'//이미지파일저장
|
|
'//*****************************************
|
|
ext_str = "jpg,gif"
|
|
ct_file = wfile2("ct_file_" & ct_idx, 10, strDir, ext_str)
|
|
'//*****************************************
|
|
|
|
If ct_file <> "" then '//첨부파일이 있으면
|
|
|
|
If ct_file_org <> "" then
|
|
Call dfile( strDir, ct_file_org )
|
|
End if
|
|
|
|
else
|
|
|
|
ct_file = ct_file_org
|
|
|
|
End if
|
|
|
|
|
|
|
|
|
|
R_Fields = "ct_name, ct_wdate, ct_file"
|
|
|
|
ct_wdate = getDateFm(Now(), 3)
|
|
|
|
Call UpdateQuery (R_Fields, "board_code", "where ct_idx=" & ct_idx)
|
|
|
|
|
|
If ct_ref = "0" then ct_ref = ""
|
|
ok_url = "write_ui.asp?a_num=" & a_num & "&ct_idx=" & ct_ref
|
|
|
|
End if
|
|
|
|
|
|
Call loding("0",ok_url)
|
|
|
|
%> |