예제 #1
0
파일: hour.py 프로젝트: akrherz/pals
def Main():
	form = cgi.FormContent()
	userKey, lastTime, gradeTime, startTime, noonTime, endTime, caseNum = functs.retreiveUser()

	if (mx.DateTime.ISO.ParseDateTimeGMT(lastTime) >= mx.DateTime.ISO.ParseDateTimeGMT(endTime)):
		results.Main()

	functs.setupPage()
	functs.printTime(lastTime)
	functs.makeHelp()
	
	# Check first if we have a question to display
	if (mx.DateTime.ISO.ParseDateTimeGMT(lastTime) > mx.DateTime.ISO.ParseDateTimeGMT(gradeTime)):
		question.Main(lastTime, userKey, caseNum, startTime)
	if (mx.DateTime.ISO.ParseDateTimeGMT(lastTime) == noonTime and not form.has_key("noon")):
		noon.Main(userKey, caseNum)
		
	
	print """<font color="#a0522d">
	<BLOCKQUOTE><P><FONT FACE="Britannic Bold">Check it out!</FONT> Click under the column titled 
	<FONT COLOR="#b0020f">Current,</FONT> and find out what is happening around the country at this hour. 
	<FONT COLOR="#b0020f" SIZE="+1">Hint</FONT>: If you need help understanding the charts, please review our help topics.</P></BLOCKQUOTE>	
	</font>	
	"""

	functs.dbComments(lastTime, "comments", "Hourly Notes:")
	
	if caseNum[0] == 'w':
		SEVERE2.makeData(lastTime, userKey, caseNum, 3)
	else:
		SEVERE2.makeData(lastTime, userKey, caseNum, 1)
		
	
	if (mx.DateTime.ISO.ParseDateTimeGMT(lastTime) > noonTime):
		functs.dbComments(lastTime, "analysis", "Analysis:")
	
	if caseNum[0] == 's' and (mx.DateTime.ISO.ParseDateTimeGMT(lastTime) > noonTime) :
		nextTime = mx.DateTime.ISO.ParseDateTimeGMT(lastTime) + mx.DateTime.RelativeDateTime(hours=+2)	
	elif caseNum[0] == 's':
		nextTime = mx.DateTime.ISO.ParseDateTimeGMT(lastTime) + mx.DateTime.RelativeDateTime(hours=+1)	
	else:
		nextTime = mx.DateTime.ISO.ParseDateTimeGMT(lastTime) + mx.DateTime.RelativeDateTime(hours=+3)
		
	functs.updateUser(userKey, "lasttime", nextTime)

	navigation(userKey)
	
	functs.finishPage()
예제 #2
0
파일: sxpage.py 프로젝트: akrherz/pals
def Main():
	form = cgi.FormContent()
	try:
		year = int(form["year"][0])
		day = int(form["day"][0])
		month = int(form["month"][0])
		ztime = int(form["ztime"][0])
		version = form["version"][0]
		zswitch = form["zswitch"][0]
	except:
		style.SendError("Bzz, give me a date please...")

	myDate = DateTime.mktime(year, month, day, ztime, 0, 0, '','','0')
	secs = myDate.ticks()
	time_tuple = myDate.tuple()
	myDateStr = DateTime.ISO.strGMT(myDate)

	SEVERE2.setupPage()
        SEVERE2.printTime(myDateStr)

	dir_format = myDate.strftime("/archivewx/data/%Y_%m_%d/")
	print '<BASE HREF="http://www.pals.iastate.edu'+dir_format+'">'

	if version == "basic":
	        functs.dbComments(myDateStr, "comments", "News and Notes:", zswitch)
	else:
	        functs.db_comments_417(secs, time_tuple, "comments", "News and Notes:", "mt417")


        functs.mk_data(time_tuple, 1)

	if version == "basic":
	        functs.dbComments(myDateStr, "analysis", "Meteorological Analysis:", zswitch)
	else:
	        functs.db_comments_417(secs, time_tuple, "analysis", "Meteorological Analysis:", "mt417")
	

	functs.finishPage()