Changing the Tufts University Moon Site Needed: ASPUpload (Download a free trial version from www.aspupload.com) Microsoft Access The VI for running VIs (Rover-server, talk to Phil Lau at plau@emerald.tufts.edu) The Moon Site (on CD-ROM) Notepad Microsoft Internet Information Services/Internet Services Manager 1. First, install the Microsoft Internet Information Services/ Internet Services Manager. On Windows 2000 (and NT?) this is found by going Start Menu>Settings>Control Panel>Add/Remove Programs>Add/Remove Windows Components and selecting the checkbox that says Internet Information Services. 2. After installing IIS, go to Start Menu>Programs>Internet Services Manager. A window will come up with two columns. In the column on the right, select your computer. It will open, presenting three options (Default FTP site, Default Web Site, and Default SMP Virtual Server). Select Default Web Site, and hit the play button found in the toolbar at the top. Now your computer is running a web server. 3. Move all of the files from the Moon Site folder on the CD-ROM to C:\Inetpub\wwwroot\ This is the directory for the default website. Windows 2000 puts a lot of extra stuff in here, so check to make sure it is empty before you move the files from the CD-ROM. You can put all of the files in a folder in wwwroot if you want to, but it s not required. 4. Right click on all of the Moon Site files. Go to Properties. Deselect Read-Only for all files. 5. Open default.asp using Notepad. The first two lines are server-side includes. They need to be changed from <!--#include virtual= Moon/includes/includes.asp --> and (!--#include virtual= Moon/pages/default.htm -->. If you put the files from the Moon Site into a folder in wwwroot, then the correct form would be <!-- #include virtual= FolderName/includes/includes.asp -->. If you did not put the files from the Moon Site into a folder in wwwroot, then the form is <!--#include virtual=../includes/includes.asp -->. All.asp files from the Moon site start out this way, therefore the first two lines of every.asp file need to be changed. There is a file called../includes/includes.asp. Every line of this file needs to be changed in the same way. 6. Most of the image links will need to be changed from images/imagename.jpg to../images/imagename.jpg. Most image links are found in../pages.
7. Get ASPUpload if you haven t already. Install this. 8. In wwwroot, create a folder called DB. Open a new MS Access database and save it to C:\Inetpub\wwwroot\DB\. Within this database, create four tables, named moon_users, moon_missions, moon_schedule, and moon_input. 9. Create the following fields. In design view, give these fields the following properties: moon_mission id (required, auto-number, primary-key) schedule_id (required, number, index to id in moon_schedule) user_id (required, number, index to id in moon_user) mission_name (required, no zero length, field size 50) mission_comments (text) program_link (text, length 50) program_gif (text, length 50) data_link (text, lenght 50) video_link (text, length 50) date_submitted (no zero length, required, date/time) date_run (allow zero lenght, not required, date/time) priority (default value= 1, number) moon_schedule id (required, no zero lenght, primary-key, auto-number) user_id (required, no zero length, index with id in moon_user) start_time (required, no zero length, date/time) end_time (required, no zero lenght, date/time) moon_user id ( primary-key auto-number) idkey (required, no zero length, max lenght 25) admin (required, no zero length, number, default=0) first_name (lenght 50, no zero length) last_name (length 50) school_name (length 100, allow zero length ) team_name (lenght 100, allow zero length) address_line1 (length 100, allow zero length) address_line2 (length 100, allow zero length) city (length 100, allow zero length ) state ( length 100, allow zero length ) country (length 100, allow zero length) zip (length 100, allow zero length) telephone (length 25, allow zero length) fax (length 25, allow zero length) email (length 50) grade_taught (length 10) grade_in (lenght 20) under_13 (length 10) parent_email (length 50, allow zero length) parent_contacted (required, no zero length, number, default value=0)
login (required, length 50, text) password (required, length 50, text) date_entered (required, no zero length, date/time) last_login (date time) num_logins (no zero length, number, default is 0) memo (text, allow zero length) moon_input input_id (required, number) file_name (text, length 50, required, no zero length) input_name (text, length 50, requried, no zero length) 10. In../includes/functions.asp, change line 283 from objconn.open "DSN=tutorial;" to objconn.open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=C:\Inetpub\wwwroot\DB\MDDS.mdb" (all on one line, where the file name is the path of your database). 11. In../includes/variables.asp change the upload_path and preferences_file file paths to the correct file paths for your site. Change the missions_link as well. 12. In submit.asp, delete the Tufts University code at the top of the page (from where to download... to but not including <% TOP submit %>. Insert the following code instead: <% ' where to download to... dim download_dir download_dir = upload_path & user.item("idkey") & "\" ' prepare to do file upload Set Upload = Server.CreateObject("Persits.Upload.1") Upload.IgnoreNoPost = TRUE Upload.OverwriteFiles = False ' save form data Count = Upload.SaveToMemory dim action action = Upload.Form("action") if action = "upload" then ' check other parameters of form to make sure A-OK dim mission_name, time_slot, dircrte mission_name = Upload.Form("mission_name") time_slot = Upload.Form("time_slot") dircrte = Upload.Form("yes_no") if mission_name = "" then error_mesg = error_mesg & "<li>no mission name entered.</li>" & vbnewline if time_slot = "" then error_mesg = error_mesg & "<li>no time slot selected.</li>" & vbnewline If dircrte = "2" then error_mesg = error_mesg & "<li>please answer: Have you ever submitted a mission here before?</li>" & vbnewline if dircrte = "0" then Upload.CreateDirectory download_dir if error_mesg="" then Set File = Upload.Files(1) dim file_name file_name = File.ExtractFileName ' test file for being a robolab file (ie. first 4 chars are "RSRC")
'" & file_name & "';" ' first download to temp directory File.SaveAs transfer_temp & file_name 'saved here for virus scan File.SaveAs download_dir & file_name ' now input data into DB dim date_submitted date_submitted = now start_db open_rs_add "SELECT * FROM moon_mission WHERE id = -1" objrs("schedule_id") = time_slot objrs("user_id") = user.item("id") objrs("mission_name") = mission_name objrs("mission_comments") = Upload.Form("mission_comments") objrs("program_link") = file_name objrs("date_submitted") = date_submitted objrs("priority") = 1 ' for now, all have priority of 1 update_rs ' get the ID of the one we just added open_rs_read "SELECT MAX(id) FROM moon_mission WHERE user_id = " & user.item("id") & " AND program_link = dim mission_id mission_id = 1 ' bogus default mission_id = objrs.fields(0) ' get start time/end time of the mission from schedule open_rs_read "SELECT start_time, end_time FROM moon_schedule WHERE id = " & time_slot & ";" dim start_time, end_time, time_diff start_time = objrs("start_time") end_time = objrs("end_time") ' figure out length of time block time_diff = CInt(DateDiff("n", start_time, end_time)) if time_diff < 10 then 'time_diff = "00" & CStr(time_diff) elseif time_diff < 100 then time_diff = "0" & CStr(time_diff) elseif time_diff >= 1000 then time_diff = "999" end_db ' now copy the file also to the upload_path with ' different name so it gets run... ' name is: run##########_###_##.vi ' - the first ########## is for # of seconds since Jan 1, 1970 (padded to 10) ' - the middle ### is the length of the mission in minutes ' - the last ## is for the mission # we just entered file_name = "run" & date_to_filename(cdate(start_time)) & "_" & time_diff & "_" & mission_id & ".vi" File.Copy transfer_out & file_name dim input_name input_name = "run" & date_to_filename(cdate(start_time)) & "_" & time_diff & "_" & mission_id start_db open_rs_add "SELECT * FROM moon_input WHERE mission_id = "&mission_id&"" objrs("file_name") = file_name objrs("input_id") = user.item("id") objrs("input_name") = input_name update_rs end_db xredirect "viewmission.asp?idkey=" & user.item("idkey") if error_mesg <> "" then error_mesg = "<p><b>error with input:</b><ul>" & error_mesg & "</ul></p>" ' matches "if action = 'upload' then... " %>
This doesn t work as well as the Tufts code. For example, the files are not checked to make sure that they are ROBOLAB files. However, I could not get their code to work. This code works. I just run a virus scanner every 10 minutes on missions/temp because all files are saved here (for a virus scan). 13. In includes/functions2.asp, include the following code in the SUBMIT_FORM, right after the line containing Mission Name. This will create a box asking users if they have ever submitted a mission before. If yes, then when they submit a mission, the computer will look for their existing folder. If no, the computer will create a folder for them. <tr><td>have you submitted a mission before?</td><td><select name=yes_no><option value="2">---</option><option value="1">yes</option><option value="0">no</option></select></td></tr> This should be all one line, but MS Word is wrapping the text again. 14. Also in includes/functions2.asp, find the Mission Results form. Delete the entire mission results form and insert this code in its place. <% sub RESULTS_DATA %> <table border=1> <tr><th><a href="results.asp?idkey=<%=user.item("idkey")%>&order_by=mission_name">mission Name</a></th> <th><a href="results.asp?idkey=<%=user.item("idkey")%>&order_by=date_submitted">date Submitted</a></th> <th><a href="results.asp?idkey=<%=user.item("idkey")%>&order_by=date_run">date Run</a></th> <th>program</th><th>mission Data</th> <th>delete?</th></tr> <% start_db open_rs_read "SELECT * FROM moon_mission, moon_input WHERE input_id = " & user.item("id") & " AND user_id="&user.item("id")&" ORDER BY " & order_by & ";" while NOT objrs.eof dim name, comments,input_name dim date_submitted, date_run name = objrs("mission_name") date_submitted = objrs("date_submitted") date_run = objrs("date_run") input_name=objrs("input_name") dim program_link, program_gif, data_link, data_gif program_link= input_name & ".vi" program_gif= input_name & ".jpg" data_link = input_name & ".xls" data_gif= input_name &".jpg" if date_submitted <> "" then date_submitted = "<nobr>" & FormatDateTime(CDate(objRS("date_submitted")), 2) & "</nobr> <nobr>" & FormatDateTime(CDate(objRS("date_submitted")), 3) & "</nobr>" if date_run <> "" then date_run = "<nobr>" & FormatDateTime(CDate(objRS("date_run")), 2) & "</nobr> <nobr>" & FormatDateTime(CDate(objRS("date_run")), 3) & "</nobr>" %> <tr> <td><nobr><%=name%></nobr></td> <td align=center><%=date_submitted%></td> <td align=center><%=date_run%></td> <td align=center> <% if program_link <> "" then %> <%=program_link%><br> <% %> <% if program_gif <> "" then %> [<a href="<%=mission_link%>/data/<%=program_gif%>">view</a>]<br>
%> </table> wend end_db </tr> <% objrs.movenext <% %> <% if program_link <> "" then %> [<a href="<%=mission_link%>/<%=user.item("idkey")%>/<%=program_link%>">download</a>] <% %> </td> <td align=center> <% if data_link <> "" then %> <%=data_link%><br> <% %> <% if data_gif <> "" then %> [<a href="<%=mission_link%>/data/<%=data_gif%>">view</a>]<br> <% %> <% if data_link <> "" then %> [<a href="<%=mission_link%>/data/<%=data_link%>">download</a>] <% %> </td> <td align=center> <form action="results.asp?idkey=<%=user.item("idkey")%>" method=post onsubmit="return confirm('are you sure you want to delete?');" > <input type=hidden name=action value="delete"> <input type=hidden name=mission_id value="<%=objrs("id")%>"> <input type=submit value="delete" id=submit5 name=submit5></form></td> <% end sub %> 15. I have not been able to get the following pages to work: searchusers.asp and viewmission.asp. To avoid viewmission.asp, change submit.asp from (this line of code is towards the end of what you added earlier) xredirect = viewmission.asp?idkey &user.item( idkey ) to xredirect = results.asp?idkey &user.item( idkey ). The same information is on the results page as on the viewmission.asp page. Another thing you could do would be to create a page called thanks.asp, saying something like thanks for submitting your mission and then point to this page with xredirect = thanks.asp?idkey &user.item( idkey ). Delete the link to viewmission.asp from the user menu. Instead, try a link to results.asp?idkey=<%=user.item( idkey )%> For searchusers.asp, it is possible to use MS Access to search the database but this only works if you can access the actual computer with the DB. Depending on security concerns and privacy concerns, you might not want users off the server computer to be able to access your DB. 16. Change the preferences in the page../pages/variables.asp. These are the links that point to your camera, your privacy statement, and other things. That should be it. If there are any questions, please email me at schm1063@tc.umn.edu.