Example #1
0
def output_to(options, the_world=None, skip_upload=False):
	from functions import to_f
	
	files = {}
	
	if not the_world:
		cursor = database.get_cursor()
		the_world = world.World(cursor)
	else:
		cursor = the_world.cursor
	the_world.prep_for_to()
	
	headers = to_f.headers(the_world)
	footers = to_f.footers(the_world)
	js = to_f.javascript(the_world)
	output = to_f.make_to(the_world)
	
	to_source = "".join([headers, js, output, footers])
	
	# the_to = urllib.request.urlopen(common.data['rob_url'], 'mode=to&dev_mode=0&ajax=1')
	# the_to = urllib.request.urlopen(web_url, 'mode=to&dev_mode=0&ajax=1')
	# to_source = the_to.read()
	
	f = open('%s/to/index.html' % common.data['woa_folder'], 'w')
	f.write(to_source)
	f.write(padding)
	f.close()
	
	files['index.html'] = '%s/to/index.html' % common.data['woa_folder']
	
	if not skip_upload:
		upload("ftp.woarl.com", "*****@*****.**", ftp_pass['to'], files, options.delay, options.verbose)
		print(database.shell_text('[g]Team Overview uploaded[/g]'))
Example #2
0
File: to.py Project: Teifion/Rob3
def main(cursor):
	# Get team Id
	post_output = int(common.get_val('post_output', 0))
	dev_mode	= common.get_val('dev_mode', 0)
	ajax		= common.get_val('ajax', 0)
	
	the_world = world.World(cursor)
	the_world.prep_for_to()
	
	headers = to_f.headers(the_world)
	footers = to_f.footers(the_world)
	js = to_f.javascript(the_world)
	output = to_f.make_to(the_world)
	
	content = []
	
	if dev_mode == "1":
		headers = headers.replace('../styles.css', 'http://localhost/woa/styles.css').replace('../includes/jquery.js', '%sjquery.js' % common.data['media_path'])
	
	if ajax:	content.append(headers)
	else:		content.append(js)
	
	content.append(output)
	
	if ajax:	content.append(footers)
	
	return "".join(content)