<%
// Form elements with positions of the mouse cursor on the form submission button
//----------final String SUBMIT_X = "feedbacksubmission.x";
//----------final String SUBMIT_Y = "feedbacksubmission.y";
// Name of the form submission button
final String SUBMIT_NAME = "feedbacksubmission";
final String SUBMIT_VALUE = "Send Feedback";
final String CLEAR_FORM_NAME = "clearform";
final String CLEAR_FORM_VALUE = "Clear Form";
// HTTP header with the URL from where the user navigated to the feedback page
final String REFERER = "Referer";
// Type of request expected for form submission
final String POST_REQUEST = "POST";
// Address to which user input is sent
final String TO_ADDRESS = "ocw@MIT.EDU";
// Address from which user input is shown as orignating from
final String SOURCE_ADDRESS = "ocw@MIT.EDU";
// Form fields to be filled in by the user
final String DESCRIPTION = "description";
final String DESCRIPTION_ID = "desc";
final String FROM_ADDRESS = "fromemail";
final String INQUIRY_TYPE = "inquiry";
final String INQUIRY_TYPE_ID = "nature";
final String FIRST_NAME = "firstname";
final String LAST_NAME = "lastname";
final String EDUCATIONAL_ROLE = "educationalRole";
final String GEOGRAPHIC_REGION = "geographicRegion";
final String GEOGRAPHIC_REGION_ID = "geo";
// URL to which the form will be posted
final String ACTION_URL = "/OcwWeb/jsp/feedback.jsp";
%>
<%
// Indicates if the Form field values are sent via POST by the user
boolean feedbackSubmitted = false;
// Position of the mouse cursor on the Form submission button
//------------String submitXValue = request.getParameter(SUBMIT_X);
//------------String submitYValue = request.getParameter(SUBMIT_Y);
// URL from which the user navigated to the feedback page
String referer = null;
// List of errors in the Form submitted by the user
ArrayList errorList = null;
// Form field values
String description = "";
String fromAddress = "";
String firstName = "";
String lastName = "";
String inquiryType = "";
String educationalRole = "";
String geographicRegion = "";
// Request method - GET or POST
String requestMethod = request.getMethod();
String selected_value = "";
//{"A","B","C","D","E","F","G","H","I","J","K","L","M","M","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
String[] array_countries = {"United States", "United Kingdom", "Afghanistan", "Albania", "Algeria", "Andorra", "Angola", "Antigua and Barbuda", "Argentina", "Armenia", "Australia", "Austria", "Azerbaijan", "Bahamas, The", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bhutan", "Bolivia", "Bosnia and Herzegovina", "Botswana", "Brazil", "Brunei", "Bulgaria", "Burkina Faso", "Burma", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Central African Republic", "Chad", "Chile", "China", "Colombia", "Comoros", "Congo (Brazzaville)", "Congo (Kinshasa)", "Cook Islands", "Costa Rica", "Côte d'Ivoire", "Croatia", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "Ecuador", "Egypt", "El Salvador", "Equitorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Fiji", "Finland", "France", "Gabon", "Gambia, The", "Georgia", "Germany", "Ghana", "Greece", "Grenada", "Guatemala", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Holy See", "Honduras", "Hungary", "Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea, North", "Korea, South", "Kuwait", "Kyrgyzstan", "Laos", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg", "Macedonia, The Former Yugoslavia Republic of", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Mauritania", "Mauritius", "Mexico", "Micronesia, Federal States of", "Moldova", "Monaco", "Mongolia", "Morocco", "Mozambique", "Namibia", "Nauru", "Nepal", "Netherlands", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Poland", "Portugal", "Qatar", "Romania", "Russia", "Rwanda", "Saint Kitts and Nevis", "Saint Lucia", "Saint Vincent and the Grenadines", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "Spain", "Sri Lanka", "Sudan", "Suriname", "Swaziland", "Sweden", "Switzerland", "Syria", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "Togo", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States", "Uruguay", "Uzbekistan", "Vanuatu", "Venezuela", "Vietnam", "Yemen", "Yugoslavia", "Zambia", "Zimbabwe"};
String country = "";
// Accept only submissions made via post (i.e., from the feedback page itself)
if (requestMethod.equals(POST_REQUEST))
{
feedbackSubmitted = true;
referer = request.getParameter(REFERER);
}
else
{
referer = request.getHeader(REFERER);
if (referer == null || referer.equals(ACTION_URL))
{
referer = "/OcwWeb/index.htm";
}
}
%>
<% if (feedbackSubmitted) {
// Get the values input by the user
description = request.getParameter(DESCRIPTION);
fromAddress = request.getParameter(FROM_ADDRESS);
firstName = request.getParameter(FIRST_NAME);
lastName = request.getParameter(LAST_NAME);
inquiryType = request.getParameter(INQUIRY_TYPE);
educationalRole = request.getParameter(EDUCATIONAL_ROLE);
geographicRegion = request.getParameter(GEOGRAPHIC_REGION);
// Subject of the e-mail that will be sent
String subject = inquiryType;
if (firstName == null){
firstName = "";
}
if (lastName == null){
lastName = "";
}
// Ensure that description and e-mail address of the user
// have been specified
if (description == null || description.trim().equals("")){
if (errorList == null){
errorList = new ArrayList();
}
errorList.add("The Description field is blank.");
}
if (educationalRole.equals("") || educationalRole.equals("No Selection")){
if (errorList == null) {
errorList = new ArrayList();
}
errorList.add("The Educational Role field is blank.");
}
if (inquiryType.equals("") || inquiryType.equals("No Selection") ){
if (errorList == null) {
errorList = new ArrayList();
}
errorList.add("The Nature of Inquiry field is blank.");
}
if (fromAddress == null || fromAddress.trim().equals("")){
fromAddress = "";
if (errorList == null){
errorList = new ArrayList();
}
errorList.add("The Email Address field is blank.");
}
else{
int atIndex = 0;
int dotIndex = 0;
// Ensure that the e-mail address is of the correct format. The following
// check is performed.
// 1. There is exactly one '@' character in the address and that is neither
// the first nor the last character
// 2. There is at least one '.' character in the address after the '@' character
// and that is not the last character
if (((atIndex = fromAddress.indexOf("@")) < 1) ||
((dotIndex = fromAddress.indexOf(".", atIndex)) == -1) ||
(atIndex != fromAddress.lastIndexOf("@")) ||
(fromAddress.lastIndexOf(".") == fromAddress.length()))
{
if (errorList == null){
errorList = new ArrayList();
}
errorList.add("The format of the e-mail address is invalid.");
}
}
// The following statements determine the course to which the URL from which
// the user navigated from belongs to
//String absPath = OcwSiteInfo.getAbsolutePath(referer);
boolean sent = false;
String course = "";
if (referer != null)
{
course = referer.replace('/', File.separatorChar);
}
// The following statements construct the message to be sent
StringBuffer message = new StringBuffer(256);
if (!course.equals(""))
{
message.append("Refering URL: " + course);
message.append("\n\n");
}
message.append("Name: ").append(firstName).append(" ").append(lastName);
message.append("\n\nE-mail: ").append(fromAddress);
message.append("\n\nNature of Inquiry: ").append(inquiryType);
message.append("\n\nEducational Role: ").append(educationalRole);
message.append("\n\nGeographic Region: ").append(geographicRegion);
message.append("\n\nDescription:\n").append(description).append("\n");
String toAddresses[] = new String[1];
toAddresses[0] = TO_ADDRESS;
String fromAddresses[] = new String [1];
fromAddresses[0] = fromAddress;
String softReplyMessage = "Thank you for your recent correspondence about MIT OpenCourseWare (MIT OCW). Since we opened the site to the public on September 30, 2002, we have been gratified by the number of messages we have received from people all over the world. MIT OCW encourages users to provide feedback on the site and the published course materials. Due to the tremendous volume of email inquiries we receive, we cannot guarantee all messages will receive a response. However, we will try and reply to you within 48 hours of the receipt of your message. We suggest that you refer to the MIT OCW \"Frequently Asked Questions\" page at http://ocw.mit.edu/OcwWeb/Global/OCWHelp/help.htm. You may find the answer to your question there.\n\nThank you for joining us on this, the first step of our educational journey.\n\nSincerely,\n\nThe MIT OpenCourseWare Team";
String softReplySubject = "Thank you for your OCW feedback";
// Send the message only if no error is encountered and the information
// is complete
if (errorList == null)
{
try
{
OcwNotifier.sendMessage(SOURCE_ADDRESS, toAddresses, null, null, subject, message.toString());
sent = true;
try
{
OcwNotifier.sendMessage(SOURCE_ADDRESS,fromAddresses,null,null,softReplySubject,softReplyMessage);
}
catch (Throwable e)
{
//
}
}
catch (Throwable e)
{
//
}
}
%>
<% if (errorList == null) {%>
We welcome your feedback!
With 1100 courses now available online, MIT is fulfilling the promise of MIT OpenCourseWare. Feedback from visitors will help us to understand how to improve the MIT OCW Web site as we move to the publication of the course materials used in virtually all of MIT's graduate and undergraduate courses.
Find out how to use OCW or get help, go to: OCW Help
To report problems, ask questions, or provide feedback, email: ocw@mit.edu
To report intellectual property concerns, go to: OCW Legal Notices
Thanks for taking the time to let us know!
Return to referring page
<%}%>
<%}%>
<%
// Display the form if the request is not of type POST or
// the information posted had errors or was incomplete or
// the form was refreshed
if ( (errorList != null) || (!feedbackSubmitted) ) {%>
Feedback
We welcome your feedback!
With 1100 courses now available online, MIT is fulfilling the promise of MIT
OpenCourseWare. Feedback from visitors will help us to understand how to
improve the MIT OCW Web site as we move to the publication of the course
materials used in virtually all of MIT's graduate and undergraduate courses.
-
MIT OCW is not a distance-learning, or a degree- or certificate-granting
initiative. There is no registration process required for users to view course
materials. MIT OCW is available on the Web, free of charge, to any user
anywhere in the world.
-
MIT OCW does not offer the opportunity for direct contact with MIT faculty.
Inquiries related to specific course materials will be forwarded to the MIT
faculty member associated with that course for their consideration. However,
due to the tremendous volume of email inquiries received, it is unlikely he or
she will answer all emails.
-
MIT aims to publish course materials from virtually all of its subjects by the
year 2008. If you do not find the course materials you are looking for, please
check back with us periodically as we add new courses, including 175 more in
Spring 2005. You are encouraged to register for our email newsletter,
The MIT OpenCourseWare Update, to receive monthly updates on new course
offerings.
Also, before sending us your inquiry, we ask that you check if your question can
be answered by our MIT OCW
Frequently Asked Questions. We will try to answer your question as soon
as possible.
Fill out the feedback form below (* indicates required fields):
<% if (errorList != null) {
// Display all the errors that were encountered
for (int i = 0; i < errorList.size(); i++){%>
<%=((String)errorList.get(i))%>
<%
}
%>
<%}%>
<%}%>