Esempio n. 1
0
def _render(staffList, roleMap):
	"""
	generates the html for the staff list page
	"""
	html = """<div class="title">Staff Details</div>
		
		<table id="stafflist">
			<th>Name</th>
			<th>Phone Number</th>
			<th>Address</th>
			<th>Role</th>

			<tr> <td><a href="editStaff">Add new staff member</a></td> <td>---</td> <td>---</td> <td>---</td></tr>
			%s		
		</table>"""
	
	COLOR_TAG = "class=\"alt1\""
	LINE_TEMPLATE = "<tr %s> <td><a href=\"editStaff?name=%s\">%s</a></td> <td>%s</td> <td>%s %s %s %s</td> <td>%s</td> </tr>"
	
	staffHtml = ""
	
	#display each staff member
	for i,staff in enumerate(staffList):
	
		#add all the staff info to the html
		staffHtml += LINE_TEMPLATE % ( COLOR_TAG if i % 2 == 0 else "", staff.name, staff.name, util.formatPhone(util.notNone(staff.phone)),
		util.notNone(staff.street), util.notNone(staff.city), util.notNone(staff.state), util.notNone(staff.zipCode), roleMap[staff.roleId] )
		
	#assemble and return the page
	return view.header() + html % staffHtml + view.footer()