<?php
echo "<!-- inc.editpages.php -->\n";
?>
<!-- Flag Icons CSS per le bandiere SVG -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/lipis/flag-icons@7.2.3/css/flag-icons.min.css" />
<?php

// Parametri
if(!isset($id_sezione_sel)) $id_sezione_sel = isset($_POST['id_sezione_sel']) ? (int)$_POST['id_sezione_sel'] : 0;
if(!isset($id_area_sel)) $id_area_sel = isset($_POST['id_area_sel']) ? (int)$_POST['id_area_sel'] : 0;

// Gestione eliminazione area
if(isset($_POST['action_delete_area']) && $_POST['action_delete_area'] == '1') {
    $id_area_delete = isset($_POST['id_area_delete']) ? (int)$_POST['id_area_delete'] : 0;
    
    if($id_area_delete > 0) {
        // Elimina prima l'associazione sezione-area
        $sql = "DELETE FROM t_sez_aree WHERE id_area = {$id_area_delete}";
        $mydb->ExecSql($sql);
        
        // Elimina i testi associati all'area
        $sql = "DELETE FROM t_testi WHERE id_area = {$id_area_delete}";
        $mydb->ExecSql($sql);
        
        // Elimina l'area
        $sql = "DELETE FROM t_aree WHERE id_area = {$id_area_delete}";
        $mydb->ExecSql($sql);
        
        echo "<div class='boxok' style='margin:20px 0; padding:15px; background:#d4edda; border:2px solid #28a745; border-radius:5px;'>";
        echo "✓ Area eliminata con successo!";
        echo "</div>";
    }
}

if($isubsezione == 0) 
{
    // Lista delle sezioni (pagine) pubbliche
    $condEditabile = "AND editabile <= 1";
        if($_level > $OPERLEVEL) {
        $condEditabile = "";
    }
    $sql = "SELECT * FROM t_sezioni WHERE visibility='public' $condEditabile ORDER BY ordine_menu ASC, nome ASC";
    $sezioni = $mydb->DoSelect($sql);
    ?>

    <div style="margin-bottom:20px;">
        <h2>📄 Gestione Pagine del Sito</h2>
        <p>Seleziona una pagina per modificarne i contenuti (aree).</p>
    </div>

    <form name="frmpages" method="post" action="<?=$action?>">
        <input type="hidden" name="MSID" value="<?=$MSID?>" />
        <input type="hidden" name="sezione" value="cms,1" />
        <input type="hidden" name="tab" value="0" />
        <input type="hidden" name="id_sezione_sel" value="" />

        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="labels-table">
            <thead>
                <tr>
                    <th width="5%">ID</th>
                    <th width="30%">Nome Pagina</th>
                    <th width="30%">Titolo</th>
                    <th width="20%">Alias</th>
                    <th width="15%">Azioni</th>
                </tr>
            </thead>
            <tbody>
                <?php
                if(!is_array($sezioni) || count($sezioni) == 0) {
                    echo '<tr><td colspan="5" align="center" style="padding:40px;">📝 Nessuna pagina pubblica presente.</td></tr>';
                } else {
                    foreach($sezioni as $sez) {
                        $id_sezione = $sez['id_sezione'];
                        $nome = htmlspecialchars($sez['nome'] ?? '');
                        $titolo = htmlspecialchars($sez['titolo'] ?? '');
                        $alias = htmlspecialchars($sez['alias'] ?? '');
                        $editabile = $sez['editabile'] ?? 1;
                        
                        // Evidenzia le pagine riservate agli admin
                        $bg_admin = ($editabile > 1 && $_level > $OPERLEVEL) ? 'background:#fff8e1;' : '';
                ?>
                <tr class="label-row" style="<?=$bg_admin?>">
                    <td class="label-id"><?=$id_sezione?></td>
                    <td class="label-value"><strong><?=$nome?></strong></td>
                    <td class="label-name"><?=$titolo?></td>
                    <td class="label-desc"><?=$alias?></td>
                    <td class="label-actions">
                        <button type="button" class="btn-translate" 
                                onclick="document.frmpages.id_sezione_sel.value='<?=$id_sezione?>'; document.frmpages.submit();" 
                                title="Modifica contenuti">
                            <svg class="btn-icon" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
                                <path d="M4.5 11H5.914L12.5 4.414L11.086 3L4.5 9.586V11ZM13.207 3.707L12.293 2.793C11.902 2.402 11.269 2.402 10.878 2.793L10.086 3.586L11.5 5L12.293 4.207C12.684 3.816 12.684 3.183 12.293 2.793L13.207 3.707Z" fill="currentColor"/>
                                <path d="M2 13.5C2 13.776 2.224 14 2.5 14H13.5C13.776 14 14 13.776 14 13.5V7.5C14 7.224 13.776 7 13.5 7H11V8H13V13H3V8H5V7H2.5C2.224 7 2 7.224 2 7.5V13.5Z" fill="currentColor"/>
                            </svg>
                            <span class="translate-text">Modifica Aree</span>
                        </button>
                    </td>
                </tr>
                <?php
                    }
                }
                ?>
            </tbody>
        </table>
    </form>

    <?php
}
elseif($isubsezione == 1) 
{
    // Mostra le aree associate alla sezione selezionata
    if($id_sezione_sel == 0) {
        echo "<div class='boxerr'>Seleziona una pagina!</div>";
        return;
    }

    // Carica info sezione
    $sql = "SELECT * FROM t_sezioni WHERE id_sezione={$id_sezione_sel}";
    $mydb->DoSelect($sql);
    $sezione_info = $mydb->GetRow();
    
    if(!$sezione_info) {
        echo "<div class='boxerr'>Pagina non trovata!</div>";
        return;
    }

    // Carica aree associate
    $condEditabile = "AND a.editabile <= 1 AND a.visibile = '1' ";
    if($_level > $OPERLEVEL) {
        $condEditabile = "";
    }
    $sql = "SELECT a.*, sa.ordine, sa.container 
            FROM t_aree a
            INNER JOIN t_sez_aree sa ON a.id_area = sa.id_area
            WHERE sa.id_sezione = {$id_sezione_sel} $condEditabile
            AND a.nome NOT LIKE '\_%'
            ORDER BY sa.container ASC, sa.ordine ASC";
    $a_areeList = $mydb->DoSelect($sql);
    #echo "<pre>"; var_dump($aree); echo "</pre>"; die();
    
    ?>

    <div style="margin-bottom:20px;">
        <h2>📦 Aree della Pagina: <strong><?=$sezione_info['nome'] ?? ''?></strong></h2>
        <p><strong>Titolo:</strong> <?=mydecodeTxt($sezione_info['titolo'] ?? '')?></p>
        <p><strong>Alias:</strong> <?=$sezione_info['alias'] ?? ''?></p>
        <hr>
        <p>Seleziona un'area per modificarne i contenuti.</p>
    </div>

    <form name="frmback" method="post" action="<?=$action?>">
        <input type="hidden" name="MSID" value="<?=$MSID?>" />
        <input type="hidden" name="sezione" value="cms" />
        <input type="hidden" name="tab" value="0" />
        
        <div class="button buttonrev" onclick="document.frmback.submit();" style="display:inline-block; margin-bottom:20px;">
            <div style="padding-top:4px;">← Torna alle Pagine</div>
        </div>
    </form>

    <form name="frmareas" method="post" action="<?=$action?>">
        <input type="hidden" name="MSID" value="<?=$MSID?>" />
        <input type="hidden" name="sezione" value="cms,2" />
        <input type="hidden" name="tab" value="0" />
        <input type="hidden" name="id_sezione_sel" value="<?=$id_sezione_sel?>" />
        <input type="hidden" name="id_area_sel" value="" />

        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="labels-table">
            <thead>
                <tr>
                    <th width="5%">ID</th>
                    <th width="25%">Area</th>
                    <? if($_level > $OPERLEVEL) { ?>
                    <th width="25%">Nome Area</th>
                    <? } ?>
                    <th width="20%">Tipo</th>
                    <th width="15%">Container</th>
                    <th width="10%">Ordine</th>
                    <th width="10%">Visibile</th>
                    <th width="15%">Azioni</th>
                </tr>
            </thead>
            <tbody>
                <?php
                if(!is_array($a_areeList) || count($a_areeList) == 0) {
                    echo '<tr><td colspan="7" align="center" style="padding:40px;">📝 Nessuna area associata a questa pagina.</td></tr>';
                } else {
                    foreach($a_areeList as $area_) {
                        

                        $id_area = $area_['id_area'];
                        $area = mydecodeTxt($area_['des'] ?? '');
                        $nome = $area_['nome'] ?? '';
                        $tipo = $area_['tipo'] ?? '';
                        $container = $area_['container'] ?? '';
                        $ordine = isset($area_['ordine']) ? $area_['ordine'] : 0;
                        $editabile = $area_['editabile'] ?? 1;
                        $visibile = (isset($area_['visibile']) && $area_['visibile'] == '1') ? '✓ Sì' : '✗ No';
                        $visibile_class = (isset($area_['visibile']) && $area_['visibile'] == '1') ? 'color:green;' : 'color:red;';
                        
                        // Evidenzia le aree riservate agli admin
                        $bg_admin = (($editabile > 1 || $area_['visibile'] != '1') && $_level > $OPERLEVEL) ? 'background:#fff8e1;' : '';
                ?>
                <tr class="label-row" style="<?=$bg_admin?>">
                    <td class="label-id"><?=$id_area?></td>
                    <td class="label-value"><strong><?=$area ?? ''?></strong></td>
                    <? if($_level > $OPERLEVEL) { ?>
                    <td class="label-value"><?=$nome ?? ''?></td>
                    <? } ?>
                    <td class="label-name"><?=$tipo ?? ''?></td>
                    <td class="label-desc"><?=$container ?? ''?></td>
                    <td style="text-align:center;"><?=$ordine ?? ''?></td>
                    <td style="text-align:center; <?=$visibile_class?>"><?=$visibile ?? ''?></td>
                    <td class="label-actions">
                        <button type="button" class="btn-translate" 
                                onclick="document.frmareas.id_area_sel.value='<?=$id_area?>'; document.frmareas.submit();" 
                                title="Modifica contenuti">
                            <svg class="btn-icon" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
                                <path d="M4.5 11H5.914L12.5 4.414L11.086 3L4.5 9.586V11ZM13.207 3.707L12.293 2.793C11.902 2.402 11.269 2.402 10.878 2.793L10.086 3.586L11.5 5L12.293 4.207C12.684 3.816 12.684 3.183 12.293 2.793L13.207 3.707Z" fill="currentColor"/>
                                <path d="M2 13.5C2 13.776 2.224 14 2.5 14H13.5C13.776 14 14 13.776 14 13.5V7.5C14 7.224 13.776 7 13.5 7H11V8H13V13H3V8H5V7H2.5C2.224 7 2 7.224 2 7.5V13.5Z" fill="currentColor"/>
                            </svg>
                            <span class="translate-text">Modifica Testi</span>
                        </button>
                        <?php if($_level > $OPERLEVEL) { ?>
                            <button type="button" class="btn-delete" 
                                    onclick="if(confirm('Sei sicuro di voler eliminare l\'area \'<?=addslashes($nome)?>\'?\n\nVerranno eliminati anche tutti i testi associati!')) { deleteArea(<?=$id_area?>); }" 
                                    title="Elimina area"
                                    style="background:#ffffff; margin-left:5px;">
                                <svg class="btn-icon" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
                                    <path d="M6 2V3H2V4H3V13C3 13.55 3.45 14 4 14H12C12.55 14 13 13.55 13 13V4H14V3H10V2H6ZM4 4H12V13H4V4ZM6 6V11H7V6H6ZM9 6V11H10V6H9Z" fill="currentColor"/>
                                </svg>
                                <span class="translate-text">Elimina</span>
                            </button>
                        <?php } ?>
                    </td>
                </tr>
                <?php
                
                    }
                }
                ?>
            </tbody>
        </table>
    </form>

    <!-- Form per eliminazione area -->
    <form name="frmdeletearea" method="post" action="<?=$action?>" style="display:none;">
        <input type="hidden" name="MSID" value="<?=$MSID?>" />
        <input type="hidden" name="sezione" value="cms,1" />
        <input type="hidden" name="tab" value="0" />
        <input type="hidden" name="id_sezione_sel" value="<?=$id_sezione_sel?>" />
        <input type="hidden" name="action_delete_area" value="1" />
        <input type="hidden" name="id_area_delete" value="" />
    </form>

    <script>
    function deleteArea(id_area) {
        document.frmdeletearea.id_area_delete.value = id_area;
        document.frmdeletearea.submit();
    }
    </script>

    <?php
}
elseif($isubsezione == 2) 
{
    // Editor dei testi dell'area selezionata
    if($id_area_sel == 0) {
        echo "<div class='boxerr'>Seleziona un'area!</div>";
        return;
    }
    
    // Carica info area
    $sql = "SELECT * FROM t_aree WHERE id_area={$id_area_sel}";
    $mydb->DoSelect($sql);
    $area_info = $mydb->GetRow();
    
    if(!$area_info) {
        echo "<div class='boxerr'>Area non trovata!</div>";
        return;
    }
    
    // Carica info sezione
    $sql = "SELECT * FROM t_sezioni WHERE id_sezione={$id_sezione_sel}";
    $mydb->DoSelect($sql);
    $sezione_info = $mydb->GetRow();
    
    // Parse dei parametri per capire il tipo di editor
    $params = $area_info['params'] ?? '';
    $editor_mode = 0; // Default: textarea semplice
    if($params != '') {
        parse_str(str_replace('&', '&', $params), $params_array);
        $editor_mode = isset($params_array['editor_mode']) ? (int)$params_array['editor_mode'] : 0;
    }
    
    $tipo = $area_info['tipo'];
    $nome = $area_info['nome'];
    $des = $area_info['des'];
    
    // Determina tipo editor (logica invertita: 0=visuale, 1=testuale)
    $use_visual_editor = ($tipo != 'txt' && $editor_mode == 0);
    
    // Carica i testi esistenti per tutte le lingue
    $testi_lingue = array();
    $sql = "SELECT lang, testo FROM t_testi WHERE id_area={$id_area_sel}";
    $res_lingue = $mydb->DoSelect($sql);
    if(is_array($res_lingue)) {
        foreach($res_lingue as $row_lang) {
            $testi_lingue[$row_lang['lang']] = $row_lang['testo'];  
        }
    }
    
    // Gestione salvataggio
    if(isset($_POST['azione']) && $_POST['azione'] == 'salva_testi') {
        foreach($_vlanguage as $idx => $lang_code) {
            if($_vlanguage_enabled[$idx] == '1') {
                $testo = isset($_POST['testo_'.$lang_code]) ? $_POST['testo_'.$lang_code] : '';
                
                // Aggiungi gli shortcode di apertura e chiusura
                if($testo != '') {
                    $testo = '//@{@//' . $testo . '//@}@//';
                }
                
                // Verifica se esiste già
                $sql_check = "SELECT COUNT(*) as cnt FROM t_testi WHERE id_area={$id_area_sel} AND lang='{$lang_code}'";
                $mydb->DoSelect($sql_check);
                $check = $mydb->GetRow();
                
                if($check['cnt'] > 0) {
                    // UPDATE
                    $testo_escaped = $mydb->myaddslashes($testo);
                    $sql = "UPDATE t_testi SET testo='{$testo_escaped}' WHERE id_area={$id_area_sel} AND lang='{$lang_code}'";
                } else {
                    // INSERT
                    $testo_escaped = $mydb->myaddslashes($testo);
                    $sql = "INSERT INTO t_testi (id_area, lang, testo) VALUES ({$id_area_sel}, '{$lang_code}', '{$testo_escaped}')";
                }
                $mydb->ExecSql($sql);
            }
        }
        
        echo "<div class='boxok' style='margin:20px 0; padding:15px; background:#d4edda; border:2px solid #28a745; border-radius:5px;'>";
        echo "✓ Testi salvati con successo!";
        echo "</div>";
        
        // Ricarica i testi
        $testi_lingue = array();
        $sql = "SELECT lang, testo FROM t_testi WHERE id_area={$id_area_sel}";
        $res_lingue = $mydb->DoSelect($sql);
        if(is_array($res_lingue)) {
            foreach($res_lingue as $row_lang) {
                $testi_lingue[$row_lang['lang']] = $row_lang['testo'];
            }
        }
    }
    
    ?>

    <div style="margin-bottom:20px;">
        <h2>✏️ Modifica Contenuti Area: <strong><?=htmlspecialchars($nome)?></strong></h2>
        <p><strong>Pagina:</strong> <?=htmlspecialchars($sezione_info['nome'] ?? '')?></p>
        <p><strong>Descrizione Area:</strong> <?=htmlspecialchars($des)?></p>
        <p><strong>Tipo:</strong> <?=htmlspecialchars($tipo)?> 
            <?php if($use_visual_editor) { ?>
                <span style="color:#28a745;">● Editor Visuale</span>
            <?php } else { ?>
                <span style="color:#666;">● Editor Testuale</span>
            <?php } ?>
        </p>
    </div>

    <form name="frmback2" method="post" action="<?=$action?>">
        <input type="hidden" name="MSID" value="<?=$MSID?>" />
        <input type="hidden" name="sezione" value="cms,1" />
        <input type="hidden" name="tab" value="0" />
        <input type="hidden" name="id_sezione_sel" value="<?=$id_sezione_sel?>" />
        
        <div class="button buttonrev" onclick="document.frmback2.submit();" style="display:inline-block; margin-bottom:20px;">
            <div style="padding-top:4px;">← Torna alle Aree</div>
        </div>
    </form>

    <!-- Form di modifica testi -->
    <form name="frmtesti" method="post" action="<?=$action?>">
        <input type="hidden" name="MSID" value="<?=$MSID?>" />
        <input type="hidden" name="sezione" value="cms,2" />
        <input type="hidden" name="tab" value="0" />
        <input type="hidden" name="id_sezione_sel" value="<?=$id_sezione_sel?>" />
        <input type="hidden" name="id_area_sel" value="<?=$id_area_sel?>" />
        <input type="hidden" name="azione" value="salva_testi" />
        
        <?php if($use_visual_editor) { ?>
        <!-- TinyMCE 4.16 Offline -->
        <script src="<?=$extincpath_http?>/contents/tinymce416/tinymce/js/tinymce/tinymce.min.js"></script>
        <?php } ?>
        
        <div style="display:flex; flex-direction:column; gap:20px; max-width:100%;">
            <?php 
            // Mappa codici lingua a flag-icons
            $flags = array(
                'it' => 'it',
                'en' => 'gb',
                'fr' => 'fr',
                'es' => 'es',
                'de' => 'de'
            );
            
            foreach($_vlanguage as $idx => $lang_code) {
                if($_vlanguage_enabled[$idx] == '1') {
                    $flag = isset($flags[$lang_code]) ? $flags[$lang_code] : $lang_code;
                    $testo_value = isset($testi_lingue[$lang_code]) ? $testi_lingue[$lang_code] : '';
                    
                    // Rimuovi gli shortcode (anche multipli)
                    if($testo_value != "") {
                        // Rimuovi tutti gli shortcode //@{@// e //@}@//
                        $testo_value = str_replace('//@{@//', '', $testo_value);
                        $testo_value = str_replace('//@}@//', '', $testo_value);
                        // Decodifica caratteri speciali
                        $testo_value = mydecodeTxt($testo_value);
                    }
                    
                    $lang_name = $_vdeslanguage[$idx];
            ?>
                <div style="border:1px solid #ddd; border-radius:8px; padding:20px; background:#fff;">
                    <label style="display:flex; align-items:center; gap:10px; margin-bottom:10px; font-weight:bold; font-size:16px;">
                        <span class="fi fi-<?=$flag?>" style="font-size:24px;"></span>
                        <?=htmlspecialchars($lang_name)?> (<?=$lang_code?>)
                    </label>
                    <textarea name="testo_<?=$lang_code?>" <?=($use_visual_editor ? 'class="tinymce-editor"' : '')?> rows="<?=($tipo == 'txt' || $use_visual_editor ? '15' : '8')?>" 
                              style="width:100%; padding:10px; border:1px solid #ccc; border-radius:4px; font-family:monospace; font-size:13px; box-sizing:border-box; overflow-y:auto; resize:vertical;"
                              placeholder="Inserisci il contenuto per <?=$lang_name?>"><?=$testo_value?></textarea>
                </div>
            <?php 
                }
            }
            ?>
        </div>
        
        <div style="margin-top:30px; padding:20px; background:#f8f9fa; border-radius:8px; display:flex; gap:10px; align-items:center;">
            <button type="submit" class="button">
                <div>
                    <svg class="btn-icon" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" style="vertical-align:middle; margin-right:5px;">
                        <path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z" fill="currentColor"/>
                    </svg>
                    Salva Tutti i Testi
                </div>
            </button>
            <button type="button" class="button buttonrev" onclick="document.frmback2.submit();">
                <div>
                    <svg class="btn-icon" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" style="vertical-align:middle; margin-right:5px;">
                        <path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z" fill="currentColor"/>
                    </svg>
                    Annulla
                </div>
            </button>
        </div>
    </form>
    
    <?php if($use_visual_editor) { ?>
    <script>
    // Inizializza TinyMCE 4.16 per le textarea con classe tinymce-editor
    tinymce.init({
        selector: 'textarea.tinymce-editor',
        height: 400,
        menubar: false,
        plugins: [
            'advlist autolink lists link image charmap print preview anchor',
            'searchreplace visualblocks code fullscreen',
            'insertdatetime media table contextmenu paste code'
        ],
        toolbar: 'undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | code',
        content_css: [
            '//www.tinymce.com/css/codepen.min.css',
            '<?=$urlbase?>/main/contents/styletxt.css'
        ],
        // Preserva tutti i tag HTML5 e gli attributi personalizzati
        extended_valid_elements: 'section[*],article[*],aside[*],nav[*],header[*],footer[*],main[*],figure[*],figcaption[*],time[*],mark[*],div[*],span[*],a[*],p[*],h1[*],h2[*],h3[*],h4[*],h5[*],h6[*],br[*],img[*]',
        valid_elements: '*[*]',
        valid_children: '+body[style],+section[div|p|h1|h2|h3|h4|h5|h6|ul|ol|a|span|img],+div[section|article|aside|header|footer|nav]',
        verify_html: false,
        cleanup: false,
        convert_urls: false,
        relative_urls: false,
        remove_script_host: false,
        style_formats: [
            {title: 'Titoli', items: [
                {title: 'Titolo Grande', selector: 'h1,h2,h3,p,div', classes: 'titolo_big'},
                {title: 'Titolo', selector: 'h1,h2,h3,p,div', classes: 'titolo'},
                {title: 'Titolo Evidenziato', selector: 'h1,h2,h3,p,div', classes: 'titolo_evi'},
                {title: 'Titolo Grande Evi', selector: 'h1,h2,h3,p,div', classes: 'titolo_big_evi'},
                {title: 'Titolo Bianco', selector: 'h1,h2,h3,p,div', classes: 'titolo_w'},
                {title: 'Sottotitolo', selector: 'p,div,span', classes: 'subtitolo'}
            ]},
            {title: 'Testi', items: [
                {title: 'Testo Standard', selector: 'p,div,span', classes: 'testo'},
                {title: 'Testo Medio', selector: 'p,div,span', classes: 'testo2'},
                {title: 'Testo Piccolo', selector: 'p,div,span', classes: 'testo3'},
                {title: 'Testo Bold', selector: 'p,div,span,strong', classes: 'testob'},
                {title: 'Testo Evidenziato', selector: 'p,div,span', classes: 'testo_evi'},
                {title: 'Testo Errore', selector: 'p,div,span', classes: 'testo_err'}
            ]},
            {title: 'Testi Small', items: [
                {title: 'Testo Small', selector: 'p,div,span', classes: 'testosm'},
                {title: 'Testo Small Evi', selector: 'p,div,span', classes: 'testosmevi'},
                {title: 'Testo Small Scuro', selector: 'p,div,span', classes: 'testosmscuro'}
            ]},
            {title: 'Footer', items: [
                {title: 'Testo Footer', selector: 'p,div,span', classes: 'testofoo'},
                {title: 'Testo Footer 2', selector: 'p,div,span', classes: 'testofoo2'},
                {title: 'Titolo Footer', selector: 'h1,h2,h3,p,div', classes: 'titolofoo'}
            ]},
            {title: 'Speciali', items: [
                {title: 'Label', selector: 'span,div,label', classes: 'l-label'},
                {title: 'Grigio', selector: 'p,div,span', classes: 'gray'},
                {title: 'Evidenziato', selector: 'span,strong', classes: 'evi'}
            ]}
        ]
        //language: 'it',
        //language_url: '<?=$extincpath_http?>/contents/tinymce416/tinymce/js/tinymce/langs/it.js'
    });
    </script>
    <?php } ?>
    
    <?php
}
?>
