개발 초기 단계에 스토리 보드가 나오면 프로그램 목록이라는 것을 만든다..
어떤 페이지는 개발이 들어갈것인지 디자인으로만 페이지가 들어갈것인지.
그러면 개발 범위와 디자인 범위가 좀 더 명확해진다..
프로그램 목록의 기본 형식.
이걸 만들다 보니 이렇게 만들었으니 좀 써먹어보자 싶어서 만든게.. 이것을 활용한 프로그램 폴더 및 화일 한방에 만들기 이다.
어차피 모든 개발 화일은 가장 기본적인 구성으로 이루어져 있어 미리 만들어 놓으면 하나하나 만들지 않아도 되고
추후 프로젝트 개발시에도 유용할것 같아서 만들어 보았다.
위의 화일을 기초로 CSV 화일을 만들고..
Admin,Login,,Login.asp,로그인 폼 화면
Admin,Login,,LoginProcess.asp,로그인 처리 화면
Admin,Login,,LogOut.asp,로그아웃 처리 후 페이지 이동
Admin,Member,,MemberList.asp,회원 전체 리스트
Admin,Member,,JoinList.asp,회원 가입자 현황
Admin,Member,,JoinListExcel.asp,회원 가입자 현황 엑셀출력
Admin,Member,,StoreList.asp,매장별 가입자 현황
Admin,Member,,StoreListExcel.asp,매장별 가입자 현황 엑셀출력
Admin,Member,,DistinctionList.asp,성별 회원 리스트
Admin,Member,,DistinctionListExcel.asp,성별 회원 리스트 엑셀출력
Admin,Member,,DistrictList.asp,지역별 회원 리스트
Admin,Member,,DistrictListExcel.asp,지역별 회원 리스트 엑셀출력
Admin,Member,,AdditionList.asp,부가정보 회원 리스트
Admin,Member,,AdditionListExcel.asp,부가정보 회원 리스트 엑셀출력
Admin,Member,,MonthList.asp,월별 회원 통계
Admin,Member,,MonthListExcel.asp,월별 회원 통계 엑셀출력
Admin,Member,,DayList.asp,일별 회원 통계
이런식....
이 화일을 입력받을 폼 페이지
<html>
<head>
<title>
</title>
</head>
<script language="javascript">
function MakeOk() {
var frm = document.MakeForm
if (frm.author.value == "")
{
alert("제작자를 입력치 않으면\n\n화일 내에 들어가는 Author 부분이 공백으로 입력 됩니다.");
frm.author.focus();
return;
}
if (frm.csvfile.value == "")
{
alert("생성할 화일의 정보가 들어있는 CSV 화일을 입력해 주십시요.");
frm.csvfile.focus();
return;
} else {
var nLen = frm.csvfile.value.length;
var cTemp=frm.csvfile.value.substring(nLen-4, nLen);
if ( cTemp.toLowerCase() != ".csv") {
alert('현재 파일은 CSV만 지원합니다.');
return;
}
}
frm.target = "ProcessFrame";
frm.action = "./MakeFileProcess.asp";
frm.submit();
}
</script>
<body style="font-size:9pt;line-height:140%;">
ASP 화일 일괄 생성 프로그램<br><br>
CSV 화일을 입력받아 폴더별로 화일을 생성하고 화일 내부에 기본정보를 입력해 주는 프로그램입니다.<br>
CSV 화일은 기본형식에 맞게 입력 하여야 합니다.<br><br>
CSV 화일 형식 : 1Depth,2Depth,3Depth,4Depth,Filename,description<br>
ex) Admin,Login,,Login.asp,로그인 폼 화면
<br><br>
본 프로그램은 제 PC 에서만 구동 됩니다.<br><br><br>
<% If request.ServerVariables("REMOTE_ADDR") = "함부로 실행되지 못하게 자신의 아이피 입력" Then %>
<form name="MakeForm" Method="post" enctype="multipart/form-data">
제작자 (이메일) : <input type="text" name="author" maxlength="50" style="border:1px solid;font-size:9pt;width:200px;height:20px;"><br><br>
CSV Upload : <input type="file" name="csvfile" style="border:1px solid;font-size:9pt;width:400px;height:20px;"><br><br>
<input type="button" value="화일 생성" style="border:1px solid;font-size:9pt;width:80px;height:20px;" onclick="MakeOk();">
</form><br>
실행결과<br>
<iframe name="ProcessFrame" id="ProcessFrame" src="" style="width:550px;height:400px;border:1px solid;"></iframe>
<% End If %>
</body>
</html>
filesystemobject 를 이용한 처리 페이지
화일 업로드는 TABSUPLOAD 사용.
<html>
<head>
<title>
</title>
</head>
<body style="font-size:9pt;line-height:140%;">
<%
If request.ServerVariables("REMOTE_ADDR") = "함부로 실행되지 못하게 아이피 입력" Then
'업로드를 처리할 오브젝트를 생성합니다.
Dim Upload, UploadFile, UploadFile1, thumbnailFile
Set Upload = Server.CreateObject("TABSUpload4.Upload")
Set FSO = CreateObject("Scripting.FileSystemObject")
Upload.Start Server.MapPath("/"), False
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Const TristateUseDefault = -2
Const TristateTrue = -1
Const TristateFalse = 0
'업로드되는 데이터 크기를 20M로 제한합니다.
'-- 크기 초과시 서버에서 강제로 연결을 종료시킵니다.
Upload.MaxBytesToAbort = 20 * 1024 * 1024
author = Upload.Form("author")
If Upload.Form("csvfile") <> "" Then
stroldFile = Upload.Form("csvfile").FileName
Set originfile = Upload.Form("csvfile")
originfile.SaveAs Server.MapPath("/") & "\" & stroldFile, False
originfile1 = originfile.SaveName '// 저장된 전체경로와 파일이름
csvfilename = Mid(originfile1,instrrev(originfile1,"\")+1)'// 저장된 파일이름
End If
If FSO.FileExists(originfile1) Then
Dim file
set file = FSO.GetFile(originfile1)
Dim TextStream, FullPath, PID
Set TextStream = file.OpenAsTextStream(ForReading, TristateUseDefault)
PID = 0
Do While Not TextStream.AtEndOfStream
PID = PID + 1
Dim Line
Line = TextStream.readline
LineDetail = Split(Line,",")
If LineDetail(0) <> "" Then
If FSO.FolderExists(Server.MapPath("/") & "\" & LineDetail(0) )=true Then
Else
FSO.CreateFolder(Server.MapPath("/") & "\" & LineDetail(0))
End If
FullPath = Server.MapPath("/") & "\" & LineDetail(0)
Else
FullPath = Server.MapPath("/")
End If
If LineDetail(1) <> "" Then
If FSO.FolderExists(Server.MapPath("/") & "\" & LineDetail(0) & "\" & LineDetail(1) )=true Then
Else
FSO.CreateFolder(Server.MapPath("/") & "\" & LineDetail(0) & "\" & LineDetail(1))
End If
FullPath = FullPath & "\" & LineDetail(1)
End If
If LineDetail(2) <> "" Then
If FSO.FolderExists(Server.MapPath("/") & "\" & LineDetail(0) & "\" & LineDetail(1) & "\" & LineDetail(2))=true Then
Else
FSO.CreateFolder(Server.MapPath("/") & "\" & LineDetail(0) & "\" & LineDetail(1) & "\" & LineDetail(2))
End If
FullPath = FullPath & "\" & LineDetail(2)
End If
If (FSO.FileExists(FullPath & "\" & LineDetail(3))) Then
Else
response.write FullPath & "\" & LineDetail(3) & "<br>"
Set SourceFile = fso.CreateTextFile(FullPath & "\" & LineDetail(3), True)
SourceFile.WriteLine("<%@ EnableSessionState=False " & chr(37) & Chr(62))
SourceFile.WriteLine("<% Option explicit " & chr(37) & Chr(62))
SourceFile.WriteLine("<%")
SourceFile.WriteLine("'********************************************************************************")
SourceFile.WriteLine("'* Program ID : LAURA_" & Right(1000 + PID,3) )
SourceFile.WriteLine("'* create : " & Year(date) & "." & Right(100+Month(date),2) & "." & Right(100+day(date),2) & ".")
SourceFile.WriteLine("'* written by : " & author & "")
SourceFile.WriteLine("'* Description : " & LineDetail(4) & "")
SourceFile.WriteLine("'* Location : " & Replace(Replace(FullPath & "\" & LineDetail(3),Server.MapPath("/"),""),"\","/") & "")
SourceFile.WriteLine("'*")
SourceFile.WriteLine("'* update :")
SourceFile.WriteLine("'* Updated by :")
SourceFile.WriteLine("'* Updated Description :")
SourceFile.WriteLine("'*")
SourceFile.WriteLine("'********************************************************************************")
SourceFile.WriteLine("" & chr(37) & Chr(62))
SourceFile.WriteLine("")
SourceFile.WriteLine("<!--#include virtual=""/Common/Include/Header.asp""-->")
SourceFile.WriteLine("")
SourceFile.WriteLine("<!-- 본문 -->")
SourceFile.WriteLine(" <div id=""contents"">")
SourceFile.WriteLine("")
SourceFile.WriteLine(" </div>")
SourceFile.WriteLine("<!-- //본문 -->")
SourceFile.WriteLine("")
SourceFile.WriteLine("<!--#include virtual=""/Common/Include/Footer.asp""-->")
SourceFile.Close
End If
FullPath = ""
Loop
End If
Set FSO = Nothing
End If
%>
</body>
</html>
이렇게 하면 모든 폴더에 프로그램 리스트 화일이 등록 된다.
'dev > webDev' 카테고리의 다른 글
검정색 바탕화면을 가진 홈페이지 내부 페이지 이동간 화면 깜박임 제거. (0) | 2010.09.03 |
---|---|
웹페이지 컬러칩 등록시 PNG 화일 하나로 끝내기. (0) | 2010.07.21 |
iPin 작업시 주의 사항. (0) | 2010.07.16 |
블로그 형식의 폴더명 웹 페이지 만들기. (0) | 2010.02.16 |
SK Telecom tstore Haptic Widget 개발기 (0) | 2010.02.06 |