示例#1
0
	def print_initialHTML(self):
		htmlStart =  """
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Browse Logical View</title>
"""
		htmlEnd = """
</head>

<body>
"""
		print htmlStart + self.script_str() + ryw_view.css_str() + \
                      htmlEnd
import cgi, cgitb
cgitb.enable()
import sys, os, ryw_view, ryw, su
import logging



ryw.print_header()
print '<TITLE>Outgoing Discs</TITLE>'
ryw_view.print_logo()
print ryw_view.css_str()



def get_resources():
    logging.debug('get_resources: entered...')
    try:
        resources = su.parseKeyValueFile(os.path.join(RepositoryRoot,
                                                      'Resources.txt'))
    except:
        ryw.give_bad_news('get_resources failed.', logging.critical)
        return (False, None)
    
    logging.debug('get_resources succeeded.')
    return (True, resources)

        

def print_burn_all_buttons():
	print """
<FORM Action="/cgi-bin/burn.py?" METHOD="GET">
def generate_html(items,itempath, repDir, tmpImgDir):
        ryw.give_news2('generating static html pages... &nbsp;&nbsp;',
                       logging.info)
	htmlDir = os.path.join(repDir, "html")
	if not ryw.try_mkdir(htmlDir, 'addRobotWriteRequest:generate_html'):
		return False
	try:
		f = open(os.path.join(htmlDir,"index.html"),"w")
		f.write("""
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>

<head>
	<title>Objects on this disk</title>
""")
                f.write(ryw_view.css_str())
                f.write("""
</head>

<body>
""")
		f.write(ryw_view.logo_str_for_disc())
		f.write("""
<h3>Objects on Disk</h3><p>(you are on this page either because you are browsing 
the disc directly or were directed to it due to an error while merging it.)
<BR>
""")
		write_page(items,itempath,f, tmpImgDir)
                f.write(ryw_view.end_print_str())
		f.write(ryw_view.footer2_str())
		f.write("""
</body>
</html>
""")
		f.close()
		srcIconsDir = os.path.join(RepositoryRoot, "WWW", "icons")
		dstIconsDir = os.path.join(htmlDir, "icons")
		su.copytree(srcIconsDir, dstIconsDir)
		parentDir, repdirname = os.path.split(repDir)
		f = open(os.path.join(parentDir,"index.html"), "w")
		f.write("""
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>
<head>
<title> Repository folders on this disk </title>
<meta http-equiv="refresh" content="1;URL=.\%s\html\index.html">
</head>
<body>
loading page containing list of things on this disk....
</body>
</html>
""" % (repdirname,))
		f.close()
	except:
		ryw.give_bad_news('addRobotWriteRequest: generate_html files: failed to write file: ',logging.critical)
		return False

        ryw.give_news2('done. ', logging.info)
        ryw.give_news2('<BR>', logging.info)
	return True