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 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(): 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 = 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(): 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(): 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 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(): 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(): 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(): html_setup() form = FormContent() opt = "daily" if form.has_key("opt"): opt = form["opt"][0] if opt == 'daily': make_daily() if opt == 'monthly': make_monthly() if opt == 'yearly': make_yearly() if opt == 'allstations_daily': make_allstations_daily() if opt == 'graph_yearly': make_graph_yearly() if opt == 'graph_multiyear': make_graph_multiyear() else: print '<TD>' print '</TD>' print '<TR><Td colspan="2">' print '<B>DISCLAIMER:</B> <BR>\ While we use care to provide accurate weather/climatic information, errors \ may occur because of equipment or other failure. We therefore provide this \ information without any warranty of accuracy. Users of this weather/climate \ data do so at their own risk, and are advised to use independent judgement \ as to whether to verify the data presented.' style.std_bot() print '</tD>' print '</form></TR></TABLE>'
def Main(): html_setup() form = FormContent() opt = "daily" if form.has_key("opt"): opt = form["opt"][0] if opt == 'daily': make_daily() if opt == 'monthly': make_monthly() if opt == 'yearly': make_yearly() if opt == 'allstations_daily': make_allstations_daily() if opt == 'graph_yearly': make_graph_yearly() else: print '<TD>' print '</TD>' print '<TR><TD colspan="2">' print '<P>PALS does not and will not claim the data presented on-line to be accurate or complete.' print '<BR>This data should be used with caution.' style.std_bot() print '</td>' print '</form></TR></TABLE>'
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("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(): setup_html() print '<tr><td bgcolor="#EEEEEE" valign="top">' options() print '</td><td align="top">' results() print '</td></tr>' print '<tr><td colspan="2">' style.std_bot() print '</td></tr></table>'
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(): 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(): 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(): form = FormContent() date = form["date"][0] if not form.has_key("date"): style.SendError("CGI ERROR") style.header(date+' Weather','/images/ISU_bkgrnd.gif') style.std_top("U. S. Weather Observations on "+date) intro(date) lister(date) ready(date) style.std_bot()
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]["question"] optiona = quest[0]["optiona"] optionb = quest[0]["optionb"] optionc = quest[0]["optionc"] optiond = quest[0]["optiond"] optione = quest[0]["optione"] optionf = quest[0]["optionf"] optiong = quest[0]["optiong"] optionh = quest[0]["optionh"] ans, cor_comments, wro_comments = get_old_answer(caseNum, question_num) print '<form method="POST" action="change.py">' print '<input type="hidden" value="'+question_num+'" name="question_num">' print '<input type="hidden" value="'+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) print '</SELECT>' print '<BR><B>Input the correct comments</B>' print '<textarea name="cor_comments" cols="70" rows="10" WRAP>'+cor_comments+'</textarea>' print '<BR><B>Input the wrong comments</B>' print '<textarea name="wro_comments" cols="70" rows="10" WRAP>'+wro_comments+'</textarea>' print '<BR><BR>' print '<input type="submit" value="SUBMIT ANSWER">' print '</form>' style.std_bot()
def Main(): form = cgi.FormContent() class_name = form['class'][0] if valid_time(): style.header("Forecasting excercise", "white") mk_forecast.Main(class_name) else: style.SendError("You can not forecast at this time, sorry..") style.std_bot()
def Main(): day = determine_day() style.header('Access for '+day+' weather data','white') style.std_top('Access '+day ) print '<BR><TABLE><TR><TH align="right">' print 'Enter the password</TH>' print '<form method="post" action="adm/display.py">' print '<TD><input type="password" name="pass"></TD>' print '<input type="hidden" name="day" value="'+day+'">' print '</tr><tr><th colspan="2">' print '<input type="submit" value="Submit Request">' print '</form></td></tr></table>' style.std_bot()
def Main(): style.header("Keywords for Database","white") style.std_top("COMET Keyword Searches") print '<form method="post" action="http://www.pals.iastate.edu/cgi-bin/C2W/search.py">' words() print '<HR>' dirs() print '<HR>' fields() print '<HR>' print '<center><input type="submit" value="Search for keyword">' print '</form>' style.std_bot()
def Main(): city, year, loop = content() # Returns forms values # City => 3 or 4 digit station code # year => 4 digit string for year # loop => an interger count variable style.header("Historical Iowa WX Data", "white") # Set up HTML page for apache city_name = functs.convert_station(city) # Convert code into string name of city im = [] # Needs an array to set up all the picts dirname = tempfile.mktemp() # Create a directory name via tempfile module dirname = dirname[-5:-2] + dirname[-1:] # I only want intergers in the name while (os.path.isdir(base_fref+dirname) ): dirname = tempfile.mktemp() # Create a directory name via tempfile module dirname = dirname[-5:-2] + dirname[-1:] os.mkdir(base_fref+dirname, 0777) # Create a directory over in HTML side for i in range(int(loop)): # Create int(loop) number of gif images im.append(image(city_name, year)) # Create an image instance to be modified results = query_station(city, year) # Query database system for results if len(results) == 0: # If no results are found, quit the loop break highs, lows = parse_data(results) # Parse out the results into two tuples red = im[i].colorAllocate((255,0,0)) # Allocate needed colors for lines on graph blue = im[i].colorAllocate((0,0,255)) im[i].lines(highs, red) # High values put on graph in red im[i].lines(lows, blue) # Low values put on graph in blue im[i].writeGif(base_fref+dirname+"/const"+str(i)+".gif") # Create gif graph year = str(int(year)+ 1) # increment year value by one if loop > 0: # If a loop was needed, then we need to animate it gif_file = make_animate(dirname) # based on the assumption that all gifs are in one dir else: gif_file = base_href+dirname+"/const0.gif" # Otherwise only one gif exists so that is where # It is at html_gif(gif_file) # Create the HTML neccessary to view the finished product style.std_bot() # Finish and exit...
def Main(): form = FormContent() day = form["day"][0] passwd = form["pass"][0] checker(passwd) style.header('Data for '+day, 'white') style.std_top('Data for '+day) files = posix.listdir(data_src+day+'/data/') print '<multicol cols="3">' for file in files: print '<a href="'+url_ref+day+'/data/'+file+'">' print file+'</a><BR>' print '</multicol>' style.std_bot()
def Main(): style.header("Edit Carlson Picts","white") print '<H3> Select a file to edit info for: </H3>' print '<FORM method="POST" action="edit.py">' listFiles() print '<input type="SUBMIT" value="Edit">' print '</form></body></html>' style.std_bot()
def Main(): form = FormContent() if not form.has_key("link"): style.SendError("Enter a Link") mylink = form["link"][0] mylink = regsub.gsub("'","´",mylink) if not form.has_key("URL"): style.SendError("Enter an URL") myURL = form["URL"][0] if not form.has_key("description"): style.SendError("What is it's description") mydescription = form["description"][0] mydescription = regsub.gsub("'","´",mydescription) style.header('Links Submitter','/images/ISU_bkgrnd.gif') mykindA = "null" mykindB = "null" mykindC = "null" mykindD = "null" if form.has_key("kindA"): mykindA = form["kindA"][0] if form.has_key("kindB"): mykindB = form["kindB"][0] if form.has_key("kindC"): mykindC = form["kindC"][0] if form.has_key("kindD"): mykindD = form["kindD"][0] mytime = os.popen('date', 'r').read() search = mydbase.query("select * from linkex where url = '"+myURL+"'") search = search.getresult() if len(search) > 0: style.std_top("URL already taken") sys.exit(0) search2 = mydbase.query("select * from linkex where link = '"+mylink+"'") search2 = search2.getresult() if len(search2) > 0: style.std_top("Link title aready taken") sys.exit(0) enter = mydbase.query("INSERT INTO linkex VALUES( ' " + mylink+"','"+myURL+"','"+mykindA+"','"+mykindB+"','"+mykindC+"','"+mykindD+"','"+mydescription+"', '"+mytime+"')") style.std_top('Your link to "'+mylink+'" was saved!') print '<br><P>You can now:<ul>' print '<li><a href="http://www.pals.iastate.edu/cgi-bin/daryl_dev/printout.py">View all the links</a>' print '<li><a href="http://www.pals.iastate.edu/index.html">Go back to PALS Homepage</a>' print '<spacer type="vertical" size="300">' style.std_bot()
def Main(): form = FormContent() letter = "null" if form.has_key("letter"): letter = form["letter"][0] setup_html() print '<tr align="top"><td valign="top" bgcolor="#EEEEEE">' letters_dir() print '</td><td>' print '<form method="post" action="http://www.pals.iastate.edu/cgi-bin/C2W/search.py">' words_dir(letter) print '</td></tr>' print '<tr><td colspan="2">' style.std_bot() print '</td></tr></form></TABLE>'
def Main(): form = FormContent() if not form.has_key("string"): style.SendError("You did not input a search string") if not form.has_key("field"): style.SendError("no search field found") mystring = form["string"][0] field = form["field"][0] filename = form["filename"][0] style.header("C2W Search Results","white") style.std_top('Results of your search for "'+mystring+'"') 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">Access Saved Search</a>' c2w.old_search(mystring,field,filename) style.std_bot()
def Main(): style.header("Add a case to the system", "white") form = cgi.FormContent() caseType = form["caseType"][0] style.std_top("Add a case to the system") print '<form method="POST" action="addDay.py">' print '<input type="hidden" name="caseType" value="'+caseType+'">' print '<H3>Fill out the Form to add a case to the system:</H3>' print '<TABLE width="500">' print '<TR><TH></TH><TH>Year (4 digits):</TH><TH>Month:</TH><TH>Day:</TH><TH>Ztime:</TH></TR>' print '<TR><TH>Start At:</TH>' print '<TH><input type="text" MAXLENGTH="4" SIZE="5" name="start_yeer" value="20"></TH>' print '<TH>' months("start_month") print '</TH>' print '<TH><input type="text" name="start_day" maxlength="2" size="2"></TH>' print '<TH>' if caseType == "w": win_times("start_ztime") else: sum_times("start_ztime") print '</TH></TR>' print '<TR><TH>End At:</TH>' print '<TH><input type="text" MAXLENGTH="4" SIZE="5" name="end_yeer" value="20"></TH>' print '<TH>' months("end_month") print '</TH>' print '<TH><input type="text" name="end_day" maxlength="2" size="2"></TH>' print '<TH>' if caseType == "w": win_times("end_ztime") else: sum_times("end_ztime") print '</TH></TR></TABLE>' print '<input type="SUBMIT">' print '<input type="RESET">' print '</form>' style.std_bot()