(mact@antares.ecn.fpu.ac.jp) PDF 1997 10 3 The BASIC PDF Macintosh Web CGI EasyBBS CGI The BASIC DOS, DOS/V, WIN Mac PDF PDF Web Macintosh LC475 Web Mac Mac Web Web CGI Web CGI MacOS Web CGI AppleScript CGI Web CGI MacOS Web AppleScript 1
Mac Web AppleScript AppleScript CGI CGI Macintosh AppleScript CGI MacOS CGI CGI (Common Gateway Interface) web UNIX web CGI Web UNIX CGI CGI FORM Web Web Web Interactive Intercreative CGI CGI OS MacOS MacOS AppleEvent CGI CGI Web UNIX CGI MacOS MacOS System 7 AppleEvent MacOS Web CGI MacHTTP Web 2
MacHTTP CGI CGI Web MacOS CGI MacOS AppleScript CGI AppleScript CGI MacOS CGI CGI CGI CGI CGI AppleEvent CGI class=wwwω ID=sdoc AppleEvent FORM AppleEvent Appendix AppleEvent CGI reply CGI AppleEvent CGI reply MacOS CGI AppleEvent reply AppleEvent AppleScript Frontier Userland HyperCard CGI UNIX CGI MacPerl Perl CGI CGI AppleScript System 7.5 Talk7.5 AppleScript 3
Web CGI AppleScript CGI FORM FORM <FORM METHOD="POST" ACTION="form.acgi"> <INPUT TYPE="TEXT" Name="Title" SIZE=50><P> <INPUT TYPE="TEXT" NAME="Name" SIZE=40><P> <BR> <TEXTAREA NAME="MSG" COLS=70 ROWS=5></TEXTAREA><P> <INPUT TYPE="SUBMIT" VALUE="POST"> <INPUT TYPE="Reset" VALUE="Clear"> </FORM> FORM FORM ACTION form.acgi FORM CGI.acgi Mac CGI.cgi.acgi CGI.cgi CGI AppleEvent 4
CGI reply.acgi CGI AppleEvent CGI reply CGI CGI.acgi CGI CGI MacOS CGI.cgi.acgi POST Web form.acgi AppleEvent AppleEvent class=post form.acgi on «event WWWΩsdoc» given «class post»:post_args return end «event WWWΩsdoc» * «option + < *» option + shift + > * Ω option + z AppleEvent (class= WWWΩ, ID=sdoc) AppleScript AppleEvent «event XXXXyyyy» (XXXX = Event Class, yyyy = Event ID) AppleEvent AppleScript «event XXXXyyyy» AppleEvent return HTML HTTP HTTP HTTP CGI CGI CGI 5
HTTP/1.0 200 OK Server: MacHTTP MIME-Version: 1.0 Content-type: text/html return+linefeed (CR + LF) property form.acgi Thank you property crlf : (ASCII character 13) & (ASCII character 10) property http_10_header : "HTTP/1.0 200 OK" & crlf & "Server: MacHTTP" & crlf & "MIME-Version: 1.0" & crlf & "Content-type: text/html" & crlf & crlf on «event WWWΩsdoc» given «class post»:post_args return http_10_header & "<TITLE>Thank You</TITLE>" & crlf & "<h3> </h3>" end «event WWWΩsdoc» class = post post_args post_args Web(HTTP) FORM Form URL = & FORM Web CGI POST form.acgi post_args Title=Web%20%82%C9%89%EF%8Bc%8E%BA%82%F0&Name=%93c%92%86%8B%81%94V&MSG =CGI%20%82%C5%89%EF%8Bc%8E%BA%82%F0%8D%EC%82%E9 6
%XX (XX ASCII HEX URL & Title=Web%20%82%C9%89%EF%8Bc%8E%BA%82%F0 Name=%93c%92%86%8B%81%94V MSG=CGI%20%82%C5%89%EF%8Bc%8E%BA%82%F0%8D%EC%82%E9 = Web%20%82%C9%89%EF%8Bc%8E%BA%82%F0 %93c%92%86%8B%81%94V CGI%20%82%C5%89%EF%8Bc%8E%BA%82%F0%8D%EC%82%E9 %XX Web CGI Mac WINDOWS SHIFT-JIS (SJIS) UNIX EUC JIS Mac SJIS FORM CGI EUC JIS SJIS CGI post_args post_args 7
AppleScript osax osax AppleScript AppleScript Scripting Additions osax AppleScript CGI osax Tanaka's osax CGI AppleScript AppleScript osax osax HyperTalk CompileIt! HyperTalk osax Tanaka's osax URL 1.0b10 Tanaka's Tool <http://mtlab.ecn.fpu.ac.jp/tanaka_tool.html> Tanaka's osax post_args set mylist to DecodeJArgs post_args mylist = {"Web ", " ","CGI "} SJIS form.acgi messages MSG_< > TimeStamp Tanaka's osax Mac return osax xreturner return 8
property crlf : (ASCII character 13) & (ASCII character 10) property http_10_header : "HTTP/1.0 200 OK" & crlf & "Server: MacHTTP" & crlf & "MIME-Version: 1.0" & crlf & "Content-type: text/html" & crlf & crlf property msgfldr : "Macintosh HD:myServer:messages:" on «event WWWΩsdoc» given «class post»:post_args set mylist to DecodeJArgs post_args set mydata to " :" & (item 1 of mylist) & return & " " & (item 2 of mylist) & return & " " & return & (xreturner (item 3 of mylist)) set myfile to msgfldr & "MSG_" & (TimeStamp) writetofile mydata to file myfile return http_10_header & "<TITLE>Thank You</TITLE>" & crlf & "<h3> </h3>" end «event WWWΩsdoc» * msgfldr CGI Stay Open) (Never Show Startup Screen) CGI 9
form.acgi Mac CGI CGI FORM CGI form.acgi HTML HTML 10
CGI CGI NetNews NetNews 11
FORM FORM CGI FORM CGI bbs.acgi CGI CGI CGI CGI CGI search_args CGI URL? http://your.host/bbs.acgi?hello URL? hello search_args bbs.acgi CGI Mac class=kfor CGI CGI search_args post_args search_args post_args search_args post_args search_args MSG_XXXXX post_args search_args ADD_ + post_args 12
bbs.acgi property crlf : (ASCII character 13) & (ASCII character 10) property http_10_header : "HTTP/1.0 200 OK" & crlf & "Server: MacHTTP" & crlf & "MIME-Version: 1.0" & crlf & "Content-type: text/html" & crlf & crlf property redirect_header : "HTTP/1.0 302 Found" & crlf & "Server: WebSTAR/1.0 ID/ACGI" & crlf & "MIME-Version: 1.0" & crlf & "Location: " property msgfldr : "Macintosh HD:myServer:messages:" on «event WWWΩsdoc» given «class kfor»:search_args, «class post»:post_args try if search_args = "" then if post_args = "" then return toppage() else return makenew(post_args) end if else if "ADD_" is in search_args then return addcomment(search_args, post_args) else if "MSG_" is in search_args then return showpage(search_args) else error "CGI " end if on error errmsg return http_10_header & "<TITLE>Error</TITLE>" & crlf & "<h3>cgi </H3>" & crlf end try end «event WWWΩsdoc» & "<B>" & errmsg & "</B>" * redirect_header property 13
form.acgi post.html FORM HTML form.acgi return form.acgi form.acgi redirect redirect HTTP/1.0 302 Found Server: MacHTTP MIME-Version: 1.0 Location: <URL> CR+LF <URL> CGI URL redirect redirect property CGI URL redirect URL reload 14
makenew on makenew(post_args) post_args set mylist to DecodeJArgs post_args set mytitle to item 1 of mylist set myname to item 2 of mylist set mymsg to item 3 of mylist return set mymsg to xreturner mymsg < > set mymsg to xreplace mymsg search "<" replace "<" set mymsg to xreplace mymsg search ">" replace ">" HTML <PRE> set mypage to "<TITLE>" & mytitle & "</TITLE>" & return & "<H2>" & mytitle & "</H2>" & return & "<H3> " & myname & "</H3>" & return & "<TT>(Date: " & ((current date) as string) & ")</TT><P><HR><P>" & return & "<PRE>" & mymsg & "</PRE><P><HR size=4><p>" & return set myfile to "MSG_" & (TimeStamp) writetofile mypage to file (msgfldr & myfile) redirect URL crlf return redirect_header & "bbs.acgi?" & myfile & crlf & crlf end makenew * xreplace Tanaka's osax 15
search_args FORM return FORM HTML " ACTION on showpage(search_args) set mypage to readfromfile file (msgfldr & search_args) return http_10_header & mypage & return & "<FORM METHOD= "POST " ACTION= "bbs.acgi?add_" & search_args & " ">" & return & "<H4> </H4><P>" & return & " :<INPUT TYPE=text NAME=name SIZE=40><p>" & return & "<TEXTAREA NAME=comt ROWS=5 COLS=70></TEXTAREA><P>" & return & "<INPUT TYPE=submit VALUE= "Post Comment "><INPUT TYPE=reset VALUE= "Reset ">" & return & "</FORM><P><HR><P><h4><UL>" & return & "<LI><A HREF= "bbs.acgi ">Top Page</A></UL></H4><HR><P>" end showpage * readfromfile Tanaka's osax 16
search_args ADD_ + ADD_ post_args redirect search_args ADD_ URL on addcomment(search_args, post_args) set AppleScript's text item delimiters to {""} set tgpage to (characters 5 through -1 of search_args) as string post_args set mylist to DecodeJArgs post_args set myname to item 1 of mylist set mymsg to item 2 of mylist return set mymsg to xreturner mymsg < > set mymsg to xreplace mymsg search "<" replace "<" set mymsg to xreplace mymsg search ">" replace ">" set mydata to "<B>" & myname & "</B> <BR>" & return & "<TT>( Date: " & ((current date) as string) & ")</TT><p>" & return & "<PRE>" & mymsg & "</PRE><HR><P>" & return appendtofile mydata to file (msgfldr & tgpage) return redirect_header & "bbs.acgi?" & tgpage & crlf & crlf end addcomment * apendtofile Tanaka's osax 17
Web CGI CGI CGI BBS_Header BBS_Footer Tanaka's osax dirlister <TITLE> Tanaka's osax getpagetitle mylist AppleScript text item delimiter return mylist set mylist to "" repeat with x from 1 to 1000 set mylist to mylist & (x as string) & " " & return end repeat Quadra 840AV set mylist to {} repeat with x from 1 to 1000 set end of mylist to (x as string) & " " end repeat set AppleScript's text item delimiters to {return} set mylist to mylist as string 18
set AppleScript's text item delimiters to {""} text item delimiter return AppleScript text item delimiter AppleScript toppage on toppage() try set mylist to dirlister alias msgfldr ofname "MSG_" on error set mylist to {} end try set mymsgnm to count items of mylist set mydata to {} set end of mydata to ((current date) as string) set end of mydata to "<P><H4> " & (mymsgnm as string) & " </H4>" if mymsgnm 0 then set end of mydata to " <UL>" repeat with myf in mylist set tgf to alias (msgfldr & myf) set mytitle to getpagetitle tgf set end of mydata to "<LI><B><A HREF= "bbs.acgi?" & myf & " ">" & mytitle & "</B></A><BR>" set end of mydata to "<TT>( " & ((modification date of (info for tgf)) as string) & " )</TT><P>" end repeat set end of mydata to "</UL><P>" 19
end if mydata set AppleScript's text item delimiters to {return} set mydata to mydata as string set AppleScript's text item delimiters to {""} set myheader to readfromfile file "Macintosh HD:myServer:BBS_header" set myfooter to readfromfile file "Macintosh HD:myServer:BBS_footer" return return http_10_header & myheader & mydata & myfooter end toppage * post.html BBS_footer bbs.acgi bbs.acgi bbs.acgi BBS_header BBS_footer post.html Web bbs.acgi 20
http://your.host/bbs.acgi your.host Web IP AppleScript CGI Web Scripter's Meeting <http://mtlab.ecn.fpu.ac.jp/webcon.mtxt> 21
MacOS Web CGI EasyBBS EasyBBS <http://mtlab.ecn.fpu.ac.jp/easybbs/> Web Scripter's Meeting Tanaka's osax EasyBBS Macintosh Cyber Barbarians "Planning and Managing WEB SITES on the Macintosh" Jon Wiederspan & Chuck Shotton Addison Wesley Developer Press 22
Appendix : CGI AppleEvent class path_args ('----') URL $ search_args ('kfor') URL? post_args ('post') METHOD=POST FORM method ('meth') GET POST client_address ('addr') IP Web username ('user') REALM password ('pass') --- REALM from_user ('frmu') E-mail server_name ('svnm') Web IP Web server_port ('svpt') Web script_name ('scnm') CGI URL content_type ('ctyp') CGI 23
MIME referer ('refr') CGI URL CGI user_agent ('Agnt') WebSTAR action ('Kact') CGI Action action_path ('Kapt') CGI client_ip ('Kcip') IP full_request ('Kfrq') WebSTAR 24