Пример #1
0
	def draw(self, users):
		print 'Content-type: text/html\n\n'

		ipaddr = socket.gethostbyname(socket.gethostname())
		baseref = 'http://%s/cgi-bin/admin.py' % ipaddr

		output = ''
		output += """
		<form>
		<td><input type="text" name="pattern" value="" /></td>
		<td><input type="submit" value="Search" /></td>
		</form>
		"""
		output += html.tr("<th>" + "</th><th>".join(users[0]) + "</th>")
		addform = """
		<form>
		<td><input type="text" name="role" value="WAITER" /></td>
		<td>Auto</td>
		<td><input type="text" name="fname" value="" /></td>
		<td><input type="text" name="lname" value="" /></td>
		<td><input type="text" name="login" value="" /></td>
		<td><input type="text" name="tel" value="+380" /></td>
		<td><input type="submit" value="Add" /></td>
		<input type="hidden" name="q" value="add"> 
		</form>
		"""
		output += html.tr(addform)
		baseref
		for user in users[1:]:
			ref = baseref + '?del=%d' % user[1]
			user += html.a(ref, 'del'),
			output += html.tr("<td>" + "</td><td>".join([str(x) for x in user]) + "</td>")
	 
		print html.doc(html.table(output))
Пример #2
0
    def draw(self, data):
        print 'Content-type: text/html\n\n'

        ipaddr = socket.gethostbyname(socket.gethostname())
        baseref = 'http://%s/cgi-bin/admin.py' % ipaddr

        output = ''
        if data == "#ERROR":
            output += "<h3>Error: invalid login or password</h3>"
        loginform = """
        <form>
        <p><input type="text" name="login" value="" /></p>
        <p><input type="text" name="pw" value="" /></p>
        <p><input type="submit" value="Login" /></p>
        </form>
        """
        output += html.tr(loginform)
        print html.doc(html.table(output))