From 30c6b82fd49e387b059a0d670b7e9a66c5bad8a0 Mon Sep 17 00:00:00 2001 From: Cyrille L Date: Tue, 28 Feb 2023 17:26:08 +0100 Subject: [PATCH] updated footer HTML source --- src/var/lib/tyto/program/domain.py | 79 +++++++++++++++++++++++++----- src/var/lib/tyto/program/html.py | 13 ----- src/var/lib/tyto/program/tyto.py | 4 +- src/var/lib/tyto/program/wip.py | 10 ++-- 4 files changed, 73 insertions(+), 33 deletions(-) diff --git a/src/var/lib/tyto/program/domain.py b/src/var/lib/tyto/program/domain.py index 80a257b..be2c8f8 100644 --- a/src/var/lib/tyto/program/domain.py +++ b/src/var/lib/tyto/program/domain.py @@ -17,6 +17,7 @@ #********************************************************************** +from datetime import datetime import os, sys, locale, importlib import logs, db, tyto, html @@ -218,6 +219,26 @@ def create_domain(target): tyto.set_file(db.domain_conf, False, set_f) + # Get creation date + #------------------ + try: domain_date + except: domain_date = datetime.now().year + + ask = '' + try: + ask = input(' ├ Domain creation yeay ? {%s} '%domain_date) + except KeyboardInterrupt: + print('') + logs.out("255", '', True) + + if ask: + if not ask.isdigit(): logs.out("3", ask, True) + domain_date = ask + + set_f = 'domain_date = "%s"'%domain_date + tyto.set_file(db.domain_conf, False, set_f) + + # Get Description domain #----------------------- try: domain_about = db.domain_about @@ -229,6 +250,7 @@ def create_domain(target): except KeyboardInterrupt: print('') logs.out("255", '', True) + if ask: domain_about = ask elif not domain_about: logs.out("255", '', True) if '"' in domain_about: @@ -248,6 +270,7 @@ def create_domain(target): except KeyboardInterrupt: print('') logs.out("255", '', True) + if ask: if len(ask) == 2: domain_lang = ask else: logs.out("3", ask, True) @@ -268,6 +291,7 @@ def create_domain(target): except KeyboardInterrupt: print('') logs.out("255", '', True) + if ask: if not "@" in ask and not "." in ask: logs.out("3", ask, True) domain_mail = ask @@ -288,6 +312,7 @@ def create_domain(target): except KeyboardInterrupt: print('') logs.out("255", '', True) + if ask: domain_tags = ask elif not domain_tags: logs.out("255", '', True) @@ -306,6 +331,7 @@ def create_domain(target): except KeyboardInterrupt: print('') logs.out("255", '', True) + if ask: domain_logo = ask set_f = 'domain_logo = "%s"\n'%domain_logo + \ @@ -326,6 +352,7 @@ def create_domain(target): except KeyboardInterrupt: print('') logs.out("255", '', True) + if ask: domain_license = ask elif not domain_license: logs.out("255", '', True) if '"' in domain_license: @@ -346,6 +373,7 @@ def create_domain(target): except KeyboardInterrupt: print('') logs.out("255", '', True) + if ask: if not ask.startswith('http'): logs.out("3", ask, True) domain_licurl = ask @@ -365,6 +393,7 @@ def create_domain(target): except KeyboardInterrupt: print('') logs.out("255", '', True) + if ask: if not ask.isalnum(): logs.out("3", ask, True) domain_css = ask.lower() @@ -384,6 +413,7 @@ def create_domain(target): except KeyboardInterrupt: print('') logs.out("255", '', True) + if ask: if not len(ask) == 1: logs.out("3", ask, True) domain_sep = ask @@ -403,6 +433,7 @@ def create_domain(target): except KeyboardInterrupt: print('') logs.out("255", '', True) + if ask: if not ask.startswith('http'): logs.out("3", ask, True) domain_relme = ask @@ -422,6 +453,7 @@ def create_domain(target): except KeyboardInterrupt: print('') logs.out("255", '', True) + if ask: sidebar_title = ask if '"' in sidebar_title: sidebar_title = sidebar_title.replace('"', '') @@ -441,6 +473,7 @@ def create_domain(target): except KeyboardInterrupt: print('') logs.out("255", '', True) + if ask: if not ask.isdigit(): logs.out("3", ask, True) elif int(ask) in range(1,17): sidebar_items = int(ask) @@ -763,6 +796,20 @@ def create_footer(option): Tytosrc = '(%s)'%tyto.trans[3][tyto.n] + tyto_show = \ + '%s %s'%(tyto.Tyto, Tytosrc) + + if db.domain_date == datetime.now().year: + footer_date = db.domain_date + else: + footer_date = '%s - %s'%(db.domain_date, datetime.now().year) + + domain_home = \ + '%s'%db.domain_title footer = \ '\n' + \ '' # Create new default file, or ask if exists @@ -818,3 +862,12 @@ def create_footer(option): tyto.set_file(db.footer_load, 'new', footer) tyto.create_db_load(db.footer_load, db.footer_load_db) print(log) + +# +""" + ' \n' + \ +""" diff --git a/src/var/lib/tyto/program/html.py b/src/var/lib/tyto/program/html.py index 768835b..8fbc517 100644 --- a/src/var/lib/tyto/program/html.py +++ b/src/var/lib/tyto/program/html.py @@ -522,16 +522,3 @@ def create_user_footer(option): print(log_load) - - - - -''' - '
  • \n' + \ - ' %s\n'% + \ - '
  • \n' + \ - Copyright © 2021-2022 - -''' diff --git a/src/var/lib/tyto/program/tyto.py b/src/var/lib/tyto/program/tyto.py index 9d007a1..63b359d 100644 --- a/src/var/lib/tyto/program/tyto.py +++ b/src/var/lib/tyto/program/tyto.py @@ -50,7 +50,9 @@ trans = [ ('écrit par', 'written by'), ('Publié le', 'Published the'), #8 date for section HTML (article_infos) ('à', 'at'), #9 time format -('rédigé le', 'created the') +('rédigé le', 'created the'), #10 +('À Propos de', 'About'), #11 +('Générateur :', 'Generator:') ] diff --git a/src/var/lib/tyto/program/wip.py b/src/var/lib/tyto/program/wip.py index 44937d2..e222ed4 100644 --- a/src/var/lib/tyto/program/wip.py +++ b/src/var/lib/tyto/program/wip.py @@ -18,7 +18,7 @@ #********************************************************************** import os, re, shutil -import logs, args, db, tyto, html +import logs, args, db, tyto, html, domain #=========================================# @@ -28,17 +28,15 @@ def manage_wip(target): global post_db, hash_post # Check if can process - if not db.domain_exists \ - or db.incomplete_domain \ - or not db.domain_active: - return + domain.domain_needed() # Target is footer, sidebar, navbar, metas if target in args.pass_targets: do = { 'sidebar' : html.create_sidebar, 'navbar' : html.create_navbar, - 'metas' : html.create_user_metas + 'metas' : html.create_user_metas, + 'footer' : html.create_user_footer } do[target]('wip')