Exemple #1
0
def main(cursor):
	show_dead_teams		= common.get_val('show_dead')
	show_unqueued_teams	= common.get_val('show_unqueued')
	
	# Get the turn we'll want to get stuff for
	current_turn = common.current_turn()
	
	# Get our list
	team_dict = team_q.get_real_teams(cursor)
	
	output = ['<textarea rows="40" style="width:99%;">']
	
	for team_id, the_team in team_dict.items():
		if the_team.ir or the_team.dead or not the_team.active:
			continue
		
		output.append("%s\n" % the_team.name)
	
	output.append("</textarea>")
	return "".join(output)
Exemple #2
0
def main(cursor):
	output = []
	
	all_teams = common.get_val('all_teams', False)
	
	# Get the turn we'll want to get stuff for
	current_turn = common.current_turn()
	
	# Get our list
	if not all_teams:
		team_dict = team_q.get_real_teams(cursor)
	else:
		team_dict = team_q.get_all_teams(cursor)
	
	if len(team_dict) < 1:
		raise Exception("No teams found")
	
	output.append("""
	<table border="0" cellspacing="0" cellpadding="0" style="width: 100%;">
		<tr class="row2">
			<th style="padding: 5px;">Team name</th>
			<th colspan="6">Forum</th>
			<th>&nbsp;</th>
			<th colspan="10">Rob</th>
			<th>&nbsp;</th>
			<th colspan="5">Internal</th>
			<th>&nbsp;</th>
			<th colspan="1">&nbsp;</th>
		</tr>""")

	count = -1

	last_active	= 1
	last_ir		= 0
	last_queue	= 0

	# for team_id, team in team_dict.items():
	# print(team_dict)
	for team_id, the_team in team_dict.items():
		count += 1
		
		if last_active != the_team.active or last_ir != the_team.ir or last_queue != the_team.not_in_queue:
			output.append("""
		<tr>
			<td colspan="24">&nbsp;</td>
		</tr>""")

		last_active	= the_team.active
		last_ir		= the_team.ir
		last_queue	= the_team.not_in_queue
		
		name_image = '<img src="http://localhost/woa/images/teams/%s.png" alt="%s"/>' % (the_team.name.replace(' ', '_').replace("'", '').lower(), the_team.name)
		
		output.append("""
		<tr class="row%(row)d" id="%(team_id)d">
		<td><strong class="block_cell">%(name)s</strong></td>
		<td><a class="block_link" href="%(board_url)sviewforum.php?f=%(team_forum)d">F</a></td>
		<td><a class="block_link" href="%(board_url)sviewtopic.php?t=%(team_orders)d">O</a></td>
		<td><a class="block_link" href="%(board_url)sviewtopic.php?t=%(team_intorders)d">IO</a></td>
		<td><a class="block_link" href="%(board_url)sviewtopic.php?t=%(team_results)d">R</a></td>
		<td><a class="block_link" href="%(board_url)sviewtopic.php?t=%(team_teaminfo)d">TI</a></td>
		<td><a class="block_link" href="%(board_url)sviewtopic.php?t=%(team_culture)d">C</a></td>
		<td width="10">&nbsp;</td>
		
		<td><a class="block_link" href="web.py?mode=list_cities&amp;team=%(team_id)d">Cit</a></td>
		<td><a class="block_link" href="web.py?mode=list_spells&amp;team=%(team_id)d">Mag</a></td>
		<td><a class="block_link" href="web.py?mode=list_techs&amp;team=%(team_id)d">Tech</a></td>
		<td><a class="block_link" href="web.py?mode=list_units&amp;team=%(team_id)d">Mil</a></td>
		<td><a class="block_link" href="web.py?mode=list_armies&amp;team=%(team_id)d">Arm</a></td>
		<td><a class="block_link" href="web.py?mode=list_operatives&amp;team=%(team_id)d">Op</a></td>
		<td><a class="block_link" href="web.py?mode=results&amp;team=%(team_id)d">Res</a></td>
		<td><a class="block_link" href="web.py?mode=list_artefacts&amp;team=%(team_id)d">Art</a></td>
		<td><a class="block_link" href="web.py?mode=team_stats&amp;team=%(team_id)d">Stat</a></td>
		<td><a class="block_link" href="web.py?mode=list_players&amp;team=%(team_id)d">Plyr</a></td>
			
			<td width="10">&nbsp;</td>
			
			<td><a class="block_link" href="web.py?mode=view_borders&amp;team=%(team_id)d">Bord</a></td>
			<td><a class="block_link" href="web.py?mode=view_orders&amp;turn=%(current_turn)d&amp;team=%(team_id)d&amp;topic_id=%(team_orders)d">Ord</a></td>
			<td><a class="block_link" href="web.py?mode=view_intorders&amp;team=%(team_id)d&amp;turn=%(current_turn)d&amp;topic_id=%(team_intorders)d">Int</a></td>
			<td><a class="block_link" href="web.py?mode=ti&amp;team=%(team_id)d">TI</a></td>
			<td><a class="block_link" href="web.py?mode=spyrep&amp;team=%(team_id)d">Spy Rep</a></td>

			<td width="10">&nbsp;</td>

			<td><a class="block_link" href="web.py?mode=edit_team&amp;team=%(team_id)d">Edit team</a></td>
		</tr>
		""" % {	'current_turn': current_turn,
				'row': (count % 2),
				'board_url': common.data['board_url'],

				'team_id': the_team.id,
				'name': the_team.name,
				"name_image": name_image,
				'team_forum': the_team.forum_url_id,
				'team_orders': the_team.orders_topic,
				'team_intorders': the_team.intorders_topic,
				'team_results': the_team.results_topic,
				'team_teaminfo': the_team.teaminfo_topic,
				'team_culture': the_team.culture_topic,
		})

	output.append("</table><br /><br />")

	output.append("""&nbsp;&nbsp;&nbsp;
	<a href="get_teams">Check for more teams</a>
	<br />
	""")
	
	return "".join(output)
Exemple #3
0
def main(cursor):
	wonder_id = int(common.get_val('wonder', 0))
	
	if wonder_id < 1: return "No wonder selected"
	
	the_wonder = wonder_q.get_one_wonder(cursor, wonder_id)
	cities_dict = city_q.get_live_cities(cursor)
	teams_dict = team_q.get_real_teams(cursor)
	
	names = {}
	for c, the_city in cities_dict.items():
		names[c] = the_city.name
	
	# TODO Make this do it properly
	tnames = {}
	for t, the_team in teams_dict.items():
		tnames[t] = the_team.name
	
	output = ["<div style='padding: 5px;'>"]
	
	output.append("""
	<form action="exec.py" method="post" accept-charset="utf-8">
		<input type="hidden" name="mode" id="mode" value="edit_wonder_commit" />
		<input type="hidden" name="id" id="id" value="%(wonder_id)s" />
	
		Editing: %(name_text)s
		<br /><br />
	
		<table border="0" cellspacing="5" cellpadding="5">
			<tr>
				<td><label for="city">City:</label></td>
				<td>%(city_menu)s</td>
		
				<td width="5">&nbsp;</td>
			
				<td><label for="team">Team:</label></td>
				<td>%(team_menu)s</td>
			
				<td width="5">&nbsp;</td>
			
				<td><label for="completed">Completed:</label></td>
				<td style="padding: 1px;">%(completed)s</td>
			</tr>
			<tr>
				<td><label for="completion">Completion:</label></td>
				<td style="padding: 1px;">%(completion)s</td>
			
				<td width="5">&nbsp;</td>
			
				<td><label for="point_cost">Point cost:</label></td>
				<td style="padding: 1px;">%(point_cost)s</td>
			
				<td width="5">&nbsp;</td>
			
				<td><label for="material_cost">Material cost:</label></td>
				<td style="padding: 1px;">%(material_cost)s</td>
			</tr>
			<tr>
				<td colspan="10">&nbsp;&nbsp;&nbsp;Description:<br />
					%(description)s
				</td>
			</tr>
		</table>
		<br />
		<input type="submit" value="Perform edit" />
	</form>
	<form id="delete_form" action="exec.py" method="post" accept-charset="utf-8">
		<input type="hidden" name="wonder" id="wonder" value="%(wonder_id)s" />
		<input type="hidden" name="mode" id="mode" value="remove_wonder" />
		<input style="float:right; margin-right:100px;" type="button" value="Delete wonder" onclick="var answer = confirm('Delete %(name_safe)s?')
		if (answer) $('#delete_form').submit();" />
	</form>
	<br /><br />""" % {
		"wonder_id":					wonder_id,
		"name_text":				common.text_box("name", the_wonder.name),
		
		"city_menu":					common.option_box(
			name='city',
			elements=names,
			element_order=cities_dict.keys(),
			custom_id="",
			selected=the_wonder.city,
		),
		
		"team_menu":					common.option_box(
			name='team',
			elements=tnames,
			element_order=teams_dict.keys(),
			custom_id="",
			selected=the_wonder.team,
		),
		
		"completed":				common.check_box("completed", the_wonder.completed),
		"completion":				common.text_box("completion", the_wonder.completion, size=7),
		"point_cost":				common.text_box("point_cost", the_wonder.point_cost, size=7),
		"material_cost":			common.text_box("material_cost", the_wonder.material_cost, size=7),
		
		"description":	'<textarea name="description" id="description" rows="4" style="width:99%%;">%s</textarea>' % the_wonder.description,
		
		"name_safe":			common.js_name(the_wonder.name),
	})
	
	output.append("</div>")
	
	return "".join(output)