Exemplo 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()
Exemplo n.º 2
0
#!C:\Python\python.exe
#-*- coding: utf-8 -*-
# import sys
# # import codecs
# # sys.stdout = codecs.getwriter("iso-8859-1")(sys.stdout, 'xmlcharrefreplace')
# if sys.stdout.encoding != 'cp850':
#       sys.stdout = codecs.getwriter('cp850')(sys.stdout.buffer, 'strict')
# if sys.stderr.encoding != 'cp850':
#   sys.stderr = codecs.getwriter('cp850')(sys.stderr.buffer, 'strict')
# #chcp 65001
# #print(data.decode('utf-8').encode('cp850','replace').decode('cp850'))

print("Content-type: text/html\n\n")

import view

html = view.head() + view.login_home() + view.footer()

print(html)
Exemplo n.º 3
0
#!C:\Python\python.exe
#-*- coding: utf-8 -*-
# import sys
# # import codecs
# # sys.stdout = codecs.getwriter("iso-8859-1")(sys.stdout, 'xmlcharrefreplace')
# if sys.stdout.encoding != 'cp850':
#       sys.stdout = codecs.getwriter('cp850')(sys.stdout.buffer, 'strict')
# if sys.stderr.encoding != 'cp850':
#   sys.stderr = codecs.getwriter('cp850')(sys.stderr.buffer, 'strict')
# #chcp 65001
# #print(data.decode('utf-8').encode('cp850','replace').decode('cp850'))

print("Content-type: text/html\n\n")

import view

html = view.head() + view.home() + view.footer()

print(html)
Exemplo n.º 4
0
#!C:\Python\python.exe
print("Content-type: text/html\n\n")

import view

html = view.head() + view.movie_list() + view.footer()

print(html)
Exemplo n.º 5
0
#!C:\Python\python.exe
print("Content-type: text/html\n\n")

import view

html = view.head() + view.movie_detail() + view.footer()

print(html)
Exemplo n.º 6
0
#!C:\Python\python.exe
print("Content-type: text/html\n\n")

import view

html = view.head() + view.sign_up() + view.footer()

print(html)
Exemplo n.º 7
0
def main():
    return view.header() + view.body() + view.footer()
Exemplo n.º 8
0
#!C:\Python\python.exe
print("Content-type: text/html\n\n")
import view

html = view.head() + view.login() + view.footer()

print(html)