footer: user can add CGU + Legals URL in + fill HTML for website description (variable: domain_footer_about in domain.py)
This commit is contained in:
parent
30c6b82fd4
commit
a2b9f94a52
|
@ -21,6 +21,15 @@ from datetime import datetime
|
||||||
import os, sys, locale, importlib
|
import os, sys, locale, importlib
|
||||||
import logs, db, tyto, html
|
import logs, db, tyto, html
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# Optional
|
||||||
|
# This variable, if not empty, will be used in website footer
|
||||||
|
# and will replace defaut content of domain_about
|
||||||
|
# Put in any HTML you want but,
|
||||||
|
# note: content is already in <p></p>
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
domain_footer_about = \
|
||||||
|
'Un petit essai'
|
||||||
|
|
||||||
#==========================#
|
#==========================#
|
||||||
# Manage Argument 'domain' #
|
# Manage Argument 'domain' #
|
||||||
|
@ -382,6 +391,46 @@ def create_domain(target):
|
||||||
tyto.set_file(db.domain_conf, False, set_f)
|
tyto.set_file(db.domain_conf, False, set_f)
|
||||||
|
|
||||||
|
|
||||||
|
# Legal Notice URL
|
||||||
|
#-----------------
|
||||||
|
try: domain_legalurl = db.domain_legalurl
|
||||||
|
except: domain_legalurl = ''
|
||||||
|
|
||||||
|
ask = ''
|
||||||
|
try:
|
||||||
|
ask = input(' ├ [Optional] Legal Notice URL ? {%s} '%domain_legalurl)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print('')
|
||||||
|
logs.out("255", '', True)
|
||||||
|
|
||||||
|
if ask:
|
||||||
|
if not ask.startswith('http'): logs.out("3", ask, True)
|
||||||
|
domain_legalurl = ask
|
||||||
|
|
||||||
|
set_f = 'domain_legalurl = "%s"'%domain_legalurl
|
||||||
|
tyto.set_file(db.domain_conf, False, set_f)
|
||||||
|
|
||||||
|
|
||||||
|
# Terms URL
|
||||||
|
#-----------------
|
||||||
|
try: domain_termsurl = db.domain_termsurl
|
||||||
|
except: domain_termsurl = ''
|
||||||
|
|
||||||
|
ask = ''
|
||||||
|
try:
|
||||||
|
ask = input(' ├ [Optional] Terms of Use URL ? {%s} '%domain_termsurl)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print('')
|
||||||
|
logs.out("255", '', True)
|
||||||
|
|
||||||
|
if ask:
|
||||||
|
if not ask.startswith('http'): logs.out("3", ask, True)
|
||||||
|
domain_legalurl = ask
|
||||||
|
|
||||||
|
set_f = 'domain_termsurl = "%s"'%domain_termsurl
|
||||||
|
tyto.set_file(db.domain_conf, False, set_f)
|
||||||
|
|
||||||
|
|
||||||
# CSS Prefix
|
# CSS Prefix
|
||||||
#-----------
|
#-----------
|
||||||
try: domain_css = db.domain_css
|
try: domain_css = db.domain_css
|
||||||
|
@ -792,6 +841,18 @@ def create_footer(option):
|
||||||
tyto.set_file(db.www_footer, 'new', '')
|
tyto.set_file(db.www_footer, 'new', '')
|
||||||
print(' ├ Create empty file: %s'%db.www_footer)
|
print(' ├ Create empty file: %s'%db.www_footer)
|
||||||
|
|
||||||
|
# Create new default file, or ask if exists
|
||||||
|
ask = ' ├ Reset footer configuration file ? '
|
||||||
|
log = ' ├ Create source file: %s'%db.footer_load
|
||||||
|
res = ''
|
||||||
|
if os.path.exists(db.footer_load):
|
||||||
|
try:
|
||||||
|
res = input(ask)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print('')
|
||||||
|
logs.out("255", '', True)
|
||||||
|
if not res in ['y', 'Y']: return
|
||||||
|
|
||||||
# Default footer contents
|
# Default footer contents
|
||||||
Tytosrc = '(<a href="%s" '%tyto.Tytogit + \
|
Tytosrc = '(<a href="%s" '%tyto.Tytogit + \
|
||||||
'title="%s" '%tyto.trans[4][tyto.n] + \
|
'title="%s" '%tyto.trans[4][tyto.n] + \
|
||||||
|
@ -801,16 +862,51 @@ def create_footer(option):
|
||||||
'title="%s"'%tyto.trans[5][tyto.n] + \
|
'title="%s"'%tyto.trans[5][tyto.n] + \
|
||||||
'class="footer_item_link">%s</a> %s'%(tyto.Tyto, Tytosrc)
|
'class="footer_item_link">%s</a> %s'%(tyto.Tyto, Tytosrc)
|
||||||
|
|
||||||
if db.domain_date == datetime.now().year:
|
# Show copyright date from creation to now year
|
||||||
|
print(db.domain_date, datetime.now().year)
|
||||||
|
if int(db.domain_date) == int(datetime.now().year):
|
||||||
footer_date = db.domain_date
|
footer_date = db.domain_date
|
||||||
else:
|
else:
|
||||||
footer_date = '%s - %s'%(db.domain_date, datetime.now().year)
|
footer_date = '%s - %s'%(db.domain_date, datetime.now().year)
|
||||||
|
|
||||||
|
# Simple link to home
|
||||||
domain_home = \
|
domain_home = \
|
||||||
'<a href="/" ' + \
|
'<a href="/" ' + \
|
||||||
'title="%s" '%(tyto.trans[1][tyto.n]) + \
|
'title="%s" '%(tyto.trans[1][tyto.n]) + \
|
||||||
'id="footer_title_link">%s</a>'%db.domain_title
|
'id="footer_title_link">%s</a>'%db.domain_title
|
||||||
|
|
||||||
|
# Show domain_HTML_about (if not empty), else domain_about
|
||||||
|
if domain_footer_about: db.domain_about = domain_footer_about
|
||||||
|
|
||||||
|
# Links for laws (Terms and legals)
|
||||||
|
if db.domain_legalurl:
|
||||||
|
legal_link = \
|
||||||
|
'<a href="%s" '%db.domain_termsurl + \
|
||||||
|
'title="%s %s" '%(tyto.trans[16][tyto.n], db.domain_title) + \
|
||||||
|
'class="footer_item_link">%s</a>'%tyto.trans[16][tyto.n]
|
||||||
|
|
||||||
|
if db.domain_termsurl:
|
||||||
|
terms_link = \
|
||||||
|
'<a href="%s" '%db.domain_legalurl + \
|
||||||
|
'title="%s %s" '%(tyto.trans[17][tyto.n], db.domain_title) + \
|
||||||
|
'class="footer_item_link">%s</a>'%tyto.trans[15][tyto.n]
|
||||||
|
|
||||||
|
footer_law = ''
|
||||||
|
if db.domain_termsurl and db.domain_legalurl:
|
||||||
|
footer_law = '%s - %s'%(legal_link, terms_link)
|
||||||
|
elif db.domain_termsurl:
|
||||||
|
footer_law = terms_link
|
||||||
|
elif db.domain_legalurl:
|
||||||
|
footer_law = legal_link
|
||||||
|
|
||||||
|
footer_law_link = ''
|
||||||
|
if footer_law:
|
||||||
|
footer_law_link = \
|
||||||
|
' <li class="footer_item">%s: \n'%(tyto.trans[18][tyto.n]) + \
|
||||||
|
' %s\n'%footer_law + \
|
||||||
|
' </li>\n'
|
||||||
|
|
||||||
|
# Final HTML footer code
|
||||||
footer = \
|
footer = \
|
||||||
'<!-- Default <footer> generated by %s\n'%tyto.Tyto + \
|
'<!-- Default <footer> generated by %s\n'%tyto.Tyto + \
|
||||||
' file: /articles/_configs/tyto.footer.html\n' + \
|
' file: /articles/_configs/tyto.footer.html\n' + \
|
||||||
|
@ -831,6 +927,7 @@ def create_footer(option):
|
||||||
'\n' + \
|
'\n' + \
|
||||||
' <div id="footer_references">\n' + \
|
' <div id="footer_references">\n' + \
|
||||||
' <ul class="footer_items">\n' + \
|
' <ul class="footer_items">\n' + \
|
||||||
|
'%s'%footer_law_link + \
|
||||||
' <li class="footer_item">%s \n'%(tyto.trans[2][tyto.n]) + \
|
' <li class="footer_item">%s \n'%(tyto.trans[2][tyto.n]) + \
|
||||||
' <a href="%s"\n'%db.domain_licurl + \
|
' <a href="%s"\n'%db.domain_licurl + \
|
||||||
' title="%s %s %s"\n'%(
|
' title="%s %s %s"\n'%(
|
||||||
|
@ -839,35 +936,32 @@ def create_footer(option):
|
||||||
' class="footer_item_link">%s</a>\n'%(
|
' class="footer_item_link">%s</a>\n'%(
|
||||||
db.domain_license) + \
|
db.domain_license) + \
|
||||||
' </li>\n' + \
|
' </li>\n' + \
|
||||||
|
' <li class="footer_item">Contact\n' + \
|
||||||
|
' <a href="mailto:%s"\n'%db.domain_mail + \
|
||||||
|
' title="%s %s"\n'%(
|
||||||
|
tyto.trans[13][tyto.n], db.domain_title
|
||||||
|
) + \
|
||||||
|
' class="footer_item_link">%s</a>\n'%(
|
||||||
|
tyto.trans[14][tyto.n]
|
||||||
|
) + \
|
||||||
|
' </li>\n' + \
|
||||||
' </ul>\n' + \
|
' </ul>\n' + \
|
||||||
' </div>\n' + \
|
' </div>\n' + \
|
||||||
' <div id="footer_cr">\n' + \
|
' <div id="footer_credits">\n' + \
|
||||||
' <p>Copyright: %s</p>\n'%footer_date + \
|
' <p>Copyright: %s %s</p>\n'%(footer_date, db.domain_title) + \
|
||||||
' <p>%s %s</p>\n'%(tyto.trans[12][tyto.n], tyto_show) + \
|
' <p>%s %s</p>\n'%(tyto.trans[12][tyto.n], tyto_show) + \
|
||||||
' </div>\n' + \
|
' </div>\n' + \
|
||||||
'</footer>'
|
'</footer>'
|
||||||
|
|
||||||
# Create new default file, or ask if exists
|
|
||||||
ask = ' ├ Reset footer configuration file ? '
|
|
||||||
log = ' ├ Create source file: %s'%db.footer_load
|
|
||||||
res = ''
|
|
||||||
if os.path.exists(db.footer_load):
|
|
||||||
try:
|
|
||||||
res = input(ask)
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
print('')
|
|
||||||
logs.out("255", '', True)
|
|
||||||
if not res in ['y', 'Y']: return
|
|
||||||
|
|
||||||
tyto.set_file(db.footer_load, 'new', footer)
|
tyto.set_file(db.footer_load, 'new', footer)
|
||||||
tyto.create_db_load(db.footer_load, db.footer_load_db)
|
tyto.create_db_load(db.footer_load, db.footer_load_db)
|
||||||
print(log)
|
print(log)
|
||||||
|
|
||||||
#
|
# Generic HTML list in footer
|
||||||
"""
|
"""
|
||||||
' <li class="footer_item">\n' + \
|
' <li class="footer_item">\n' + \
|
||||||
' <a href="%s"\n'%tyto.Tytoweb + \
|
' <a href="%s"\n'% + \
|
||||||
' title="%s"\n'%tyto.trans[5][tyto.n] + \
|
' title="%s"\n'% + \
|
||||||
' class="footer_item_link">%s</a> %s\n'%(tyto.Tyto, Tytosrc) + \
|
' class="footer_item_link">%s</a> %s\n'%() + \
|
||||||
' </li>\n' + \
|
' </li>\n'
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -43,16 +43,22 @@ trans = [
|
||||||
('À l\'affiche !', 'Featured !'), # 0
|
('À l\'affiche !', 'Featured !'), # 0
|
||||||
('Accueil', 'Home'), # 1
|
('Accueil', 'Home'), # 1
|
||||||
('Licence', 'License'), # 2
|
('Licence', 'License'), # 2
|
||||||
('Code source', 'Source code'),
|
('Code source', 'Source code'), # 3
|
||||||
('Dépôt officiel du code source de %s'%Tyto , '%s\'s official source code repository'%Tyto),
|
('Dépôt officiel du code source de %s'%Tyto , '%s\'s official source code repository'%Tyto),
|
||||||
('Site web officiel du logiciel libre %s'%Tyto, '%s\'s official website'),
|
('Site web officiel du logiciel libre %s'%Tyto, '%s\'s official website'),
|
||||||
('L\'article', 'The article'),
|
('L\'article', 'The article'), # 6
|
||||||
('écrit par', 'written by'),
|
('écrit par', 'written by'), # 7
|
||||||
('Publié le', 'Published the'), # 8 date for section HTML (article_infos)
|
('Publié le', 'Published the'), # 8 date for section HTML (article_infos)
|
||||||
('à', 'at'), # 9 time format
|
('à', 'at'), # 9 time format
|
||||||
('rédigé le', 'created the'), # 10
|
('rédigé le', 'created the'), # 10
|
||||||
('À Propos de', 'About'), # 11
|
('À Propos de', 'About'), # 11
|
||||||
('Générateur :', 'Generator:')
|
('Générateur :', 'Generator:'), # 12
|
||||||
|
('Contacter par courriel', 'Contact by mail'), # 13
|
||||||
|
('Courriel', 'Mail'), # 14
|
||||||
|
('C.G.U.', 'T.O.U'), # 15
|
||||||
|
('Mentions légales', 'Legal Notice'), # 16
|
||||||
|
('Conditions Générales d\'Utilisation', 'Terms of Use'), # 17
|
||||||
|
('Loi', 'Law') # 18
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue