示例#1
0
文件: places.py 项目: akrherz/pals
def Main(): 
        presults = ""

        form = FormContent()  
	if not form.has_key("user"): style.SendError("Enter an Username")
        user = form["user"][0]
	
	style.header("Your saved file locations","white")
	style.std_top("Titles of saved files")
	print '<a href="http://www.pals.iastate.edu/c2w/adm/search.html">New Search</a>--'
        print '<a href="http://www.pals.iastate.edu/c2w/adm/saves.html">Enter a different username</a>'
        print '<HR>'
        style.table_setter("650","Username:"******"Title:","Date:","Click to view file:")

        lresults = mydbase.query("select * from saved where user = '******'").getresult() 

        if len(lresults) > 0: 
                for i in range(len(lresults)): 
			url = lresults[i][1]
                        mytime = lresults[i][3]
                        title = lresults[i][2]
                        dresults = mydbase.query("select * from movies where url = '" + url + "'") 
                        dresults = dresults.getresult() 
                        filename = dresults[0][1]
			print '<tr>'
                        print '<TD ALIGN="LEFT" VALIGN="CENTER">'+user+'</TD>'
                        print '<TD ALIGN="LEFT" VALIGN="CENTER">'+title+'</TD>'
                        print '<TD ALIGN="LEFT" VALIGN="CENTER">'+mytime[4:10]+mytime[22:27]+'</TD>'
			print '<TD ALIGN="LEFT" VALIGN="CENTER"><a href="http://www.pals.iastate.edu/cgi-bin/C2W/file.py?url='+url+'">'+filename+'</a></TD>'
        else: 
                print "Your username not found" 
        print '</table>\n'
	style.std_bot()
示例#2
0
文件: answers.py 项目: akrherz/pals
def Main():
    style.header("7/18/98 Answers", "/images/ISU_bkgrnd.gif")
    style.std_top("June 18, 1998 Answers")
    style.table_setter("400", "State", "Severe Weather type", "During time period")
    table()
    body()
    sys.exit(0)
示例#3
0
文件: results.py 项目: akrherz/pals
def list_results(results, state, caseNum):
	if caseNum[0] == "s":
 	       style.table_setter("400","State","Severe Weather type","During time period")
	else:
 	       style.table_setter("400","State","Severe Weather type")

        for i in range(len(results)):
                state2 = results[i][0]
                type = results[i][1]
                time = results[i][2]
                if state == state2:
                        print '<tr><td><blink>'+state2+'</blink></td>'
                else:
                        print '<tr><td>'+state2+'</td>'
                if type == "T" and caseNum[0] == "s":
                        print '<td><B>Tornado</B></td>'
                elif type == "H":
                        print '<td>Hail</td>'
                elif type == "R":
                        print '<td>3"+ Rainfall</td>'
                elif type == "T":
                        print '<td>12"+ Snowfall</td>'
                elif type == "S":
                        print '<td>6"+ Snowfall</td>'
                elif type == "F":
                        print '<td>Freezing Rainfall Event</td>'
                elif type == "C":
                        print '<td>Dangerous Wind Chill Event</td>'
		if caseNum[0] == "s":
	                if time == "1":
	                        print '<td>12-3 PM (CDT)</td>'
	                elif time == "2":
	                        print '<td>3-6 PM (CDT)</td>'
	                elif time == "3":
	                        print '<td>6-9 PM (CDT)</td>'
	                elif time == "4":
	                        print '<td>9-Midnight PM (CDT)</td>'
                print '</tr>'
        print '</table>'
示例#4
0
文件: access.py 项目: akrherz/pals
def Main():
	lresults = ""
	form = FormContent() 
        if not form.has_key("user"): style.SendError("You did not input a username")
        user = form["user"][0]

	lresults = mydbase.query("select * from users where user = '******'").getresult()
	if len(lresults) == 0: style.SendError("Username not found")
	if len(lresults) > 0:
		style.header("Previous Searches","/images/ISU_bkgrnd.gif")
		style.std_top("Titles of Saved Searches")
		print '<a href="http://www.pals.iastate.edu/c2w/adm/search.html">New Search</a>--'
	        print '<a href="http://www.pals.iastate.edu/c2w/adm/access.html">Enter a different username</a>'
		print '<HR>'
		style.table_setter('650','Username','You Searched For:','In directories:','Entries Returned:','Click title to view search:')
		for i in range(len(lresults)):
			string = lresults[i][2]
			field = lresults[i][3]
			title = lresults[i][1]
			filename = lresults[i][4]
			total = lresults[i][5]
			print '<tr>'
			print '<form method="POST" action="http://www.pals.iastate.edu/cgi-bin/C2W/search2.py">'
			print '<INPUT TYPE=hidden NAME="string" VALUE="'+string+'">\n'
			print '<input type=hidden name="field" value="'+field+'">\n'
			print '<input type=hidden name="filename" value="'+filename+'">\n'
			print '<TD ALIGN="LEFT" VALIGN="CENTER">'+user+'</TD>'
			print '<TD ALIGN="LEFT" VALIGN="CENTER">'+string+'</TD>'
			if filename == "%": filename = "All Directories"
			print '<TD ALIGN="LEFT" VALIGN="CENTER">'+filename+'</TD>'
			print '<TD ALIGN="CENTER" VALIGN="CENTER">',total,'</TD>'
			print '<TD ALIGN="LEFT" VALIGN="CENTER"><input type=submit value="'+title+'"></TD>'
			print '</form>\n</TR>'
	print '</table>\n'
	print '<BR><BR><BR>'
	style.std_bot()
示例#5
0
文件: results.py 项目: akrherz/pals
def Main():
	form = FormContent()
	if time == "1": realtime = "12-3 PM (CDT)"
	if time == "2": realtime = "3-6 PM (CDT)"
	if time == "3": realtime = "6-9 PM (CDT)"
	if time == "4": realtime = "9-Midnight PM (CDT)"
	tornado = form["T"][0]
	today = form["day"][0]
	realtornado = "No"
	realrain = "No" 
	realhail = "No"
        if tornado == "T": realtornado = "Yes"
	rain = form["R"][0]
	if rain == "R": realrain = "Yes"
        hail = form["H"][0]
	if hail == "H": realhail = "Yes"
	month_name = form["month_name"][0]		

	style.header("Your Score for "+today,"/images/ISU_bkgrnd.gif") 
        print '<center><H1>'+month_name+' '+today[3:5]+', '+today[5:]+' forecast results</H1></center>'

	results = mydbase.query("Select * from "+today+" where state = '"+state+"' AND date = '"+time+"'") 
        results = results.getresult()
	
	statepoint = "-5"
	timepoint = "-5"
	actualtornado = "No"
	actualhail = "No"
	actualrain = "No"
	for i in range(len(results)):
		this = results[i][1]
		that = results[i][0]
		whatnot = results[i][2]
		if this == "T": actualtornado = "Yes"
		if this == "H": actualhail = "Yes"	
		if this == "R": actualrain = "Yes"
		if that == state: statepoint = "10"
		if whatnot == time: timepoint = "10"


	tornpoint = "-5"
	hailpoint = "-5"
	rainpoint = "-5"
	if realtornado == actualtornado: tornpoint = "10"
	if realhail == actualhail: hailpoint = "10"
	if realrain == actualrain: rainpoint = "10"

	print '<table><tr><td>'

	print '<center><H3>Severe Weather Reports:</H3></center>'

	style.table_setter("400","State","Severe Weather type","During time period")
	table(today)

	print '</td><td valign="top">'
	print '<center><H3>Here is a picture of what happened:</H3></center>'
	print '<img src="/archivewx/data_days/'+today+'/map.gif">'
	
	print '<center><H3>Here is a what you predicted:</H3></center>'
	style.table_setter("400"," ","PREDICTED","ACTUAL","POINTS") 
        print '<tr><th>State:</th><td>'
        print state+'</td><td>'+state+'</td><td>'+statepoint+'</td></tr>'
        print '<tr><th>Time:</th><td>'
        print realtime+'</td><td>'+realtime+'</td><td>'+timepoint+'</td></tr>'
        print '<tr><th>Tornado??:</th><td>'
        print realtornado+'</td><td>'+actualtornado+'</td>'
	print '<td>'+tornpoint+'</td></tr>'
        print '<tr><th>Hail??:</th><td>'
        print realhail+'</td><td>'+actualhail+'</td><td>'
	print hailpoint+'</td></tr>'
        print '<tr><th>Rain??:</th><td>'
        print realrain+'</td><td>'+actualrain+'</td><td>'
	print rainpoint+'</td></tr>'
        print '</table>'

	total = int(tornpoint)+int(hailpoint)+int(rainpoint)+int(statepoint)+int(timepoint)

	print '<center><H3>Here is your score:</H3></center>'
	print '<center><H1>',total,'</H1></center>'

	print '</td></tr></table>'
	style.std_bot()