Detabification
darcs-hash:20050510114229-d1718-03688a3123cb0f38be81ef154d26e8a37e50c17d.gz
This commit is contained in:
parent
dbb719a4ef
commit
c2e6db308a
1 changed files with 77 additions and 77 deletions
128
wifiweb/html.py
128
wifiweb/html.py
|
@ -4,98 +4,98 @@
|
||||||
class html :
|
class html :
|
||||||
|
|
||||||
def __init__ (self) :
|
def __init__ (self) :
|
||||||
self._titre = ''
|
self._titre = ''
|
||||||
self._sous_titre = ''
|
self._sous_titre = ''
|
||||||
self._corp = ''
|
self._corp = ''
|
||||||
self._refresh = 0
|
self._refresh = 0
|
||||||
|
|
||||||
def titre(self, titre = None) :
|
def titre(self, titre = None) :
|
||||||
""" Définit ou retourne le titre """
|
""" Définit ou retourne le titre """
|
||||||
if titre != None :
|
if titre != None :
|
||||||
self._titre = titre
|
self._titre = titre
|
||||||
return self._titre
|
return self._titre
|
||||||
|
|
||||||
def sous_titre (self, sous_titre = None) :
|
def sous_titre (self, sous_titre = None) :
|
||||||
""" Définit ou retourne le sous titre """
|
""" Définit ou retourne le sous titre """
|
||||||
if sous_titre != None :
|
if sous_titre != None :
|
||||||
self._sous_titre = sous_titre
|
self._sous_titre = sous_titre
|
||||||
return self._sous_titre
|
return self._sous_titre
|
||||||
|
|
||||||
def refresh (self, refresh = None) :
|
def refresh (self, refresh = None) :
|
||||||
""" Définit ou retourne la durée du refresh """
|
""" Définit ou retourne la durée du refresh """
|
||||||
|
|
||||||
if _refresh != None :
|
if _refresh != None :
|
||||||
self._refresh = _refresh
|
self._refresh = _refresh
|
||||||
return self._refresh
|
return self._refresh
|
||||||
|
|
||||||
def corp (self, corp = None) :
|
def corp (self, corp = None) :
|
||||||
""" Définit ou retourne le contenu du corp """
|
""" Définit ou retourne le contenu du corp """
|
||||||
if corp != None :
|
if corp != None :
|
||||||
self._corp = corp
|
self._corp = corp
|
||||||
return self._corp
|
return self._corp
|
||||||
|
|
||||||
def add (self, string) :
|
def add (self, string) :
|
||||||
""" Ajoute une ligne au corp de la page """
|
""" Ajoute une ligne au corp de la page """
|
||||||
self._corp += string + "\n"
|
self._corp += string + "\n"
|
||||||
|
|
||||||
def make (self) :
|
def make (self) :
|
||||||
""" Génère la page HTML finiale """
|
""" Génère la page HTML finiale """
|
||||||
|
|
||||||
page = ""
|
page = ""
|
||||||
|
|
||||||
page += "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n"
|
page += "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n"
|
||||||
page += "<html lang=\"fr\">\n"
|
page += "<html lang=\"fr\">\n"
|
||||||
|
|
||||||
# en-têtes de la page
|
# en-têtes de la page
|
||||||
#####################
|
#####################
|
||||||
|
|
||||||
page += "<head>\n"
|
page += "<head>\n"
|
||||||
page += " <title>%s</title>\n" % self._titre
|
page += " <title>%s</title>\n" % self._titre
|
||||||
if self._refresh :
|
if self._refresh :
|
||||||
page += " <meta http-equiv=\"refresh\" content=\"%s\">\n" % str(self._refresh)
|
page += " <meta http-equiv=\"refresh\" content=\"%s\">\n" % str(self._refresh)
|
||||||
page += " <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n"
|
page += " <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n"
|
||||||
page += "</head>\n\n"
|
page += "</head>\n\n"
|
||||||
|
|
||||||
# début du corp de la page
|
# début du corp de la page
|
||||||
##########################
|
##########################
|
||||||
|
|
||||||
page += "<body background=\"http://www.crans.org/styles/style2_left.png\" leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" style=\"background-repeat:repeat-y\">\n"
|
page += "<body background=\"http://www.crans.org/styles/style2_left.png\" leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" style=\"background-repeat:repeat-y\">\n"
|
||||||
page += "<img src=\"http://www.crans.org/styles/style2_top.png\" alt=\"En_tete\"><br>\n\n"
|
page += "<img src=\"http://www.crans.org/styles/style2_top.png\" alt=\"En_tete\"><br>\n\n"
|
||||||
|
|
||||||
# division du titre
|
# division du titre
|
||||||
page += "<div id=\"Titre\" style=\"position:absolute; left:580px; top:70px; width:400px;height:34px; z-index:2\">\n"
|
page += "<div id=\"Titre\" style=\"position:absolute; left:580px; top:70px; width:400px;height:34px; z-index:2\">\n"
|
||||||
page += "<font size=\"5\"><b>%s</b></font>\n" % self._titre
|
page += "<font size=\"5\"><b>%s</b></font>\n" % self._titre
|
||||||
page += "</div>\n\n"
|
page += "</div>\n\n"
|
||||||
|
|
||||||
# division du sous titre
|
# division du sous titre
|
||||||
page += "<div id=\"Sous-titre\" style=\"position:absolute; left:380px; top:140px; width:500px;height:34px; z-index:2\">\n"
|
page += "<div id=\"Sous-titre\" style=\"position:absolute; left:380px; top:140px; width:500px;height:34px; z-index:2\">\n"
|
||||||
page += "<font size=\"4\"><u>%s</u></font>\n" % self._sous_titre
|
page += "<font size=\"4\"><u>%s</u></font>\n" % self._sous_titre
|
||||||
page += "</div>\n\n"
|
page += "</div>\n\n"
|
||||||
|
|
||||||
# division du contenu
|
# division du contenu
|
||||||
page += "<div id=\"Contenu\" style=\"position:absolute; left:245px; top:190px; right:16px; z-index:1; overflow: visible; visibility: visible; background-color: #FFFFFF; layer-background-color: #FFFFFF;\">\n"
|
page += "<div id=\"Contenu\" style=\"position:absolute; left:245px; top:190px; right:16px; z-index:1; overflow: visible; visibility: visible; background-color: #FFFFFF; layer-background-color: #FFFFFF;\">\n"
|
||||||
page += self._corp
|
page += self._corp
|
||||||
page += "</div>\n\n"
|
page += "</div>\n\n"
|
||||||
|
|
||||||
# fin de la page
|
# fin de la page
|
||||||
################
|
################
|
||||||
|
|
||||||
page += "</body>\n"
|
page += "</body>\n"
|
||||||
page += "</html>\n"
|
page += "</html>\n"
|
||||||
|
|
||||||
return page
|
return page
|
||||||
|
|
||||||
def sendheaderstobrowser (self) :
|
def sendheaderstobrowser (self) :
|
||||||
""" Envoie les entetes au navigateur """
|
""" Envoie les entetes au navigateur """
|
||||||
print "content-type: text/html"
|
print "content-type: text/html"
|
||||||
print
|
print
|
||||||
|
|
||||||
def sendtobrowser (self) :
|
def sendtobrowser (self) :
|
||||||
""" Envoie la page au navigateur """
|
""" Envoie la page au navigateur """
|
||||||
print self.make()
|
print self.make()
|
||||||
|
|
||||||
def savetofile (self, fichier) :
|
def savetofile (self, fichier) :
|
||||||
""" Enregistre la page dans un fichier """
|
""" Enregistre la page dans un fichier """
|
||||||
f = open(fichier,'w')
|
f = open(fichier,'w')
|
||||||
f.write( self.make() )
|
f.write( self.make() )
|
||||||
f.close()
|
f.close()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue