#python

import os, sys, time

# note that thr33 debug does not carry into pypage execution
debug = 0								

def cgi_init():
	"""
	assumes 'data' and 'cgi-bin' are peer directories
	"""
	global l, c, files_dir, SCRIPT
	current = sys.path[0]
	consts = current.split(os.sep)
	consts = (os.sep).join(consts[:consts.index("data")])+os.sep+"cgi-bin"+os.sep+"TheMingServer"
	sys.path.append(consts)

	import Lib3
	l = Lib3.Lib3(debug)
	import Constants
	c = Constants.Constants()
	files_dir = c.FILES_DIR
	SCRIPT = c.CGI_NAME
	return

cgi_init()
l.prn("FILES_DIR", files_dir)

file_dict = l.get_dict(files_dir+os.sep+"gq.response")

entry_list = []	
dates = file_dict.keys()
for date in dates:
	dict = file_dict[date]
	entry = (dict["id"], dict["author"], dict["title"], time.ctime(float(date)))
	entry_list.append(entry) # comment's id, author, title and formatted date

print '''
<center>
<table width="75%%"><tr><td>

<form action="%s" method=post>

<h4>Comment ID To Remove</h4>
''' % SCRIPT

for entry in entry_list:
	print '<input type="radio" name="params" value="%s"> %s - %s (%s) <br>' % entry

print '''<hr>
<h4>Submit</h4>

When you are finished, submit your request.
<input type="hidden" name="page" value="sites/ming-cgi/server/private/remove/result/result">
<input type="submit" name="submit" value="here.">
</form>

</td></tr></table>
'''

	

