diff --git a/cgi-bin/scenar.py b/cgi-bin/scenar.py index a9723b0..13349bf 100755 --- a/cgi-bin/scenar.py +++ b/cgi-bin/scenar.py @@ -511,104 +511,7 @@ elif step == '2' and file_item is not None and file_item.filename: if data.empty: render_error("Načtená data jsou prázdná nebo obsahují neplatné hodnoty. Zkontrolujte vstupní soubor.") else: - # Extract program types - program_types = sorted([str(t).strip() for t in data["Typ"].dropna().unique()]) - file_content_base64 = base64.b64encode(file_content).decode('utf-8') - - print(''' - - - -Scenar Creator - Typy programu - - - -
-

Typy programu

-

Vyplň popis a barvu pro každý typ programu:

-
- - - - -''') - - for i, typ in enumerate(program_types, start=0): - print(f'''
- - - - -
''') - - print('''
- - -
- -
-
- -''') - - except ValidationError as e: - render_error(f"Chyba validace: {str(e)}") - except (TemplateError, ScenarsError) as e: - render_error(f"Chyba: {str(e)}") - except Exception as e: - logger.error(f"Unexpected error: {str(e)}") - render_error(f"Neočekávaná chyba: {str(e)}") - -elif step == '2b': - """Load Excel data into inline editor for editing.""" - try: - # Get file content from either file upload or base64 - file_content = None - if file_item is not None and file_item.filename: - file_content = file_item.file.read() - else: - file_content_base64 = form.getvalue('file_content_base64', '') - if file_content_base64: - file_content = base64.b64decode(file_content_base64) - - if not file_content: - render_error("Chyba: Soubor nebyl nalezen.") - else: - file_size = len(file_content) - - # Validate inputs - validate_inputs(title, detail, file_size) - - # Read Excel - data, error_rows = read_excel(file_content, show_debug) - - if data.empty: - render_error("Načtená data jsou prázdná nebo obsahují neplatné hodnoty. Zkontrolujte vstupní soubor.") - else: + # Instead of showing type selection form, go directly to inline editor (step 2b) # Extract program types and prepare for inline editor program_types = sorted([str(t).strip() for t in data["Typ"].dropna().unique()]) @@ -632,9 +535,12 @@ textarea { resize: vertical; min-height: 80px; } button { padding: 10px 20px; background: #007BFF; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 14px; } button:hover { background: #0056b3; } +button.danger { background: #dc3545; } +button.danger:hover { background: #c82333; } table { width: 100%; border-collapse: collapse; margin-bottom: 20px; } th, td { border: 1px solid #ddd; padding: 8px; text-align: left; } th { background: #f0f0f0; } +.type-def { margin-bottom: 15px; padding: 10px; background: #f9f9f9; border-left: 3px solid #007BFF; } @@ -701,7 +607,7 @@ th { background: #f0f0f0; } - + ''') @@ -714,24 +620,29 @@ th { background: #f0f0f0; }
-

Typy programu

+

Typy programu (nastavení barev a popisů)

''') # Load type definitions type_counter = 0 for type_name in program_types: - print(f'''
- - - - + print(f'''
+ + +
''') type_counter += 1 print('''
- +
@@ -744,6 +655,8 @@ th { background: #f0f0f0; }