def post(self):
     html.header(self)
     wid = cgi.escape(self.request.get("week"))
     if wid != "-1":
         self.redirect("/week/" + wid)
     else:
         self.redirect("/")
    def post(self):
        html.header(self)
        self.response.out.write(
            '<form action = "/add" method = "get"><input type = "submit" value = "Add Contact" class = "submit"></input></form>'
        )
        self.response.out.write(
            '<form action = "/addWeek" method = "get"><input type = "submit" value = "Add Week" class = "submit"></input></form>'
        )
        self.response.out.write(
            '<form action = "/mailingList" method = "get"><input type = "submit" value = "Mailing List" class = "submit"></input></form><br/>'
        )
        self.response.out.write(
            '<form action = "/search" method = "post"><input type="text" name="search" rows="1" class = "post-form-textarea"></input><br/><input type = "submit" value = "Search" class = "submit"></input></form><br/>'
        )
        html.weekFilter(self)
        search_query = cgi.escape(self.request.get("search"))
        name_query = search_query.title()
        contacts = datamodel.Contact.all()
        contacts.filter("firstName = ", name_query)
        for contact in contacts:
            html.listing(self, contact)

        contacts = datamodel.Contact.all()
        contacts.filter("lastName = ", name_query)
        for contact in contacts:
            html.listing(self, contact)

        contacts = datamodel.Contact.all()
        contacts.filter("email = ", search_query)
        for contact in contacts:
            html.listing(self, contact)
        html.footer(self)
    def get(self):
        html.header(self)
        id = int(float(string.lstrip(self.request.path, "contact/")))
        contact = datamodel.Contact.get_by_id(id)
        html.contact(self, contact)
        html.addRelation(self, contact)

        self.response.out.write('<br/><div class="header">Relations</div>')
        for rel in contact.relations:
            r = datamodel.Contact.get_by_id(rel.id())
            html.contact(self, r)

        html.footer(self)
示例#4
0
def main():
    maintenance = 0
    helpmsg = 0
    if maintenance:
        print('Location: /_blank.py\r\n\r')
    #if not environ.has_key('QUERY_STRING'):
    if environ['QUERY_STRING'] == '':
        query = 'main'
    else:
        query = environ['QUERY_STRING']
    html.header(str(query))
    if query == 'main':
        html.main_v2()
        helpmsg = 1
    elif query == 'enter':
        html.enter_v2()
    elif query == 'flash':
        html.flash_v2()
    elif query == 'about':
        html.about_v2()
    elif query == 'gossip':
        html.gos_v2()
    elif query == 'who':
        html.who_v2()
    elif query == 'top':
        html.top_v2()
    elif query == 'topgang':
        html.topg_v2()
    elif query == 'rules':
        html.rules_v2()
    elif query == 'realm':
        html.realm_v2()
    elif query == 'notes':
        html.notes_v2()
    elif query == 'files':
        html.files_v2()
    elif query == 'megamud':
        html.filesection('mega', 'MegaMud')
    elif query == 'majormud':
        html.filesection('mmud', 'MajorMUD')
    elif query == 'wgserv':
        html.filesection('wgserv', 'Worldgroup')
    elif query == 'aftermud':
        print('<pre>')
        with open('AFTERMUD.REL', 'r') as file:
            print(file.read())
        print('</pre>')
    else:
        html.error(404)
    html.footer(helpmsg)
    return 0
def strategy_new(environ):
  body=read(environ)
  form=cgi.FieldStorage(fp=body, environ=environ, keep_blank_values=True)
  auth = environ['HTTP_AUTHORIZATION'].split(' ')[1]
  username, password = auth.decode('base64').split(':', 1)
  strategies.add_strategy(form.getvalue("name") ,form.getvalue("file"), username)
  return html.header('Ahoy!')+html.strat_new()+html.footer()
示例#6
0
def nav_lang ( d, lang, file_list ):
	"""Sauvegarde la page de navigation de la langue"""
	
	file_link = u''
	for f in file_list:
		file_link += u'<a href="%s_nav.html" target="iframe_2">%s</a> - '%( os.path.splitext(f)[0], os.path.splitext(f)[0] )
	
	file_link += u'<a href="%s_stat.html" target="iframe_2">statistique de la langue</a>'%( lang )
	
	page = u"""
		<style type="text/css">
			#all { height: 100%%; }					
			#link { text-align: center; height: 30px; }					
			iframe { width: 100%%; }
		</style>				
		<script src="../jquery-1.6.4.min.js" type="text/javascript"></script>
		<div id="all">
			<div id="link">
				%s
			</div>
			
			<iframe src="%s" name="iframe_2" id="if"></iframe>
		</div>
	"""%(
		file_link,
		os.path.splitext(file_list[0])[0] + u"_nav.html"
	)
	
	html.write(	u"%s/nav.html"%( d+lang ),
				html.header( u"utf-8", lang ),
				page,
				u"</body>\n</html>",
				"utf-8" )
示例#7
0
def nav_file ( d, lang, f, ext ):
	"""Sauvegarde la page de navigation du fichier"""
	
	page = u"""
		<style type="text/css">
			#all { height: 100%%; }					
			#link { text-align: center; height: 30px; }					
			iframe { width: 100%%; }
		</style>				
		<script src="../jquery-1.6.4.min.js" type="text/javascript"></script>
		<div id="all">
			<div id="link">
				%s - 
				<a href="%s%s" target="iframe_3">version originale</a>
				<a href="%s_color.html" target="iframe_3">version coloriée</a>
				<a href="%s_stat.html" target="iframe_3">statistique</a>
			</div>
			
			<iframe src="%s_stat.html" name="iframe_3" id="if"></iframe>
		</div>
	"""%(
		f,
		f,
		ext,
		f,
		f,
		f
	)
	
	html.write(	u"%s/%s_nav.html"%( d+lang, f ),
				html.header( u"utf-8", f ),
				page,
				u"</body>\n</html>",
				"utf-8" )
示例#8
0
def nav_princ ( d, lang_list ):
	"""Sauvegarde la page de navigation principale"""
	
	lang_link = u''
	for lang in lang_list:
		lang_link += u'<a href="%s/nav.html" target="iframe_1">%s</a> - '%( lang, lang )
	
	lang_link = lang_link[:-3]
	
	page = u"""			
		<style type="text/css">
			#all { height: 100%%; }					
			#link { text-align: center; height: 30px; }					
			iframe { width: 100%%; }
		</style>				
		<script src="jquery-1.6.4.min.js" type="text/javascript"></script>
		<div id="all">
			<div id="link">
				%s
			</div>					
			<iframe src="%s" name="iframe_1" id="if"></iframe>
		</div>
	"""%(
		lang_link,
		lang_list[0] + u"/nav.html"
	)
	
	html.write(	u"%snav.html"%( d ),
				html.header( u"utf-8", u"LTAL TP 1-2" ),
				page,
				u"</body>\n</html>",
				"utf-8" )
示例#9
0
def create_personal(book, person_name, connection):
    name_parse = person_name.split('_')
    name = name_parse[0] + ' ' + name_parse[1]
    person = book.find_person_by_name(name_parse[0], name_parse[1])
    doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n'
    personal = html.Element('<html>', str(html.header(name) + str(html.personal(person))))
    connection.sendall(doctype + str(personal))
示例#10
0
def user_new(environ):
  post = path.get_post_array(environ)
  if post['test'][0]!="8":
    raise Exception('Begone!')
  u=users.User(post['username'][0])
  u.add_user(post['password'][0])
  return html.header('Ahoy!', False)+html.user_new(post['username'][0])+html.footer()
示例#11
0
def edit_personal(book, person_name, connection):
    name_parse = person_name.split('_')
    name = name_parse[0] + ' ' + name_parse[1]
    person = book.find_person_by_name(name_parse[0], name_parse[1])
    doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n'
    style = html.Element('<style>', 'sup {color: red}')
    edit = html.Element('<html>', str(html.header('Edit ' + name, style) + str(html.add_and_edit('edit', person))))
    connection.sendall(doctype + str(edit))
示例#12
0
def strats(environ):
  auth = environ['HTTP_AUTHORIZATION'].split(' ')[1]
  username, password = auth.decode('base64').split(':', 1)
  strats=strategies.get_users_strategies(username)
  response_body=html.header('Ahoy!')
  response_body+=html.strats(strats)
  response_body+=html.footer()
  return response_body
示例#13
0
def strats_delete(environ):
  auth = environ['HTTP_AUTHORIZATION'].split(' ')[1]
  username, password = auth.decode('base64').split(':', 1)
  label=environ['PATH_INFO'].split('/')[-1]
  strategies.delete_stategy(label, username)
  response_body=html.header('Ahoy!')
  response_body+=html.strat_delete(label)
  response_body+=html.footer()
  return response_body
示例#14
0
def game_show(environ):
  response_body = html.header('Ahoy!')
  uri = environ['PATH_INFO'].split('/')
  g = games.Game(uri[3])
  response_body += html.show_game(g)
  g.play()
  response_body += '<pre>%s</pre>' % g.stdoutdata
  response_body += html.show_game(g)
  response_body += html.footer()
  return response_body
 def get(self):
     html.header(self)
     self.response.out.write(
         '<form action = "/add" method = "get"><input type = "submit" value = "Add Contact" class = "submit"></input></form>'
     )
     self.response.out.write(
         '<form action = "/addWeek" method = "get"><input type = "submit" value = "Add Week" class = "submit"></input></form>'
     )
     self.response.out.write(
         '<form action = "/mailingList" method = "get"><input type = "submit" value = "Mailing List" class = "submit"></input></form><br/>'
     )
     self.response.out.write(
         '<form action = "/search" method = "post"><input type="text" name="search" rows="1" class = "post-form-textarea"></input><br/><input type = "submit" value = "Search" class = "submit"></input></form><br/>'
     )
     html.weekFilter(self)
     contacts = datamodel.Contact.all().order("lastName")
     for contact in contacts:
         html.listing(self, contact)
     html.footer(self)
 def genHTML(self, stream):
     title = 'Testcase: ' + self.info.title.pcdata
     htmlstream = html.HTMLStream(stream, title, bgcolor="white")
     htmlstream.titleHeader(title)
     #
     # info
     #
     htmlstream.write(html.header('Description', 3))
     htmlstream.pushTag('BLOCKQUOTE')
     for paragraph in [self.info.abstract, self.info.description]:
         text = paragraph.pcdata
         if text:
             htmlstream.write(html.paragraph(text))
     htmlstream.popTag()
     #
     # prescription
     #
     htmlstream.write(html.header('Prescription', 3))
     htmlstream.pushTag('BLOCKQUOTE')
     prescription = self.prescription
     htmlstream.write(html.paragraph(prescription.kind))
     # properties
     for property in prescription.properties:
         htmlstream.write(html.tagged('B', property.kind + ':'))
         htmlstream.write(' ' + property.pcdata)
         htmlstream.lineBreak()
     # files
     if len(prescription.files) > 0:
         htmlstream.write(html.header('Files', 4))
         htmlstream.pushTag('UL')
         for file in prescription.files:
             htmlstream.write(html.tagged('LI', file.pcdata))
             htmlstream.pseudoBreak()
         htmlstream.popTag()
     htmlstream.popTag()
     #
     # close
     #
     htmlstream.line()
     genDate(htmlstream)
     htmlstream.close()
示例#17
0
 def writeExceptionContent(self, exceptions):
     self.htmlstream.line()
     self.htmlstream.write(
         html.header(html.anchor('Exceptions', 'Exceptions'), 2) + '\n')
     self.htmlstream.pushTags('blockquote', 'dl')
     for exception in exceptions:
         self.htmlstream.tag('dt')
         self.htmlstream.write(html.tagged('b', (exception.name)))
         self.htmlstream.tag('dd')
         self.htmlstream.write(exception.doc)
     self.htmlstream.popTag(2)
     self.htmlstream.pseudoBreak()
 def get(self):
     html.header(self)
     wid = int(float(string.lstrip(self.request.path, "week/")))
     week = datamodel.Week.get_by_id(wid)
     self.response.out.write(
         '<form action = "/add" method = "get"><input type = "submit" value = "Add Contact" class = "submit"></input></form>'
     )
     self.response.out.write(
         '<form action = "/addWeek" method = "get"><input type = "submit" value = "Add Week" class = "submit"></input></form>'
     )
     self.response.out.write(
         '<form action = "/mailingList" method = "get"><input type="hidden" name="week" value="'
         + str(wid)
         + '"></input><input type = "submit" value = "Mailing List" class = "submit"></input></form><br/>'
     )
     self.response.out.write(
         '<form action = "/search" method = "post"><input type="text" name="search" rows="1" class = "post-form-textarea"></input><br/><input type = "submit" value = "Search" class = "submit"></input></form><br/>'
     )
     html.weekFilter(self)
     contacts = datamodel.Contact.all()
     contacts.filter("weeks = ", week.key())
     for contact in contacts:
         html.listing(self, contact)
     html.footer(self)
示例#19
0
 def writeClassContent(self, clazz):
     display = 'class ' + clazz.pyname
     anchor = html.anchor(clazz.pyname, display)
     self.htmlstream.write(html.header(anchor, 2) + '\n')
     self.htmlstream.pushTag('blockquote')
     if clazz.doc:
         short, long = breakDesc(clazz.doc, None)
         self.htmlstream.write(html.paragraph(short))
         self.htmlstream.write(html.paragraph(long))
     if clazz.constructor != None:
         allMethods = [clazz.constructor] + clazz.methods()
     else:
         allMethods = clazz.methods()
     self.writeChapterContent(allMethods, None)
     self.htmlstream.popTag()
     self.htmlstream.pseudoBreak()
     self.htmlstream.line()
示例#20
0
 def genSinglepageIndex(self, targetDir, entries):
     groups, letters = self.splitEntries(entries)
     targetFile = targetDir.join(self.namebase + '.html')
     htmlstream = self.htmlProlog(targetFile, self.title)
     htmlstream.write(self.singlePageLetterIndex(letters))
     for group in groups:
         # write anchor
         letter = string.lower(group[0][0][0])  # entry->name->[0]
         anchor = html.anchor(letter, letter)
         header = html.header(anchor, 3)
         htmlstream.write(header + '\n')
         # write entries
         htmlstream.pushTag('dl')
         for entry in group:
             self.formatEntry(entry, targetDir, htmlstream)
         htmlstream.popTag()
     self.htmlEpilog(htmlstream)
     return targetFile
示例#21
0
 def genDocContent(self, item):
     language = item.language
     if not language or (language == self.language):
         self.htmlstream.write(html.header(html.anchor(item.pyname), 3))
         self.htmlstream.write(html.paragraph(item.doc))
         if isinstance(item, GlueDirectory):
             self.htmlstream.pushTag('blockquote')
             for subitem in item.items:
                 self.genDocContent(subitem)
             self.htmlstream.popTag()
             self.htmlstream.pseudoBreak()
         elif isinstance(item, GlueExternExample):
             self.writeExternExample(item)
         elif isinstance(item, GlueExample):
             self.htmlstream.pushTag('pre')
             code = item.getCode()
             self.htmlstream.write(code)
             self.htmlstream.pseudoBreak()
             self.htmlstream.popTag()
示例#22
0
def create_index(book, connection):
    doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n'
    style = html.Element('<style>', 'ul {list-style-type: none; text-align:center;}')
    index = html.Element('<html>', str(html.header('Address Book', style) + str(html.index(book))))
    connection.sendall(doctype + str(index))
示例#23
0
def game(environ):
  response_body = html.header('Ahoy!')
  response_body += html.form_create_new_game(strategies.get_strategies())
  response_body += html.footer()
  return response_body
示例#24
0
def stat ( file, u_title, u_tag, nbword, u_zipf, u_zipf_char, t ):
	"""Sauvegarde la page de statistique sur le document"""
	
	page = u"""
	<style type="text/css">
		.col {
			width: 50%%;
		}
		.left {
			float: left;
		}
		.right {
			float: right;
		}
		table {
			text-align: center;
		}
		td {
			color: #9370DB; 
			font-size: 20px; 
			font-weight: bold;
		}
		img {
			width: 100%%;
		}
		h1 {
			text-align: center;
		}
	</style>
	<p>
		%s<br />
		Fichier traité en %fs.	
	</p>
	<div class="left col">
		<table cellspacing="20">
			<tr>
				<td>%s</td>
			</tr>
			<tr>
				<td>%s</td>
			</tr>
			<tr>
				<td>%s</td>
			</tr>
		</table>
	</div>
	<div class="right col">
		<dl>
			<dt>Nombre de mots:</dt> <dd>%d</dd>
			<dt>Nombre de mots différents:</dt> <dd>%d</dd>
			<dt>Nombre de mots sur nombre de mots différents:</dt> <dd>%f</dd>
		</dl>
	</div>
	<br style="clear: both"/>
	<div class="left col">
		<img src="%s" alt="Nuage de points longueur et effectif" />
		<h1>Mots</h1>
		<img src="%s" alt="Loi de Zipf sur les mots" />
		<br />
		%s
	</div>
	<div class="right col">
		<img src="%s" alt="rang du mot x effectif" />
		<h1>Caractères</h1>
		<img src="%s" alt="Loi de Zipf sur les caractères" />
		<br />
		%s
	</div>
	"""%(
	u_title, 
	time.time() - t,
	string.join(u_tag[:5], u"</td><td>"), 
	string.join(u_tag[5:10], u"</td><td>"), 
	string.join(u_tag[10:], u"</td><td>"),
	nbword[0],
	nbword[1],
	nbword[2],
	unicode(file[1], 'utf-8') + u"_leneffect.png",
	unicode(file[1], 'utf-8') + u"_zipf_word.png",
	html.tuple_2_ol(u_zipf),
	unicode(file[1], 'utf-8') + u"_rangeffect.png",
	unicode(file[1], 'utf-8') + u"_zipf_char.png",
	html.tuple_2_ol(u_zipf_char)
	)
	
	html.write(	file[0] + file[1] + u"_stat.html",
				html.header( u"utf-8", u"Statistique de %s"%( string.join(file[1:]) ) ),
				page,
				u"</body>\n</html>",
				"utf-8" )
示例#25
0
import clustering
import extraction
import config
import os
import html
from wsdl import WSDL
import json
html.header()
distance_matrix=clustering.get_distance_matrix()

html.distance_matrix(distance_matrix)

old_distance_matrix=json.dumps(distance_matrix)
if config.K_MEANS_CLUSTERING:
    clusters=clustering.get_all_clusters_k_means(distance_matrix)
else:
    clusters=clustering.get_all_clusters(distance_matrix)

html.cluster(clusters)

#parse WSDL
wsdl_object_array=[]
for service in os.listdir(config.SERVICES_FOLDER):
    wsdl_object_array.append(WSDL(config.SERVICES_FOLDER+service))

#now  calculate token weight for each of the wsdl
token_weight={}
for wsdl in wsdl_object_array:
    token_weight[wsdl.file_name]=extraction.total_token_weight(wsdl,clusters)

html.tokens(token_weight)
示例#26
0
def delete(environ):
  response_body=html.header('Ahoy!')
  response_body+=html.delete()
  response_body+=html.footer()
  return response_body
 def get(self):
     html.header(self)
     html.weekForm(self)
     html.footer(self)
leviTerms = { 
            'Levi': 'Olevsky',
            'Elephant' : 'Big Gray Animal',
            'Mouse' : 'Small Gray Animal',
            'Zebra' : 'Medium Gray Animal',
            'Helen' : 'Ye'
            }
leviTermsList = leviTerms.keys()
#['Levi', 'Helen', 'Mouse', 'Zebra', 'Elephant']

def flipCard(list, dict, term):
    value = dict[term]
    list[list.index(term)] = value
    dict.pop(term)
    dict[value] = term

def flipCardWithTerm(term):
    flipCard(leviTermsList, leviTerms, term)
    
flipCardWithTerm('Levi') 


print '<center>' + html.header('cards'), \
      html.tableTop(), \
      html.oneTable(leviTermsList, leviTerms), \
      html.tableBttm(), \
      html.footer() + '</center>'
      
print queryString.value
示例#29
0
def strategy(environ):
  response_body = html.header('Ahoy!')
  response_body += html.form_new_strategy()
  response_body += html.footer()
  return response_body
示例#30
0
def create_add(connection):
    doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n'
    style = html.Element('<style>', 'sup {color: red}')
    add = html.Element('<html>', str(html.header('Add Person', style) + str(html.add_and_edit('add'))))
    connection.sendall(doctype + str(add))
 def get(self):
     html.header(self)
     cid = int(float(string.lstrip(self.request.path, "edit/contact/")))
     contact = datamodel.Contact.get_by_id(cid)
     html.editContact(self, contact)
     html.footer(self)
示例#32
0
def menu(environ):
  response_body = html.header('Ahoy!')
  response_body += html.menu()
  response_body += html.footer()
  return response_body
示例#33
0
def create_del(book, connection):
    doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n'
    style = html.Element('<style>', 'ul {list-style-type: none; text-align:left;}')
    delete = html.Element('<html>', str(html.header('Delete Person', style) + str(html.delete(book))))
    connection.sendall(doctype + str(delete))
示例#34
0
def main(environ):
  response_body = html.header('Ahoy!', False)
  response_body += html.welcome()
  response_body += html.footer()
  return response_body
示例#35
0
			layerMap[layer]['enabled'] = False
	mergeLayers.append(mergeLayer)
layers.layers[insertPoint:insertPoint] = mergeLayers


mapDir = tempfile.mkdtemp("-buildmap")
os.chdir(mapDir)

tilesDir = config.wwwDirectory + "/tiles"
tempTilesDir = tilesDir + "-" + datetime.datetime.now().strftime("%Y%m%d%H%M%S")
oldTilesDir = tilesDir + "-old"


mapFile = map.header()
tilecacheFile = tilecache.header(tempTilesDir)
htmlFile = html.header()
layersDefFile = ''


generated = []


commands = []
for layer in layers.layers:
	mapLayers = []
	for component in layer['input']:
		sourcePath = findFile(component['file'])
		if sourcePath == None:
			raise Exception("Couldn't find souce file '%s'" % component['file'])
		for sourceLayer in fileLayers(sourcePath):
			match = False
示例#36
0
def user(environ):
  response_body = html.header('Ahoy!', False)
  response_body += html.form_create_new_user()
  response_body += html.footer()
  return response_body