Пример #1
0
def Main():
	
	form = cgi.FormContent()
	if form.has_key("className"):
		className = form["className"][0]
		origPass = advdb.query("SELECT classpasswd from classes WHERE class_abv = '"+className+"' ").dictresult()[0]["classpasswd"]

		if form.has_key("classpasswd"):
			classpasswd = form["classpasswd"][0]					
			if classpasswd != origPass:
				style.SendError("The password you entered was incorrect, Try again.")
			makePage(className)
		elif origPass == "No" or form.has_key("sstr"):
			makePage(className)			

		elif origPass != "No":
			SEVERE2.setupPage("Class Authentification.")
			print '<H3>Password Required:</H3>'
			print '<P>This class requires a password, please enter it now.'
			print '<form method="POST" action="list.py">'
			print '<input type="hidden" name="className" value="'+className+'">'	
			print '<BR><B>Enter Password:</B> <input type="text" name="classpasswd">'
			print '<BR><input type="SUBMIT" value="Enter Exercise">'
			print '</form>'
			SEVERE2.finishPage("advanced")
			sys.exit(0)

		else:
			style.jump_page("first.py?className="+className+"&caseNum="+caseNum+"")

	else:
		SEVERE2.setupPage("Sx Wx Forecasting Activity | Advanced Version")
		askForClass()
		SEVERE2.finishPage("advanced")
		sys.exit(0)	
Пример #2
0
def Main():
	SEVERE2.setupPage("ClassAdmin for Sx Forecasting Activity")

	print """
	<H3>Edit Specific Hourly Questions:</H3>
	<blockquote>
	<B>Instructions:</B> This exercise comes pre-built with a standard set of questions that get asked at various hours.  You can add your
	own questions at any hour of your choice.  These questions are then asked when students work through the exercise and the results are
	emailed back to you.
	</blockquote>
	"""

	form = cgi.FormContent()
	if not form.has_key("caseNum"):
		print '<form method="POST" action="index.py">'
		print '<H3>Select Case to Edit Questions for:</H3>'
		SEVERE2.listGoodCases()
		print '<BR><input type="submit" value="Select Case">'
		print '</form>'
	else:
		caseNum = form["caseNum"][0]
		print '<form method="POST" action="edit.py">'
		print '<input type="hidden" value="'+caseNum+'" name="caseNum">'
		print '<H3>Select Hour to Add/Delete/Edit Specific Question For:</H3>'
		SEVERE2.listHours(caseNum)
		print '<BR><input type="submit" value="Select Specific Time">'
		print '</form>'


	print '<P>Links outta here:'
	print '<HR>'
	print '<a href="../index.py">ClassAdmin</a>'
	
	SEVERE2.finishPage()
Пример #3
0
def makePage(className):
	SEVERE2.setupPage("Sx Wx Forecasting Activity | Advanced Version")
	
	print """<CENTER>
	<img src="/icons/svrTop.gif">
	</CENTER>
	<blockquote>
	The Severe Weather Forecasting Exercise is a web-based exercise that is designed to stimulate interest in severe weather. This
	exercise is being developed for use by all levels of meteorologists and K-12 students as well. Because of the wide range of skills
	among users, there are three versions of the forecasting exercise.

	<P>The exercise is worked by trying one of the cases below.  The case uses archived data and prepared questions to guide the user
	thoughout the cases duration.  Currently, we have two types of cases: the "Summer-like Events" contain questions that concern summer
	like severe weather (tornado, hail, heavy rain), and the "Winter-like Events" stress winter severe weather phenonema.

	<P>The advanced version of the exercise has been designed to allow any instructor administrative control over the exercise.  Once you 
	are an administrator, you can customize the questions that appear and allow your students to work through cases that you hand select.
	The results of your students work is then emailed back to you for your review.  More information on this feature can be found 
	<a href="/svr_frcst/advInstructor.html">here.</a>

	</blockquote>
	<H2><font color="#a0522d">Advanced Version:</font></H2>
			<dd>The advanced version of the forecasting exercise contains questions that are geared to upper-level meteorology students and prodessional meteorologists.
			</dd>
		"""

	print "<H3>Summer-like Events:</H3>"
	list_cases2(className, "s")

	print "<H3>Winter-like Events:</H3>"
	list_cases2(className, "w")
	SEVERE2.finishPage("advanced", className)
	sys.exit(0)
Пример #4
0
def Main():
	form = cgi.FormContent()
	SEVERE2.setupPage("classAdmin for Sx Wx Forecasting")
	print """
	<H3>Edit Annotations for the Exercise.</H3>
	<blockquote>
	<B>Instructions:</B> The exercise comes pre-built with comments and annotations for each hour during the duration of each case.
	These annontations can be edited with this dialog, first select the case and then select the hour.  Your changes will imediately start
	appearing once you make the submissions.
	
	</blockquote>
	"""
	if form.has_key("caseNum"):
		print """
		<HR>
		<a href="hourly.py">Select a different Case</a><BR><HR>"""

		print '<form method="post" action="editHourly.py">'
		print '<input type="hidden" value="'+form["caseNum"][0]+'" name="caseNum">'
		SEVERE2.listHours( form["caseNum"][0] )
	else:
		print '<form method="post" action="hourly.py">'
		SEVERE2.listGoodCases()

	print '<input type="submit" value="submit">'

	print '<P>Back to <a href="../index.py">ClassAdmin Homepage</a>'

	SEVERE2.finishPage()
Пример #5
0
def Main():
	SEVERE2.setupPage()

	form = cgi.FormContent()

	print """
	<CENTER>
	<img src="/icons/svrTop.gif">
	</CENTER>

	<dd>The Severe Weather Forecasting Exercise is a web-based exercise that is designed to stimulate interest in severe weather. This
exercise is being developed for use by all levels of meteorologists and K-12 students as well. Because of the wide range of skills
among users, there are three versions of the forecasting exercise.</dd>

	<dd>The exercise is worked by trying one of the cases below.  The case uses archived data and prepared questions to guide the user
thoughout the cases duration.  Currently, we have two types of cases: the "Summer-like Events" contain questions that concern summer
like severe weather (tornado, hail, heavy rain), and the "Winter-like Events" stress winter severe weather phenonema.</dd>

	<H2><font color="#a0522d">Basic Version:</font></H2>

	<DD>Here is a listing of available cases that can be worked though.  Please feel free to try any of them out.  They do not hurt.</dd>
	"""

	print "<H3>Summer-like Events:</H3>"
	list_cases("s")
	
	print "<H3>Winter-like Events:</H3>"
	list_cases("w")

	SEVERE2.finishPage("basic")
Пример #6
0
def Main():

	SEVERE2.setupPage("Creating Class for Advanced Forecasting Exercise")


	if form.has_key("name"):
		enterForm()
	else:
		newClassForm()

	SEVERE2.finishPage()
Пример #7
0
def Main():
	if form.has_key("type"):
		caseNum = form["caseNum"][0]
		type = form["type"][0]
		if type == "add":
			delete = mydb2.query("DELETE from basecases_custom WHERE caseNum = '"+caseNum+"' and className = '"+className+"' ")
			hello = mydb2.query("INSERT into basecases_custom(casenum, className) VALUES ('"+caseNum+"', '"+className+"')")
		else:
			hello = mydb2.query("DELETE from basecases_custom WHERE caseNum = '"+caseNum+"' and className = '"+className+"' ")


	SEVERE2.setupPage("Add/Revoke Cases to the System.")

	print """
	<blockquote>
	<B>Instructions:</B> This dialog releases and revokes which cases your students can work with.  When your students access the
	main page, they are presented with a listing of cases that you have released to them to work.  That listing is controled from 
	this dialog.  Removing or adding cases DOES NOT delete any work done on the specific questions nor the comments.
	</blockquote>
	"""

	print '<H3 align="CENTER">Pick A Case</H3>'

	print '<P>Release or remove cases to your hearts content.'

	print '<TABLE WIDTH="100%"><TR><TD>'
	print '<H3>Cases available</H3>'
	print '<FORM name="add" METHOD="POST" ACTION="release.py">'
	print '<input type="hidden" name="type" value="add">'
	print '<input type="hidden" name="className" value="'+className+'">'
	SEVERE2.listGoodCases()
	print '<input type="submit" value="Add This Case">'
	print '</form><BR>'

	print '</TD><TD>'
	
	print '<H3>Cases allready released</H3>'
	print '<FORM name="del" METHOD="POST" ACTION="release.py">'
	print '<input type="hidden" name="className" value="'+className+'">'
	print '<input type="hidden" name="type" value="del">'
	list_cases2(className)
	print '<input type="submit" value="Delete This Case">'
	print '</form><BR>'

	print '</TD></TR></TABLE>'

	print '<a href="../index.py">ClassAdmin Homepage</a>'

	SEVERE2.finishPage()
Пример #8
0
def Main(userKey, caseNum):
	form = cgi.FormContent()
	userKey, lastTime, gradeTime, startTime, noonTime, endTime, caseNum, className = functs.retreiveUser()

	print '<form method="POST" action="/cgi-bin/severe2/advanced/wrapper.py">'
	print '<input type="hidden" name="userKey" value="'+str(userKey)+'">'

	instructions()

	print """<font color="BLUE"><H2>Make Your Forecast:</H2></font>
	<font color="#a0522d"><blockquote>You are now asked to forecast a state where you believe severe weather will occur.  More 
	specifically, forecast during which time period this will occur and what type(s) of severe weather.  Your forecast will be validated at the end
	of the exercise.</blockquote></font>"""

	print '<TABLE align="CENTER" WIDTH="90%">'
	print '<TR><TH bgcolor="#EEEEEE">Select a state:</TH></TR>'
	print '<TR><TD align="center">'
	states()
	print '</TD></TR>'

        if caseNum[0] == "s":
                print '<TR><TH bgcolor="#EEEEEE">Select A Valid Time:</TH></TR>'
                print '<TR><TD align="CENTER">'
                times()
                print '</TD></TR>'

                print '<TR><TH bgcolor="#EEEEEE">Type of Severe Weather: (Check all that apply)</TH></TR>'
                print '<TR><TD align="CENTER">'
                sum_types()
                print '</TD></TR>'

        if caseNum[0] == "w":
                print '<TR><TH bgcolor="#EEEEEE">Type of Severe Weather: (Check all that apply)</TH></TR>'
                print '<TR><TD align="CENTER">'
                win_types()
                print '</TD></TR>'


        print '<TR><TH bgcolor="#EEEEEE">Submit Your Forecast:</TH></TR>'
        print '<TR><TD align="CENTER">'
        print '<input type="IMAGE" src="/gen/hour.php?label=Submit%20Forecast&font_size=20" BORDER="0">'
        print '</TD></TR>'

        print '</TABLE>'
        print '</BODY></HTML>'

	SEVERE2.finishPage("advanced", className)
	sys.exit(0)
Пример #9
0
def Main():
	form = cgi.FormContent()
	if not form.has_key("caseNum"):
		style.SendError("No case number was supplied to this script")
	if not form.has_key("className"):
		style.SendError("No class name specified")

	caseNum = form["caseNum"][0]  
	className = form["className"][0]

	userKey = mk_new_entry()

	SEVERE2.setupPage("Welcome to the Severe Weather Forecasting Activity")

	if form.has_key("test"):
		print """
		You may proceed through this exercise as a guest of this system.  Your answers will not be emailed to anybody.<BR>
		<BR>You may want to choose to not answer any of the specific questions that pop up during the exercise.  This helps to
		speed up the exercise quite a bit.  You will still be asked the questions about where you believe severe weather to occur.
		<BR><BR>
		<form method="POST" action="index.py">
		<input name="answerQs" value="True" CHECKED  type="radio">Answer Questions<BR>
		<input name="answerQs" value="False" type="radio">No questions please<BR>
		"""
		print '<INPUT type="hidden" value="'+className+'" name="className">'
		print '<INPUT type="hidden" value="'+caseNum+'" name="caseNum">'
		print '<INPUT type="hidden" value="'+str(userKey)+'" name="userKey">'
		print '<INPUT type="hidden" value="*****@*****.**" name="email">'
		print '<INPUT type="hidden" value="NOB" name="name">'

		print """
		<BR><input type="SUBMIT" value="Let's Start!!">
		</form>"""

		SEVERE2.finishPage("advanced", className)
		sys.exit(0)
	
	ask_for_info(caseNum, userKey, className)

	SEVERE2.finishPage("advanced", className)
Пример #10
0
def Main():
	form = cgi.FormContent()
	try:
		caseNum = form["caseNum"][0]
		zticks = form["zticks"][0]
	except:
		style.SendError("CGI Parse Error")

	entry  = get_entry(caseNum,  float( zticks ) )

	try:
		comment = entry[0]["comments"]
	except IndexError:
		comment = "Write Something here"
	try:
		analysis = entry[0]["analysis"]
	except IndexError: 
                analysis = "Write Something here"

	localTuple = time.localtime( float(zticks) )
	nowStr = time.strftime("%b %d, %Y -- %HZ", localTuple)

	SEVERE2.setupPage("classAdmin for Sx Wx Activity")
	print '<H3 align="center">Edit annotation for '+nowStr+'</H3>'
	print """
	<HR>
		<a href="hourly.py">Select a different Case</a><BR>"""
	print '<a href="hourly.py?caseNum='+caseNum+'">Select a different Hour for this Case</a><BR><HR>'

        print '<form method="post" action="addHourly.py">'
	print '<input type="hidden" name="zticks" value="'+str(int(zticks))+'">'
	print '<input type="hidden" name="caseNum" value="'+str(caseNum)+'">'
	adds(comment, analysis)
	print '<BR><input type="submit" value="Click to Save this Entry">'
	print '</form>'

	print '<P><a href="../index.py">Back to ClassAdmin</a>'

	SEVERE2.finishPage()	
Пример #11
0
def Main():
	form = cgi.FormContent()
	if not form.has_key("email"): style.SendError("Please go back and enter your email address")
	email = form["email"][0]

	if not form.has_key("name"): style.SendError("Please go back and enter your name")
	name = form["name"][0]

	answerQs = form["answerQs"][0]
	userKey = form["userKey"][0]
	caseNum = form["caseNum"][0]
	className = form["className"][0]

	query = basedb.query("SELECT startTime from cases WHERE casenum = '"+caseNum+"' ").dictresult()
	startTime = query[0]["starttime"]

	update_db(userKey, name, email, className, startTime, answerQs, caseNum)

	SEVERE2.setupPage("Sx Wx Forecasting Exercise | Advanced Version")
	SEVERE2.printTime( startTime )

#	svrFrcst.svrTop(start_tuple, start_secs)


	print """
	This is a forecasting exercise for forecasting severe weather. You will be given hourly data for 6 hours and then asked to make some
decisions on where you believe severe weather will occur.  Then you will be guided  through the rest of the case and then given the results at the
end.  During this exercise, you may be asked  other case specific questions about the data that you are seeing.  Make sure to look at the maps, and
good luck!
	<BR><BR>"""

	svrFrcst.printIntro(caseNum, className)

	print '<CENTER>'
	cgiValues = 'userKey='+str(userKey)
	print '<a href="/cgi-bin/severe2/advanced/hour.py?'+cgiValues+'"><img src="/gen/hour.php?label=Click%20To%20Start&font_size=25" border="0"></a>'
	print '</CENTER>'
	SEVERE2.finishPage("advanced")
Пример #12
0
def Main():
	form = cgi.FormContent()
	userKey, lastTime, gradeTime, startTime, noonTime, endTime, caseNum, className = functs.retreiveUser()
	
	bonus_pts = int( advdb.query("SELECT bonuspoints from users WHERE userKey = '"+userKey+"' ").getresult()[0][0] )
	pause_page = 1
	i = 0
	
	for quest in qs:
		i = i + 1
		if form.has_key(quest):
			if form.has_key(quest+"txt"):
				donothing = 1
			else:
				try:
					this_option = form[quest+"option"][0]
				except:
					style.SendError("You need to answer Question number "+str(i)+", go back")			

	SEVERE2.setupPage()
	SEVERE2.printTime(lastTime)


	print '<H2 align="CENTER">Question Response</H2>'
	i = 0
	for quest in qs:
		i = i + 1
		if form.has_key(quest):
			q_id = form[quest+"q_id"][0]
			if form.has_key(quest+"text"):			# We have a text question
				textAns = form[quest+"text"][0]
				textAns = functs.clean_str(textAns)
				print '<HR><font color="blue">Question '+str(i)+':</font><BR>'  
				if len(q_id) < 5:
					question = advdb.query("SELECT question from questions WHERE q_id = '"+q_id+"' ").getresult()[0][0]
				else:
					question = advdb.query("SELECT question from questions_custom WHERE validTime = '"+q_id+"' ").getresult()[0][0]
				enter_text(userKey, textAns, 'T', q_id, '0', question)
				print 'Your Text response was entered and will be sent to your instructor..<HR>'
			else:
				print '<HR><font color="blue">Question '+str(i)+':</font><BR>'
				pause_page = 0
				this_option = string.lower( form[quest+"option"][0] )
				optionName = "option"+this_option
				if optionName == "optionyes":
					print "<H3> Did you forget to answer one of the questions? Go back and answer it!</H3>"
					SEVERE2.finishPage()
					sys.exit(0)
				

				if len(q_id) > 5: # We have a custom question
					thisQuery = advdb.query("SELECT question, answer, "+optionName+", correct, wrong from questions_custom WHERE validTime = '"+q_id+"' and className = '"+className+"' ").dictresult()
					thisQuestion = thisQuery[0]["question"]
					thisAnswer = thisQuery[0]["answer"]
					thisOptionText = thisQuery[0][optionName]
					thisCorrect = thisQuery[0]["correct"]
					thisWrong = thisQuery[0]["wrong"]
															
				else:	# We must have a standard Question 
					thisQuery = advdb.query("SELECT question, "+optionName+" from questions WHERE q_id = '"+q_id+"' ").dictresult()
					thisQuestion = thisQuery[0]["question"]
					thisOptionText = thisQuery[0][optionName]

					thisQuery = advdb.query("SELECT answer, correct, wrong from answers WHERE q_id = '"+q_id+"' and caseNum = '"+caseNum+"' ").dictresult()
					if len(thisQuery) == 0:
						print 'This question '+q_id+' for case num '+case_num+' needs to be answered yet<BR>'
						thisAnswer = "NA"
					
						thisAnswer = thisQuery[0]["answer"]
						thisCorrect = thisQuery[0]["correct"]
						thisWrong = thisQuery[0]["wrong"]
					else:
						thisAnswer = thisQuery[0]["answer"]
						thisCorrect = thisQuery[0]["correct"]
						thisWrong = thisQuery[0]["wrong"]				
			
				if thisAnswer == "NA":
					print " "
				else:
					if len(q_id) > 5: # We have a custom question
						thisAnswerText = advdb.query("SELECT option"+thisAnswer+" from questions_custom WHERE validTime = '"+q_id+"' and className = '"+className+"' ").getresult()[0][0]

					else:
						thisAnswerText = advdb.query("SELECT option"+thisAnswer+" from questions WHERE q_id = '"+q_id+"' ").getresult()[0][0]

					if string.lower(thisAnswer) == string.lower(this_option): 	# Take care of sloppy db entry routines :)
						print "<H3>You answered Correctly:</H3>"
						print "<P><B><i>You were asked =></i></b> "+thisQuestion
						print "<P><B><i>You responded =></i></b> "+string.upper(this_option)+". "+thisOptionText
						print "<P><B><i>The Correct answer was =></i></b> "+thisAnswer+". "+thisAnswerText
						print "<P><B><i>The instructor's response =></i></b>" +thisCorrect
						bonus_pts = bonus_pts + 10
					else:
						print "<H3>You answered Incorrectly:</H3>"
						print "<P><B><i>You were asked =></i></b> "+thisQuestion
						print "<P><B><i>You responded =></i></b> "+string.upper(this_option)+". "+thisOptionText
						print "<P><B><i>The Correct answer was =></i></b> "+thisAnswer+". "+thisAnswerText
						print "<P><B><i>The instructor's response =></i></b>" +thisWrong
				
				enter_text(userKey, this_option, thisAnswer, q_id, bonus_pts, thisQuestion )
				print "<HR>"
					

	functs.updateUser(userKey, "gradeTime", lastTime)
	
	functs.updateUser(userKey, "bonuspoints", bonus_pts)

	
	if (pause_page):
		print '<P align="right"><a href="/cgi-bin/severe2/advanced/hour.py?userKey='+userKey+'">'
		print '<img src="/gen/button.php?label=Click%20To%20Continue&font_size=30" BORDER="0"></a>'
		SEVERE2.finishPage("advanced")
		sys.exit(0)

	print '<CENTER>'
	print '<P><a href="/cgi-bin/severe2/advanced/hour.py?userKey='+userKey+'">'
	print '<img src="/gen/button.php?label=Click%20To%20Continue&font_size=30" BORDER="0"></a>'
	print '</CENTER>'

	if caseNum[0] == 'w':
		SEVERE2.makeData(lastTime, userKey, caseNum, 3)
	else:
		SEVERE2.makeData(lastTime, userKey, caseNum, 1)

	SEVERE2.finishPage("advanced")
Пример #13
0
def finishPage():
    SEVERE2.finishPage("intermediate")