def Main(): form = cgi.FormContent() try: secs = form["secs"][0] except: secs = "nill" style.header("Data Viewer","white") files = os.listdir(DATA_DIR) files.sort() print '<TABLE><TR><TD>' print '<H3>Pick Day:</H3>' print '<form method="POST" action="browser.py">' print '<SELECT name="secs" size="20">' for file in files: mkoption(file) print '</SELECT><BR>' print '<input type="SUBMIT">' print '</form></TD>' print '<TD>' if secs != "nill": mkdata(secs) print '</TD>' print '</TR></TABLE>' print '<a href="/admin">Admin Page</a>'
def Main(): form = FormContent() if not form.has_key("string"): style.SendError("search string not found") if not form.has_key("field"): style.SendError("field not found") if not form.has_key("filename"): style.SendError("CGI ERROR") if not form.has_key("total"): style.SendError("CGI ERROR") string = form["string"][0] field = form["field"][0] filename = form["filename"][0] total = form["total"][0] style.header("Save your search results","/images/ISU_bkgrnd.gif") style.std_top("Save your search for "+string) print '<P><H3>Enter a username and title for your search</H3>' print '<BR CLEAR="all">\n' print '<FORM METHOD=POST action="http://www.pals.iastate.edu/cgi-bin/C2W/submit.py">\n' print '<table>\n<tr>\n' print '<th align=right>Enter a Username:'******'<td>\n' print '<INPUT TYPE=text name="user">\n' print '<tr>\n<th align=right>Title of your search:' print '<td>\n' print '<INPUT TYPE=text name="title">\n' 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 '<input type=hidden name="total" value="'+total+'">' print '<tr>\n<th colspan="2" align=center>\n' print '<INPUT TYPE=submit value="Submit">\n' print '</FORM>\n' print '</table><BR><BR>' style.std_bot()
def Main(): form = cgi.FormContent() style.header("Edit Hourly Reports","white") style.std_top("Edit Hourly Reports") print '<B>Information:</B> <dd>This is the date and time selection page for the Severe Forecasting Excercise.</dd><BR>' print '<B>Instruction:</B> <dd>Select the desired day and time and then click on "submit."</dd><BR>' print '<B>Scope of this program:</B> <dd>This set of programs modifies ALL of the hourly annotations available to ALL excercises.</dd><BR>' print '<B>NOTE:</b><dd>If you are wanting to edit the preview for a case, you will want to edit the first hour that the exercise runs for.</dd>' print '<HR>' 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">' listHours( form["caseNum"][0] ) else: print '<form method="post" action="hourly.py">' listCases() print '<input type="submit" value="submit">' print '<HR>Links outta here:<HR>' print '<BR><a href="/admin">Admin Page</a>'
def Main(): style.header("Edit Annotation","white") form = cgi.FormContent() try: caseNum = form["caseNum"][0] className = form["className"][0] except: style.SendError("CGI Parse Error") entry = get_entry(caseNum, className) try: comment = entry[0][0] except IndexError: comment = "Write Something here" style.std_top('Edit entry for '+caseNum) print '<HR>' print '<a href="index.py?className='+className+'">Select a different Case</a><BR>' print '<form method="post" action="change.py">' print '<input type="hidden" name="className" value="'+className+'">' print '<input type="hidden" name="caseNum" value="'+str(caseNum)+'">' adds(comment) print '<input type="submit" value="Click to Save this Entry">' print '</form>' style.std_bot()
def Main(): form = FormContent() if not form.has_key("url"): style.SendError("CGI ERROR") url = form["url"][0] style.header("Save Location","white") style.std_top("Save the file location") 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>' mytime = os.popen('date', 'r').read() print '<form method=POST action="http://www.pals.iastate.edu/cgi-bin/C2W/prevsub.py">' print '<input type="hidden" name="url" value="'+url+'">' print '<table>' print '<tr>' print '<th align="right">Enter your username' print '<td><input type="text" name="user">' print '<tr>' print '<th align="right">Name the file for future reference:' print '<td><input type="text" name="title">' print '<tr>' print '<th align="right">' print '<td><input type="hidden" value="'+mytime+'" name="mytime">' print '<tr>' print '<th colspan=2 align="center">' print '<input type="submit" value="Submit">' print '</form>' print '</table>\n' style.std_bot()
def Main(): checker() style.header("Your Score","/images/ISU_bkgrnd.gif") style.std_top("Your Sample Forecast Score") score = get_score() body(score) style.std_bot()
def Main(): style.header("Forecasting Results","white") form = cgi.FormContent() class_name = form["class_name"][0] yeer = form["yeer"][0] month = form["month"][0] day = form["day"][0] print '<H3>'+class_name+' : Forecasting Results</H3>' print '<BR>Year: '+yeer+'<BR>' print 'Month: '+month+'<BR>' print 'Day: '+day+'<BR>' entries = mydb.query("SELECT * from grades WHERE yeer = '"+yeer+"' and month = '"+month+"' and day = '"+day+"' and userid ~* '"+class_name+"' or userid = 'mos' ").getresult() entries = mysort(entries, -1) print '<TABLE><TR>' print '<TH>USERID</TH><TH>DM H:</TH><TH>DM L:</TH><TH>DM P:</TH><TH>DM S:</TH><TH>FL H:</TH><TH>FL L:</TH><TH>FL P:</TH><TH>FL S:</TH><TH>TOT:</TH></TR>' spacer = " " for i in range(len(entries)): print '<TR><TD>' this_entry = entries[i] print this_entry[0] +"</TD>" for j in range(len(this_entry)): thi = this_entry[j] entry = str(thi) if entry[0] == "m" or j == 1 or j == 2 or j == 3: doy = "nothing" else: print '<TD align="center">'+entry+'</TD>', print '</TR>' print '</TABLE>'
def svrTop(secs_tuple, secs = 0): if secs != 0: if secs_tuple[-1] == 1: secs = int(secs) - 5*3600 else: secs = int(secs) - 6*3600 now_tuple = time.localtime( secs ) date_str = time.strftime("%B %d, %Y", now_tuple) time_str = time.strftime("%I:%M %p [%Z]", now_tuple)+' ( '+str(secs_tuple[3])+' Z )' else: date_str = "Welcome!!" time_str = "" style.header("Severe Weather Forecasting Exercise", "white") print """ <TABLE width="100%"> <TR> <TD> <img src="/icons/svrTop.gif"> </TD> <TD> <TABLE width="100%"> <TR><TD background="/icons/sidebg.gif" align="CENTER" NOWRAP> <font size="+3" color="white">Current Date & Time:</font> </TD></TR> <TR><TD bgcolor="white" align="CENTER" NOWRAP> """ print '<font color="blue" size="+2">'+date_str+'</font><BR>' print '<font color="red" size="+2">'+time_str+'</font>' print """
def Main(): style.header("Restrict / Allow Access to C2W","white") form = FormContent() if form.has_key('cwd'): cwd = form["cwd"][0] rtotal = int(form["rtotal"][0]) utotal = int(form["utotal"][0]) for i in range(rtotal + 1): i = str(i) if form["rfile"+i][0] == "n": change_to_u(form["rfile"+i+"name"][0]) for j in range(utotal + 1): j = str(j) if utotal == "0": break if form["ufile"+j][0] == "y": change_to_r(form["ufile"+j+"name"][0]) if form.has_key('dir'): print '<form method="POST" action="restrict.py">' dir_loader(form["dir"][0]) print '<BR clear="all"><HR><HR>' print '<input type="submit" value="Make Changes">' print '<input type="reset">' print '</form>' else: make_dirs()
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)
def Main(): style.header('Edit COMET keywords',"white") print '<H2 align="center">COMET Keywords editor</H2>' form = FormContent() if form.has_key("option"): option = form["option"][0] if option == "delete": delete_word(form["keyword"][0]) actions("Deleted keyword '"+form["keyword"][0]+"'") words() if option == "change": delete_word(form["keyword"][0]) changer(form["keyword"][0]) if option == "change2": insert(form["keyword"][0]) actions("Inserted keyword '"+form["keyword"][0]+"'") words() if option == "add": changer("Enter Word Here") else: actions("Nothing done") words() style.std_bot()
def Main(): form = cgi.FormContent() file = form["file"][0] style.header(file, "white") print '<P align="right">' print '<a href="#" onClick="top.close();return false;"><img src="/gen/header.php?label=Close%20Window&font_size=20" border="0"></a>' test = os.path.split(file) if test[1][:3] == "dew": print '<H3 align="center">Dew Point Chart</H3>' print '<a href="/archivewx/help/dewp.html">Click for help with this Map</a><BR><BR>' elif test[1][:3] == "sfc": print '<H3 align="center">Surface Chart</H3>' print '<a href="/archivewx/help/sfcmap.html">Click for help with this Map</a><BR><BR>' elif test[1][:4] == "temp": print '<H3 align="center">Surface Temperature Chart</H3>' print '<a href="/archivewx/help/temp.html">Click for help with this Map</a><BR><BR>' elif test[1][:3] == "NAT": print '<H3 align="center">National Radar</H3>' print '<a href="/archivewx/help/radar.html">Click for help with this Map</a><BR><BR>' print '<BR><IMG SRC="'+file+'">' print '<BR><P align="right">' print '<a href="#" onClick="top.close();return false;"><img src="/gen/header.php?label=Close%20Window&font_size=20" border="0"></a>' style.std_bot()
def Main(): style.header("Edit Specific Questions", "white") print '<H2 align="center">Editing and Adding questions to Basic excercise</H2>' print '<B>Info:</B><HR>' print 'This program creates specific questions for the Basic forecasting exercise.' 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.listAllCases() 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="/admin">Admin page</a>'
def Main(): form = cgi.FormContent() file = form["file"][0] style.header(file, "white") test = os.path.split(file) if test[1][:3] == "dew": print '<H3 align="center">Dew Point Chart</H3>' print '<a href="/archivewx/help/dewp.html">Click for help with this Map</a><BR><BR>' elif test[1][:3] == "sfc": print '<H3 align="center">Surface Chart</H3>' print '<a href="/archivewx/help/sfcmap.html">Click for help with this Map</a><BR><BR>' elif test[1][:4] == "temp": print '<H3 align="center">Surface Temperature Chart</H3>' print '<a href="/archivewx/help/temp.html">Click for help with this Map</a><BR><BR>' elif test[1][:3] == "NAT": print '<H3 align="center">National Radar</H3>' print '<a href="/archivewx/help/radar.html">Click for help with this Map</a><BR><BR>' print '<a href="javascript:history.go(-1)">Go Back..</a><BR><BR>' print '<IMG SRC="'+file+'">' style.std_bot()
def setup_html(): style.header("Archived Weather Data Search","white") print '<table border="0" cellspacing="0" rowspacing="0" width="600">' print '<tr><td width="150"></td><td width="450"></td></tr>' print '<tr><td bgcolor="#00fcf8" colspan="2">' print '<img src="/images/pals_logo.gif" align="left"><spacer type="vertical" size="30">' print '<H1>Archive Weather Data Search</H1></td></tr>'
def Main(): form = cgi.FormContent() try: email = form["email"][0] full_name = form["full_name"][0] passwd1 = form["passwd1"][0] passwd2 = form["passwd2"][0] class_name = form["class_name"][0] except: style.SendError("CGI Parse Error") if passwd1 != passwd2: style.SendError("Your passwd is not valid, Try again.") email = re.split("@", email) userid = class_name+"_"+email[0] users = mydb.query("SELECT * from users WHERE userid = '"+userid+"' ").getresult() if len(users) > 0: style.SendError("Your username is allready taken") entre = mydb.query("INSERT into users values ('"+userid+"', '"+full_name+"', '"+passwd1+"' ) ") style.header("Username Results.", "white") print full_name +'<BR><BR>' print 'You have been assigned this userid : '+userid+' <BR><BR>' print 'You have been assigned this password : '******' <BR><BR>' print '<P>You now have an account with the forecasting system, you are free to make forecasts. Just remember your password :) ' print '<BR><a href="/frcst/"> Go back to the Forecasting main page</a><BR>'
def Main(): form = FormContent() year = form["year"][0] month = form["month"][0] str_month = convert_month("0"+month) day = form["day"][0] city = form["city"][0] station = convert_station(city) style.header("IOWAWX Query results","white") style.std_top("Data for "+station+" on "+str_month+" "+day+" "+year+".") date = str_month+" "+day+", "+year high, low, rain, snow = query_db(city, year, month, day) sun_type = sun(int(high), int(low)) high, low, rain, snow = chk_data(high, low, rain, snow) table_header() result_table(date, sun_type, str(high), str(low), str(rain), str(snow)) print '</TABLE>' print high, low, rain, snow, sun_type
def Main(): form = FormContent() if not form.has_key("user"): style.SendError("You did not input a user name") if not form.has_key("title"): style.SendError("no search title") user = form["user"][0] title = form["title"][0] url = form["url"][0] mytime = form["mytime"][0] style.header("Saved Search","/images/ISU_bkgrnd.gif") insert = mydbase.query("INSERT INTO saved VALUES ('" + user + "', '" + url + "','" + title + "', '" + mytime + "')") style.std_top('Your title: '+title+' has been saved') print '<P>\nYour title can now be accessed by going to <a href="http://www.pals.iastate.edu/cgi-bin/C2W/places.py?user='******'">' print "Here</a>\n<BR>" print '<BR>\n<BR>\n<HR>\n' print 'Write down your username and title of your search for future reference.<BR>' print '<B>Username =></B>' print user print "<BR>" print '<B>File Title =></B>' print title print "<BR><BR>" style.std_bot()
def Main(): style.header("Choose time and question to edit", "white") form = cgi.FormContent() print '<font color="red"><H2>Edit Answer Keys for generic questions</H2></font>' if form.has_key('caseNum'): caseNum = form["caseNum"][0] print '<a href="list.py">Change Current Case</a><BR><BR>' print '<form method="POST" action="list.py" name="switch">' print '</form>' print '<HR><HR>' print '<form method="POST" action="edit.py">' print '<input type="hidden" name="caseNum" value="'+caseNum+'">' print '<H3>Pick Which Question for Case '+caseNum+':</H3>' print_questions(caseNum[0]) else: print '<form method="POST" action="list.py">' print '<H3>Select which case: </H3>' SEVERE2.listAllCases() print '<H3>Submit:</H3>' print '<input type="submit">' print '</form>' print '<BR><BR><a href="/admin">Admin Page</a>'
def SendError(str): errmsg = escape(str) style.header("CGI ERROR","white") style.std_top("CGI ERROR") print "<H3><STRONG>" + errmsg + "</STRONG></H3>\n" style.std_bot() sys.exit(0)
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()
def Main(): style.header("Edit Annotation","white") descrip = get_entry() style.std_top('Edit entry for '+day) adds(descrip) sys.exit(0)
def Main(): style.header("Edit Severe Forecast results","white") style.std_top("Edit answer key for what case??") print '<form method="post" action="edit.py">' print '<BR>' which_days() closing() style.std_bot()
def Main(): style.header("Annotation Editor","white") style.std_top("Edit Entries") options() selections() style.std_bot()
def Main(): form = FormContent() ztime = form["ztime"][0] events = form["events"][0] updates = form["updates"][0] update = mydb.query("INSERT into jun181998 VALUES('" + ztime + "','" + events + "','" + updates + "')") style.header("Worked", "/images/ISU_bkgrnd.gif") style.std_top("Hello")
def html_setup(): style.header("Historical Iowa Weather Data","white") std_table.blue_top("Historical Iowa Weather Data") std_table.side_setup() options = [('Daily','index.py?opt=daily'),('Monthly','index.py?opt=monthly'),('Yearly','index.py?opt=yearly')] std_table.side_content("One Station Search Options:", options) options = [('Yearly','index.py?opt=graph_yearly')] std_table.side_content("Graphing Options:", options) std_table.side_end()
def Main(): style.header("Edit Hourly Reports","white") style.std_top("Which Day and Hour??") print '<form method="post" action="edit_hourly.py">' which_hours() print '<BR>' which_days() closing() style.std_bot() sys.exit()
def Main(): style.header("Edit Entries","white") entries = get_entry() style.std_top('Edit Results for '+day) current(entries) print '<HR>' new_ones() style.std_bot() sys.exit(0)
def Main(): form = cgi.FormContent() caseNum = form["caseNum"][0] question_num = form["question_num"][0] style.header("Edit answer for Generic Question", "white") quest = get_question(question_num) print '<H3>This is Question number '+question_num+' from caseNum '+caseNum+'</H3>' question = quest[0][1] optiona = quest[0][3] optionb = quest[0][4] optionc = quest[0][5] optiond = quest[0][6] optione = quest[0][7] optionf = quest[0][8] optiong = quest[0][9] optionh = quest[0][10] optionN = quest[0][11] ans, cor_comments, wro_comments = get_old_answer(caseNum, question_num) print '<form method="POST" action="change.py">' print '<input type="hidden" value="'+string.strip(question_num)+'" name="question_num">' print '<input type="hidden" value="'+string.strip(caseNum)+'" name="caseNum">' print '<B>Edit the answer for this question:</B><BR>' print '<dd>'+question+'</dd><BR>' print '<B>Select the correct answer:</B><BR>' print '<SELECT name="answer">' mk_option(ans, "A", optiona) mk_option(ans, "B", optionb) mk_option(ans, "C", optionc) mk_option(ans, "D", optiond) mk_option(ans, "E", optione) mk_option(ans, "F", optionf) mk_option(ans, "G", optiong) mk_option(ans, "H", optionh) mk_option(ans, "N", optionN) print '</SELECT>' print '<BR><B>INPUT THE CORRECT COMMENTS TO APPEAR</B><BR>' print '<textarea name="cor_comments" cols="80" rows="10" WRAP>'+cor_comments+'</textarea>' print '<BR><B>INPUT THE WRONG COMMENTS TO APPEAR</B><BR>' print '<textarea name="wro_comments" cols="80" rows="10" WRAP>'+wro_comments+'</textarea>' print '<BR><BR>' print '<input type="submit" value="SUBMIT ANSWER">' print '</form>' style.std_bot()
def Main(): style.header("New Annotation","white") style.std_top("New One") print '<form method="post" action="add_annote.py">' print '<H3>Enter a day in the form mo.da.year (ex 06.09.1998)</H3>' print '<input type="text" name="day">' print '<H3>Enter description</H3>' print '<textarea name="descrip" cols="90" rows="20"></textarea>' print '<input type="submit" value="New Entry">' print '</form></body></html>' sys.exit(0)
def generate_result(form, user_style=None): """Convert the request to the PTT-style result.""" author = form['author'] date = form['date'] number = form['number'] headline = form['headline'] content = form['content'] if user_style is None: user_style = style.Style() ret = '' ret += style.header(author, number, date, headline) for line in content.split('\n'): if line[:2] == '##': line = user_style.h2(line[2:]) elif line[:1] == '#': line = user_style.h1(line[1:]) ret += line ret += user_style.footer return ret.replace('*[', '\025[')