diff --git a/src/usr/bin/tyto b/src/usr/bin/tyto
index ccc8ed9..0409cdd 100755
--- a/src/usr/bin/tyto
+++ b/src/usr/bin/tyto
@@ -44,6 +44,7 @@ target = args.set_target()
# Command start argument
import check, domain, html, new, publish, show, wip, infos
actions = {
+ 'all' : wip.manage_wip,
'check' : check.manage_check,
'help' : infos.tyto,
'edit' : show.manage_show,
@@ -56,8 +57,8 @@ actions = {
'show-db' : show.manage_show,
'show-wip' : show.manage_show,
'show-www' : show.manage_show,
+ 'template' : publish.manage_publish,
'wip' : wip.manage_wip,
- 'all' : wip.manage_wip
}
diff --git a/src/var/lib/tyto/program/args.py b/src/var/lib/tyto/program/args.py
index 409b6c0..11d0c0b 100644
--- a/src/var/lib/tyto/program/args.py
+++ b/src/var/lib/tyto/program/args.py
@@ -66,7 +66,8 @@ pass_targets = \
'footer',
'metas',
'navbar',
- 'sidebar'
+ 'sidebar',
+ 'template'
)
action = ''
diff --git a/src/var/lib/tyto/program/html.py b/src/var/lib/tyto/program/html.py
index 43488ea..900f33c 100644
--- a/src/var/lib/tyto/program/html.py
+++ b/src/var/lib/tyto/program/html.py
@@ -209,11 +209,7 @@ def create_html_infos_section(process):
# Create HTML sidebar from file tyto.sidebar #
#--------------------------------------------#
def create_sidebar(option):
- # Check if can process
- if not db.domain_exists \
- or db.incomplete_domain \
- or not db.domain_active:
- return
+ domain.domain_needed
try:
db.sidebar_load
@@ -314,10 +310,12 @@ def create_sidebar(option):
if not sidebar_new:
# Empty file
if not sidebar_has:
- logs.out('29', '(sidebar): %s'%db.sidebar_load, True)
+ logs.out('29', '(sidebar): %s'%db.sidebar_load, False)
+ return
# Some items, but no one is valid
else:
- logs.out('28', '(sidebar)', True)
+ logs.out('28', '(sidebar)', False)
+ return
# Create HTML complete sidebar
sidebar_temp = sidebar_html%(sidebar_title, sidebar_list)
@@ -331,9 +329,11 @@ def create_sidebar(option):
if sidebar_new:
ask_html = ' ├ Replace %s ? '%target
res = ''
+
if os.path.exists(target):
res = input(ask_html)
- if not res in ['y', 'Y']: return
+ if not res in ['y', 'Y']:
+ logs.out("255", '', True)n
tyto.set_file(target, True, sidebar_content)
logs.out("33", target, False)
@@ -343,7 +343,6 @@ def create_sidebar(option):
# Create HTML menu from root folders #
#------------------------------------#
def create_navbar(option):
- # Check if can process
domain.domain_needed()
try:
@@ -396,12 +395,14 @@ def create_navbar(option):
wip_index = '%s%s/index.html'%(db.srv_wip, direc)
if not os.path.exists(wip_index):
logs.out('26', 'in "%s": %s'%(direc, wip_index), False)
+ continue
else:
index_wip = True
elif option == 'www':
www_index = '%s%s/index.html'%(db.srv_www, direc)
if not os.path.exists(www_index):
logs.out('26', 'in "%s": %s'%(direc, www_index), False)
+ continue
else:
index_www = True
else:
@@ -411,9 +412,6 @@ def create_navbar(option):
logs.out("26", 'in "%s": %s'%(direc, dir_uri), False)
continue
- if not index_wip and option == 'wip': continue
- if not index_www and option == 'www': continue
-
# Add link to HTML structure
navbar_new = True
menu_item = '\n%s
'%(10 * ' ')
menu_html = '%s%s'%(menu_html, menu_item)
- # Close HTML tags
- menu_html = '\n%s\n%s\n%s\n'%(menu_html, 8 * ' ', 6 * ' ')
-
+ # Nothing to do
if not navbar_new:
if not navbar_has:
- logs.out('29', '(navbar): %s'%db.navbar_load, True)
+ logs.out('29', '(navbar): %s'%db.navbar_load, False)
+ return
else:
- logs.out('28', '(navbar)', True)
+ logs.out('28', '(navbar)', False)
+ return
# Create file if sidebar has content
- if navbar_new:
- ask_html = ' ├ Replace %s ? '%target
- res = ''
- if os.path.exists(target):
- try:
- res = input(ask_html)
- except KeyboardInterrupt:
- print('')
- logs.out("255", '', True)
+ ask_html = ' ├ Replace %s ? '%target
+ res = ''
+
+ if os.path.exists(target):
+ try:
+ res = input(ask_html)
+ except KeyboardInterrupt:
+ print('')
+ logs.out("255", '', True)
+ if not res in ['y', 'Y']:
+ logs.out("255", '', True)
- if not res in ['y', 'Y']: return
-
- tyto.set_file(target, True, menu_html)
- print(' ├ Create file: %s'%target)
+ # Close HTML tags
+ menu_html = '\n%s\n%s\n%s\n'%(menu_html, 8 * ' ', 6 * ' ')
+ tyto.set_file(target, True, menu_html)
+ print(' ├ Create file: %s'%target)
#========================================================#
@@ -458,7 +458,6 @@ def create_navbar(option):
# To manage new creation if changes #
#--------------------------------------------------------#
def create_user_metas(option):
- # Check if can process
domain.domain_needed()
if option == 'wip': target = db.wip_navbar
@@ -471,13 +470,15 @@ def create_user_metas(option):
user_metas = ''
metas_used = (' argument all', option)
diff --git a/src/var/lib/tyto/program/tyto.py b/src/var/lib/tyto/program/tyto.py
index 7ae5104..b7f7687 100644
--- a/src/var/lib/tyto/program/tyto.py
+++ b/src/var/lib/tyto/program/tyto.py
@@ -422,43 +422,3 @@ def replace_in_db(post_db, process, hash_post):
file = open(post_db, 'w')
file.write(new_file)
file.close()
-
-
-#================================#
-# Exit from program with message #
-#--------------------------------#
-def exiting(nbr, value, out):
- nbrs = {
- '1' : ':< %sUnused ressource%s: %s'%(CR, CS, value),
- '2' : ':< %sIncomplete data%s: "%s"'%(CR, CS, value),
- '3' : ':< %sInvalid data%s: "%s"'%(CR, CS, value),
- '4' : ':< %sNo database yet%s. Check article first.'%(CR, CS),
- '5' : ':< %sUnused argument%s: [file]'%(CR, CS),
- '6' : ':< %sUnused "%s"%s in article'%(CR, CS, value),
- '7' : ':< Article is %snot valid yet%s'%(CR, CS),
- '8' : ':< %sNot paired%s: %s'%(CR, CS, value),
- '9' : ':< Article %shas changed%s. Check it first'%(CR, CS),
- '10' : ':< %sUnused "%s"%s in article\'s header'%(CR, value, CS),
- '11' : ':< %sUnused argument%s: %s'%(CR, CS, value),
- '20' : ':D %sUp-to-date%s article on: %s'%(CG, CS, value),
- '21' : ':D %sValid%s article. Ready to wip'%(CG, CS),
- '22' : ':? %sNot paired%s symbols: %s'%(CY, CS, value),
- '23' : ':? %sCorrupted database%s: %s'%(CY, CS, value),
- '24' : ':? %sfile missing%s %s'%(CY, CS, value),
- '25' : ':D Add contents %s'%value,
- '26' : ':? %sDeactivated%s "%s" in domain conf'%(CY, CS, value),
- '27' : ':? %sDeleted%s %s'%(CY, CS, value),
- '28' : ':? %sUnused directory%s: %s'%(CY, CS, value),
- '29' : ':? %sEmpty configuration%s %s'%(CY, CS, value),
- '30' : ':? %sArticle is not wip%s: %s'%(CY, CS, value),
- '31' : ':? %sMax items reached%s %s'%(CY, CS, value),
- '32' : ':? %sNo changes%s in: %s'%(CY, CS, value),
- '33' : ':D %sCreated file%s: %s'%(CG, CS, value),
- '255' : ':| Maybe later...'
- }
-
- msg = nbrs[nbr]
- print(msg)
-
- if int(nbr) >= 20: nbr = 0
- if out: sys.exit(int(nbr))