diff --git a/src/var/lib/tyto/program/html.py b/src/var/lib/tyto/program/html.py index 2d8388e..1cbecac 100644 --- a/src/var/lib/tyto/program/html.py +++ b/src/var/lib/tyto/program/html.py @@ -21,12 +21,13 @@ import os import tyto # Load domain configuration DB -exec(open(tyto.domain_conf).read(),globals()) +exec(open(tyto.domain_conf).read()) Tyto = 'Tyto - Littérateur' tytogit = 'https://git.a-lec.org/echolib/tyto-litterateur' tytoweb = 'https://tyto.echolib.re' +navbar_file = '%snavbar.html'%srv_wip_tpl #==========================# # Load article DB # @@ -134,50 +135,21 @@ def create_main_page(target, article_bottom): '%salt="logo: %s">\n'%(15 * " ", domain_title) + \ '%sid="site_logo_image">\n'%(15 * " ") + \ '%s'%(8 * " ") - - #------------------------------------# - # Create HTML menu from root folders # - #------------------------------------# - menu_html = '' - - # Conditions to create navbar - #---------------------------- - # True in config - if domain_menubar: - # Create folder links (from tyto.navbar) in navbar - try: - nav_file = open(navbar_load, 'r').read() - nav_bar = True - except: - tyto.exiting("1", '(navbar) %s'%navbar_load, False) - nav_bar = False - - if nav_bar: - # Open HTML tags - menu_html = '%s\n'%(menu_html, 8 * ' ', 6 * ' ') + # Check for menu bar + # Delete file if deactivated in conf + if domain_menubar: + if os.path.exists(navbar_file): + tyto.exiting("25", 'menu from: %s'%navbar_file, False) + else: + tyto.exiting("24", '(menu file): %s'%navbar_file, False) + else: + if os.path.exists(navbar_file) and os.stat(navbar_file).st_size > 1: + tyto.set_file(navbar_file, 'new', '') + tyto.exiting("26", 'domain_menubar', False) + tyto.exiting('27', 'contents (menu file): %s'%navbar_file, False) + #-----------------------# # Create main HTML Page # #-----------------------# @@ -200,7 +172,7 @@ def create_main_page(target, article_bottom): ' \n' + \ '
%s
\n'%domain_about + \ ' \n' + \ - '%s'%menu_html + \ + '' + \ ' \n' + \ '\n' + \ '