示例#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()
示例#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)
示例#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)
示例#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)
示例#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)
示例#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)
示例#7
0
文件: main.py 项目: paulo-sampaio/ADP
def main():
    return view.header() + view.body() + view.footer()
示例#8
0
#!C:\Python\python.exe
print("Content-type: text/html\n\n")
import view

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

print(html)