Пример #1
0
def main():
    form = cgi.FieldStorage()
    try:
        fdom0 = form.getfirst("fdom")
        ffield0 = form.getfirst("ffield")
    except:
        print("Hi")

    files = [
        (htmlRoot+fdom0+"_"+ffield0+"_0.gif", "0"),
                        (htmlRoot+fdom0+"_"+ffield0+"_1.gif", "1"),
            (htmlRoot+fdom0+"_"+ffield0+"_2.gif", "2"),
            (htmlRoot+fdom0+"_"+ffield0+"_3.gif", "3"),
            (htmlRoot+fdom0+"_"+ffield0+"_4.gif", "4"),
            (htmlRoot+fdom0+"_"+ffield0+"_5.gif", "5"),
            (htmlRoot+fdom0+"_"+ffield0+"_6.gif", "6"),
            (htmlRoot+fdom0+"_"+ffield0+"_7.gif", "7"),
            (htmlRoot+fdom0+"_"+ffield0+"_8.gif", "8"),
            (htmlRoot+fdom0+"_"+ffield0+"_9.gif", "9"),
             (htmlRoot+fdom0+"_"+ffield0+"_10.gif", "10"),
                        (htmlRoot+fdom0+"_"+ffield0+"_11.gif", "11"),
                        (htmlRoot+fdom0+"_"+ffield0+"_12.gif", "12"),
                        (htmlRoot+fdom0+"_"+ffield0+"_13.gif", "13"),
                        (htmlRoot+fdom0+"_"+ffield0+"_14.gif", "14"),
                        (htmlRoot+fdom0+"_"+ffield0+"_15.gif", "15") ]

    print('Content-type: text/html \n\n')
    print('<HTML><HEAD></HEAD>')

    printHTML.printTop()

    print('first_image = 1;')
    print('last_image = 16;')

    printHTML.printBot()

    goodAnimation = 0

    print('theImages[0] = new Image();')
    print('theImages[0].src = "'+files[0][0]+'";')
    print('imageNum[0] = true;')
    print('myProg[0] = "0";')

    printHTML.printBot15()

    for i in range(1, len(files)):
        print('theImages['+str(i)+'] = new Image();')
        print('theImages['+str(i)+'].src = "'+files[i][0]+'";')
        print('myProg['+str(i)+'] = "'+files[i][1]+'";')

        print('imageNum['+str(i)+'] = true;')
        print('document.animation.src = theImages['+str(i)+'].src;')
        print('document.control_form.frame_nr.value = '+str(i)+';')

    printHTML.printBot2()

    print('SRC="'+files[0][0]+'"')

    printHTML.printBot3()
Пример #2
0
def Main():
    form = cgi.FormContent()
    try:
        mapType = form["mapType"][0]
    except:
        print "Hi"
    try:
        Fhour = form["Fhour"][0]
    except:
        print "Hi"

    files = [(htmlRoot + Fhour + "/" + mapType + "F00.gif", "F00"),
             (htmlRoot + Fhour + "/" + mapType + "F03.gif", "F03"),
             (htmlRoot + Fhour + "/" + mapType + "F06.gif", "F06"),
             (htmlRoot + Fhour + "/" + mapType + "F09.gif", "F09"),
             (htmlRoot + Fhour + "/" + mapType + "F12.gif", "F12"),
             (htmlRoot + Fhour + "/" + mapType + "F15.gif", "F15"),
             (htmlRoot + Fhour + "/" + mapType + "F18.gif", "F18"),
             (htmlRoot + Fhour + "/" + mapType + "F21.gif", "F21"),
             (htmlRoot + Fhour + "/" + mapType + "F24.gif", "F24"),
             (htmlRoot + Fhour + "/" + mapType + "F27.gif", "F27"),
             (htmlRoot + Fhour + "/" + mapType + "F30.gif", "F30"),
             (htmlRoot + Fhour + "/" + mapType + "F33.gif", "F33"),
             (htmlRoot + Fhour + "/" + mapType + "F36.gif", "F36"),
             (htmlRoot + Fhour + "/" + mapType + "F39.gif", "F39"),
             (htmlRoot + Fhour + "/" + mapType + "F42.gif", "F42"),
             (htmlRoot + Fhour + "/" + mapType + "F45.gif", "F45"),
             (htmlRoot + Fhour + "/" + mapType + "F48.gif", "F48")]

    print 'Content-type: text/html \n\n'
    print '<HTML><HEAD></HEAD>'

    printHTML.printTop()

    print 'first_image = 1;'
    print 'last_image = 17;'

    printHTML.printBot()

    goodAnimation = 0

    print 'theImages[0] = new Image();'
    print 'theImages[0].src = "' + files[0][0] + '";'
    print 'imageNum[0] = true;'
    print 'myProg[0] = "F00";'

    printHTML.printBot15()

    for i in range(1, len(files)):
        print 'theImages[' + str(i) + '] = new Image();'
        print 'theImages[' + str(i) + '].src = "' + files[i][0] + '";'
        print 'myProg[' + str(i) + '] = "' + files[i][1] + '";'

        print 'imageNum[' + str(i) + '] = true;'
        print 'document.animation.src = theImages[' + str(i) + '].src;'
        print 'document.control_form.frame_nr.value = ' + str(i) + ';'

    printHTML.printBot2()

    print 'SRC="' + files[0][0] + '"'

    printHTML.printBot3()
Пример #3
0
def Main():
	print 'Content-type: text/html \n\n'

	form = cgi.FormContent()
	mySite = form["site"][0]
	myTimes = []

	if form.has_key("all"): # Lets loop it all baby
		myCase = form["all"][0]
		rs = mydb.query("SELECT starttime, stoptime from radardata WHERE caseid = "+myCase+" ").dictresult()

	        startDate = DateTime.ISO.ParseDateTimeGMT(rs[0]["starttime"])
	        endDate = DateTime.ISO.ParseDateTimeGMT(rs[0]["stoptime"])
	        startSecs = startDate.gmticks()
	        endSecs = endDate.gmticks()

	        now = startSecs
	
	        while ( now <= endSecs ):
	                thisTuple = time.gmtime(now)
	                timeString = time.strftime("%y%m%d%H%M", thisTuple)
			myTimes.append( timeString )
	                now = now + 5*60

	elif form.has_key("start"):
		loopLength = form["steps"][0]
		startTime  = form["start"][0]  
		thisTime = startTime
		for i in range( int(loopLength) ):
			thisGoodTime = time.mktime( time.strptime(thisTime, "%y%m%d%H%M") ) + i*300
			myTupleTime  = time.localtime( thisGoodTime )
			timeString = time.strftime("%y%m%d%H%M", myTupleTime)
                        myTimes.append( timeString )

	else:
		myTimes = form["timeStamp"]
		myTimes.sort()

	siteDir = mySite
	if form.has_key("blind"):
		siteDir = mySite+"b"

#	print myTimes

	myYear = myTimes[0][:2]
	myMonth = myTimes[0][2:4]
	myDay = myTimes[0][4:6]

	if myYear[0] == "9":
		myYear = "19"+myYear
	else:
		myYear = "20"+myYear

        webRoot = 'http://www.pals.iastate.edu/archivewx/data/'+myYear+'_'+myMonth+'_'+myDay+'/'+siteDir+'/'
        htmlRoot = '/home/httpd/html/archivewx/data/'+myYear+'_'+myMonth+'_'+myDay+'/'+siteDir+'/'

	goodFiles = []
	outputText = ""
	for myTime in myTimes:
		fileRef = htmlRoot+mySite+str(myTime)+".gif"
		#print fileRef
                if os.path.isfile(fileRef):
			goodFiles.append( myTime )
                        outputText = outputText +'<font color="green">'+fileRef+'</font><BR>'
                else:
                        outputText = outputText +'<font color="red">'+fileRef+'</font><BR>'


	myTimes = goodFiles


	printHTML.setupHTML()

	print '<BASE HREF="'+webRoot+'">'	


	printHTML.printTop()


        print 'first_image = 1;'
        print 'last_image = '+str( len(myTimes) )+';'
        print 'animation_height = 540;'
        print 'animation_width = 720;'

        printHTML.printBot()

        goodAnimation = 0

        print 'theImages[0] = new Image();'
        print 'theImages[0].src = "'+mySite+str( myTimes[0] )+'.gif";'
        print 'imageNum[0] = true;'


        printHTML.printBot15()

	i = -1
        for myTime in myTimes:
		i = i+1                
                print 'theImages['+str(i)+'] = new Image();'
                print 'theImages['+str(i)+'].src = "'+mySite+str( myTime )+'.gif";'
                
                print 'imageNum['+str(i)+'] = true;'
                print 'document.animation.src = theImages['+str(i)+'].src;'
                print 'document.control_form.frame_nr.value = '+str(i)+';'


        printHTML.printBot2()

	print 'SRC="'+mySite+str( myTimes[0] )+'.gif"'

        printHTML.printBot3()


	print '<BR><BR>Files in this Animation: <font color="green">Files found</font> / <font color="red">Files not found</font><BR><BR>'

	if not form.has_key("blind"):
	        print outputText
Пример #4
0
def Main():
	form = cgi.FormContent()
	try:
                fdom0 = form["fdom"][0]
		ffield0 = form["ffield"][0]
	except:
		print "Hi"

	files = [	( htmlRoot+fdom0+"_"+ffield0+"_0.gif", "0"),
                        ( htmlRoot+fdom0+"_"+ffield0+"_1.gif", "1"),
			( htmlRoot+fdom0+"_"+ffield0+"_2.gif", "2"),
			( htmlRoot+fdom0+"_"+ffield0+"_3.gif", "3"),
			( htmlRoot+fdom0+"_"+ffield0+"_4.gif", "4"),
			( htmlRoot+fdom0+"_"+ffield0+"_5.gif", "5"),
			( htmlRoot+fdom0+"_"+ffield0+"_6.gif", "6"),
			( htmlRoot+fdom0+"_"+ffield0+"_7.gif", "7"),
			( htmlRoot+fdom0+"_"+ffield0+"_8.gif", "8"),
			( htmlRoot+fdom0+"_"+ffield0+"_9.gif", "9"),
 			( htmlRoot+fdom0+"_"+ffield0+"_10.gif", "10"),
                        ( htmlRoot+fdom0+"_"+ffield0+"_11.gif", "11"),
                        ( htmlRoot+fdom0+"_"+ffield0+"_12.gif", "12"),
                        ( htmlRoot+fdom0+"_"+ffield0+"_13.gif", "13"),
                        ( htmlRoot+fdom0+"_"+ffield0+"_14.gif", "14"),
                        ( htmlRoot+fdom0+"_"+ffield0+"_15.gif", "15") ]
	
	print 'Content-type: text/html \n\n'
	print '<HTML><HEAD></HEAD>'

	printHTML.printTop()

	print 'first_image = 1;'
	print 'last_image = 16;'

	printHTML.printBot()

	
	goodAnimation = 0
	

	print 'theImages[0] = new Image();'
	print 'theImages[0].src = "'+files[0][0]+'";'
	print 'imageNum[0] = true;'
	print 'myProg[0] = "0";'

	printHTML.printBot15()

	for i in range(1, len(files)):
		print 'theImages['+str(i)+'] = new Image();'
		print 'theImages['+str(i)+'].src = "'+files[i][0]+'";'
		print 'myProg['+str(i)+'] = "'+files[i][1]+'";'

		
		print 'imageNum['+str(i)+'] = true;'
		print 'document.animation.src = theImages['+str(i)+'].src;'
		print 'document.control_form.frame_nr.value = '+str(i)+';'


	printHTML.printBot2()

	print 'SRC="'+files[0][0]+'"'

	printHTML.printBot3()
Пример #5
0
def Main():
	form = cgi.FormContent()
	try:
		mapType = form["mapType"][0]
	except:
		print "Hi"
	try:
		Fhour = form["Fhour"][0]
	except:
		print "Hi"

	files = [	( htmlRoot+Fhour+"/"+mapType+"F00.gif", "F00"),
			( htmlRoot+Fhour+"/"+mapType+"F03.gif", "F03"),
			( htmlRoot+Fhour+"/"+mapType+"F06.gif", "F06"),
			( htmlRoot+Fhour+"/"+mapType+"F09.gif", "F09"),
			( htmlRoot+Fhour+"/"+mapType+"F12.gif", "F12"),
			( htmlRoot+Fhour+"/"+mapType+"F15.gif", "F15"),
			( htmlRoot+Fhour+"/"+mapType+"F18.gif", "F18"),
			( htmlRoot+Fhour+"/"+mapType+"F21.gif", "F21"),
			( htmlRoot+Fhour+"/"+mapType+"F24.gif", "F24"),
			( htmlRoot+Fhour+"/"+mapType+"F27.gif", "F27"),
			( htmlRoot+Fhour+"/"+mapType+"F30.gif", "F30"),
			( htmlRoot+Fhour+"/"+mapType+"F33.gif", "F33"),
			( htmlRoot+Fhour+"/"+mapType+"F36.gif", "F36"),
                        ( htmlRoot+Fhour+"/"+mapType+"F39.gif", "F39"),
                        ( htmlRoot+Fhour+"/"+mapType+"F42.gif", "F42"),
                        ( htmlRoot+Fhour+"/"+mapType+"F45.gif", "F45"),
                        ( htmlRoot+Fhour+"/"+mapType+"F48.gif", "F48") ]
	
	print 'Content-type: text/html \n\n'
	print '<HTML><HEAD></HEAD>'

	printHTML.printTop()

	print 'first_image = 1;'
	print 'last_image = 17;'

	printHTML.printBot()

	
	goodAnimation = 0
	

	print 'theImages[0] = new Image();'
	print 'theImages[0].src = "'+files[0][0]+'";'
	print 'imageNum[0] = true;'
	print 'myProg[0] = "F00";'

	printHTML.printBot15()

	for i in range(1, len(files)):
		print 'theImages['+str(i)+'] = new Image();'
		print 'theImages['+str(i)+'].src = "'+files[i][0]+'";'
		print 'myProg['+str(i)+'] = "'+files[i][1]+'";'

		
		print 'imageNum['+str(i)+'] = true;'
		print 'document.animation.src = theImages['+str(i)+'].src;'
		print 'document.control_form.frame_nr.value = '+str(i)+';'


	printHTML.printBot2()

	print 'SRC="'+files[0][0]+'"'

	printHTML.printBot3()
Пример #6
0
def Main():
	form = cgi.FormContent()
	if form.has_key('buildDate'):
		hour = ("0"+form["ztime"][0])[-2:]
		day = ("0"+form["day"][0])[-2:]
		year = form["year"][0]
		month = ("0"+form["month"][0])[-2:]
		dateStr = str(year)+str(month)+str(day)+str(hour)
	else:
		try:
			dateStr = form["dateStr"][0]
		except:
			style.SendError("The variable 'dateStr' is undefined!")

	try:
		year = dateStr[0:4]
		month = dateStr[4:6]
		day = dateStr[6:8]
		hour = dateStr[8:10]
		timeTuple = (int(year), int(month), int(day), int(hour), 0, 0, 0, 0, -1)
	except:
		style.SendError("dateStr variable is not formated correctly, YYYYMMDDHH ")

	try:
		timeSpan = int( form["increment"][0] )
	except:
		style.SendError("The variable 'increment' is undefined!")

	try:
		mapType = form["mapType"][0]
	except:
		style.SendError("The variable 'mapType' is undefined!")


	print 'Content-type: text/html \n\n'
	print '<HTML><HEAD></HEAD>'
	now = time.mktime(timeTuple)
	if timeSpan < 0:
		now = now + timeSpan*3600
	nowTuple = time.localtime(now)
	fdirName = time.strftime("%Y_%m_%d/", nowTuple)
        ffileName = time.strftime(mapType+"%y%m%d%H.gif", nowTuple)


	printHTML.printTop()

	print 'first_image = 1;'
	print 'last_image = '+str(math.fabs(timeSpan)+1)+';'
	print 'animation_height = 540;'
	print 'animation_width = 720;'

	printHTML.printBot()

	htmlRoot = '/home/httpd/html/archivewx/data/'
	goodAnimation = 0

	print 'theImages[0] = new Image();'
	print 'theImages[0].src = "'+fdirName+ffileName+'";'
	print 'imageNum[0] = true;'
	fileRef = htmlRoot+fdirName+ffileName
	if os.path.isfile(fileRef):
		goodAnimation = 1
		outputText = '<font color="green">'+fileRef+'</font><BR>'
	else:
		outputText = '<font color="red">'+fileRef+'</font><BR>'


	printHTML.printBot15()


	for i in range(1, math.fabs(timeSpan)+1):
		thisSecs = now + i*3600
		thisTuple = time.localtime(thisSecs)		
		dirName = time.strftime("%Y_%m_%d/", thisTuple)
		fileName = time.strftime(mapType+"%y%m%d%H.gif", thisTuple)
		
		print 'theImages['+str(i)+'] = new Image();'
		print 'theImages['+str(i)+'].src = "'+dirName+fileName+'";'
		fileRef = htmlRoot+dirName+fileName
		if os.path.isfile(fileRef):
			goodAnimation = 1
			outputText = outputText +'<font color="green">'+fileRef+'</font><BR>'
		else:
			outputText = outputText +'<font color="red">'+fileRef+'</font><BR>'
		
		print 'imageNum['+str(i)+'] = true;'
		print 'document.animation.src = theImages['+str(i)+'].src;'
		print 'document.control_form.frame_nr.value = '+str(i)+';'

	if not goodAnimation:
		print """
		</script>
		Sorry none of the files in your request were found, please go back and try again.</BR>
		<BR><BR>Files in this Animation: <font color="green">Files found</font> / <font color="red">Files not found</font><BR><BR>
		"""

		print outputText
		sys.exit(0)


	printHTML.printBot2()

	print 'SRC="'+fdirName+ffileName+'"'

	printHTML.printBot3()

	print '<BR><BR>Files in this Animation: <font color="green">Files found</font> / <font color="red">Files not found</font><BR><BR>'	

	print outputText
Пример #7
0
def main():
    form = cgi.FieldStorage()
    try:
        mapType = form.getfirst("mapType")
    except Exception:
        print("Hi")
    try:
        Fhour = form.getfirst("Fhour")
    except Exception:
        print("Hi")

    files = [
        (htmlRoot + Fhour + "/" + mapType + "F00.gif", "F00"),
        (htmlRoot + Fhour + "/" + mapType + "F03.gif", "F03"),
        (htmlRoot + Fhour + "/" + mapType + "F06.gif", "F06"),
        (htmlRoot + Fhour + "/" + mapType + "F09.gif", "F09"),
        (htmlRoot + Fhour + "/" + mapType + "F12.gif", "F12"),
        (htmlRoot + Fhour + "/" + mapType + "F15.gif", "F15"),
        (htmlRoot + Fhour + "/" + mapType + "F18.gif", "F18"),
        (htmlRoot + Fhour + "/" + mapType + "F21.gif", "F21"),
        (htmlRoot + Fhour + "/" + mapType + "F24.gif", "F24"),
        (htmlRoot + Fhour + "/" + mapType + "F27.gif", "F27"),
        (htmlRoot + Fhour + "/" + mapType + "F30.gif", "F30"),
        (htmlRoot + Fhour + "/" + mapType + "F33.gif", "F33"),
        (htmlRoot + Fhour + "/" + mapType + "F36.gif", "F36"),
        (htmlRoot + Fhour + "/" + mapType + "F39.gif", "F39"),
        (htmlRoot + Fhour + "/" + mapType + "F42.gif", "F42"),
        (htmlRoot + Fhour + "/" + mapType + "F45.gif", "F45"),
        (htmlRoot + Fhour + "/" + mapType + "F48.gif", "F48"),
    ]

    print("Content-type: text/html \n\n")
    print("<HTML><HEAD></HEAD>")

    printHTML.printTop()

    print("first_image = 1;")
    print("last_image = 17;")

    printHTML.printBot()

    print("theImages[0] = new Image();")
    print('theImages[0].src = "' + files[0][0] + '";')
    print("imageNum[0] = true;")
    print('myProg[0] = "F00";')

    printHTML.printBot15()

    for i in range(1, len(files)):
        print("theImages[" + str(i) + "] = new Image();")
        print("theImages[" + str(i) + '].src = "' + files[i][0] + '";')
        print("myProg[" + str(i) + '] = "' + files[i][1] + '";')

        print("imageNum[" + str(i) + "] = true;")
        print("document.animation.src = theImages[" + str(i) + "].src;")
        print("document.control_form.frame_nr.value = " + str(i) + ";")

    printHTML.printBot2()

    print('SRC="' + files[0][0] + '"')

    printHTML.printBot3()