diff --git a/src/var/lib/tyto/program/domain.py b/src/var/lib/tyto/program/domain.py index be2c8f8..6c7031e 100644 --- a/src/var/lib/tyto/program/domain.py +++ b/src/var/lib/tyto/program/domain.py @@ -21,6 +21,15 @@ from datetime import datetime import os, sys, locale, importlib 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
+#---------------------------------------------------------------------- +domain_footer_about = \ +'Un petit essai' #==========================# # Manage Argument 'domain' # @@ -382,6 +391,46 @@ def create_domain(target): 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 #----------- try: domain_css = db.domain_css @@ -792,7 +841,19 @@ def create_footer(option): tyto.set_file(db.www_footer, 'new', '') print(' ├ Create empty file: %s'%db.www_footer) -# Default footer contents + # 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 Tytosrc = '(%s)'%tyto.trans[3][tyto.n] @@ -801,16 +862,51 @@ def create_footer(option): 'title="%s"'%tyto.trans[5][tyto.n] + \ 'class="footer_item_link">%s %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 else: footer_date = '%s - %s'%(db.domain_date, datetime.now().year) + # Simple link to home domain_home = \ '%s'%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 = \ + '%s'%tyto.trans[16][tyto.n] + + if db.domain_termsurl: + terms_link = \ + '%s'%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 = \ + '