Árvore de páginas

Versões comparadas

Chave

  • Esta linha foi adicionada.
  • Esta linha foi removida.
  • A formatação mudou.


Conector de Widget
urlhttps://drive.google.com/file/d/16mZ-aPolfcs_uFXPXaaMsTQdMTbhnfrs

HTML<!DOCTYPE html> <html> <head> <meta

<!DOCTYPEhtml>
<html>
<head>
    <metacharset="UTF-8"

> <style> .

>
    <style>
        .release-notes-container

{

{
            font-family:

Arial,

sans-serif;


            max-width:

1200px; margin: 0 auto; padding: 20px; } .header { background:

1200px;
            margin:0auto;
            padding:20px;
        }
        .header{
            background:linear-gradient(135deg,

#667eea

#667eea0%,

#764ba2

#764ba2100%);

color: white; padding: 20px;


            color:white;
            padding:20px;
            border-radius:

8px;

8px;
            margin-bottom:

20px;

} .header h1 { margin: 0; font-size: 24px; } .metadata { background-color: #f4f5f7; padding: 15px; border-radius: 5px; margin: 20px 0; display: flex; justify-content: space-between; flex-wrap: wrap; } .metadata-item { margin: 5px 0; } .metadata-item strong { color: #667eea; } .widget-container { margin: 20px 0; border: 1px solid #ddd; border-radius: 5px; overflow: hidden; } .loading { text-align: center; padding: 40px; color: #666; } .error { background-color: #fee; color: #c33; padding: 15px; border-radius: 5px; margin: 20px 0; } .links { margin: 20px 0; } .links a { display: inline-block; margin: 5px 10px 5px 0; padding: 8px 15px; background-color: #0052CC; color: white; text-decoration: none; border-radius: 4px; font-weight: bold; } .links a:hover { background-color: #0065FF; } </style> </head> <body> <div


        }
        .headerh1{
            margin:0;
            font-size:24px;
        }
        .metadata{
            background-color:#f4f5f7;
            padding:15px;
            border-radius:5px;
            margin:20px0;
            display:flex;
            justify-content:space-between;
            flex-wrap:wrap;
        }
        .metadata-item{
            margin:5px0;
        }
        .metadata-itemstrong{
            color:#667eea;
        }
        .widget-container{
            margin:20px0;
            border:1pxsolid#ddd;
            border-radius:5px;
            overflow:hidden;
            min-height:600px;
        }
        .loading{
            text-align:center;
            padding:40px;
            color:#666;
        }
        .error{
            background-color:#fee;
            color:#c33;
            padding:15px;
            border-radius:5px;
            margin:20px0;
        }
        .warning{
            background-color:#fff3cd;
            color:#856404;
            padding:15px;
            border-radius:5px;
            margin:20px0;
        }
        .links{
            margin:20px0;
        }
        .linksa{
            display:inline-block;
            margin:5px10px5px0;
            padding:8px15px;
            background-color:#0052CC;
            color:white;
            text-decoration:none;
            border-radius:4px;
            font-weight:bold;
        }
        .linksa:hover{
            background-color:#0065FF;
        }
    </style>
</head>
<body>
    <divclass="release-notes-container">

<div


        <divclass="header">

<h1


            <h1id="page-title"

>Release Notes</h1> </div> <div

>Dicionário de Dados</h1>
        </div>
       
        <divclass="metadata">

<div


            <divclass="metadata-item">

<strong>Versão:</strong> <span


                <strong>Versão:</strong><spanid="version"

>Carregando

>Carregando...</

span> </div> <div class="metadata-item"> <strong>Última atualização:</strong> <span

span>
            </div>
            <divclass="metadata-item">
                <strong>Última atualização:</strong><spanid="last-update">-</

span> </div> </div> <div

span>
            </div>
        </div>
       
        <divclass="links"

id="links-container">

<!-- Links serão inseridos aqui --> </div> <div


            <!-- Links serão inseridos aqui -->
        </div>
       
        <divclass="widget-container">

<div


            <divid="loading"

class="loading">

🔄 Carregando documento... </div> <div


                🔄 Carregando documento...
            </div>
            <divid="error"

class="error

"

"style="display: none;"></div>
            <divid="warning"class="warning"style="display:

none;"></

div> <div

div>
            <divid="widget-placeholder"></

div> </div> </div> <script>

div>
        </div>
    </div>



    <script>
        (function()

{ // Função para extrair versão do título da página function getVersionFromPage() { // Tenta várias formas de obter o título da página let version = null; // Método 1: Título da página (Confluence) const pageTitle = document.querySelector('h1#title-text, .page-title, h1'); if (pageTitle) { version = pageTitle.textContent.trim(); } // Método 2: Meta tags if (!version) { const metaTitle = document.querySelector('meta[property="og:title"], meta[name="title"]'); if (metaTitle) { version = metaTitle.getAttribute('content'); } } // Método 3: URL (fallback) if (!version) { const urlParams = new URLSearchParams(window.location.search); const titleParam = urlParams.get('title'); if (titleParam) { version = decodeURIComponent(titleParam); } } // Limpar versão (remover prefixos comuns) if (version) { version = version .replace(/^Release Notes\s*[-:]?\s*/i, '') .replace(/^Release\s*Notes\s*/i, '') .trim(); } return version; } // Função para construir URL do Google Doc function getGoogleDocUrl(version) { // Padrão: versão.txt ou apenas versão const docName = version.endsWith('.txt') ? version : version + '.txt'; // ID do folder do Google Drive (do seu config) const folderId = '141aJRhZeYZca4QCBnou6-00WzRLkBYbs'; // URL base do Google Drive const baseUrl = 'https://drive.google.com/drive/folders/' + folderId; // Retornar URL de busca (será usado para encontrar o documento) return { searchUrl: baseUrl, docName: docName, version: version }; } // Função para criar Widget Connector function createWidgetConnector(docUrl) { // URL completa do Google Doc const fullUrl = docUrl; // Criar iframe como fallback (caso Widget Connector não funcione) const iframe = document.createElement('iframe'); iframe.src = fullUrl.replace('/edit', '/preview'); iframe.width = '100%'; iframe.height = '800'; iframe.style.border = 'none'; iframe.style.borderRadius = '5px'; iframe.allow = 'fullscreen'; // Tentar usar Widget Connector do Confluence const widgetCode = ` <ac:structured-macro ac:name="widget" ac:schema-version="1"> <ac:parameter ac:name="url">${fullUrl}</ac:parameter> <ac:parameter ac:name="width">100%</ac:parameter> <ac:parameter ac:name="height">800</ac:parameter> </ac:structured-macro> `; // Se estiver em modo de edição, retornar código do macro // Se estiver em visualização, usar iframe return { widgetCode: widgetCode, iframe: iframe, directUrl: fullUrl }; } // Função principal function init() { const version = getVersionFromPage(); if (!version) { document.getElementById('error').style.display = 'block'; document.getElementById('error').textContent = '❌ Não foi possível identificar a versão da página. Certifique-se de que o título da página contém a versão (ex: 12.1.2511.2)'; document.getElementById('loading').style.display = 'none'; return; } // Atualizar interface document.getElementById('version').textContent = version; document.getElementById('page-title').textContent = `Release Notes - ${version}`; document.getElementById('last-update').textContent = new Date().toLocaleString('pt-BR'); // Construir URLs const docInfo = getGoogleDocUrl(version); // URL do Google Doc (assumindo que o nome do arquivo é a versão) // Você precisará mapear versão -> document ID ou usar busca const googleDocUrl = `https://docs.google.com/document/d/[DOCUMENT_ID]/edit?usp=sharing`; // Criar links const linksContainer = document.getElementById('links-container'); linksContainer.innerHTML = ` <a href="${googleDocUrl}" target="_blank">📄 Abrir no Google Docs</a> <a href="https://drive.google.com/drive/folders/141aJRhZeYZca4QCBnou6-00WzRLkBYbs" target="_blank">📁 Pasta Release Notes</a> <a href="https://tdn.totvs.com/pages/viewpage.action?pageId=649987902" target="_blank">📚 Release Notes Principal</a> `; // Criar widget const widget = createWidgetConnector(googleDocUrl); const placeholder = document.getElementById('widget-placeholder'); // Tentar inserir Widget Connector (se em modo de edição) // Caso contrário, usar iframe placeholder.appendChild(widget.iframe);

{
            // Mapeamento de versões para Document IDs do Google Docs e arquivos .txt
            // Gerado automaticamente a partir da pasta: 141aJRhZeYZca4QCBnou6-00WzRLkBYbs
            // Data: 2025-12-16
            // Total: 62 versões (2 Google Docs + 60 arquivos .txt - todos funcionando!)
            constversionToDocId={
                // Google Docs (2)
                '12.1.2503.14':'13QaSU_lP1_haWnOYl7UjPvsKfi3AaPdKwciYHrceEt4',
                '12.1.2511.2':'1gLo16QDT99iGdaoKyFHBW1n5jF-gt-awBjnSQrBZa3c',
               
                // Arquivos .txt (60) - funcionando diretamente no Widget Connector
                '12.1.2503':'1BRsJyHOHQNOEpAfIm5ndOn6z_0gffbaF',
                '12.1.2503.15':'12ejZuDikegyaH2n16n2Hpas1Z3VEjc5e',
                '12.1.2503.16':'15BkT50wXw7kJccfw4iRB-LVGQyTzQVf1',
                '12.1.2503.17':'1L4FUKbDjnAs29rK0ymfMgRVJPPVtzYdW',
                '12.1.2503.18':'1LNSFua5jsEw9m2D4X7lBVsbk6qXsG3cm',
                '12.1.2507':'1pT42y90cnf2UY2gK5k035jEFVkIs7s-n',
                '12.1.2507.1':'1lo7KiRJGWYJFfH-Xqv-dvNcRoIy6ecj3',
                '12.1.2507.2':'1xe9L8cCurcXIw5tzxe4H9KNzFgpIObA1',
                '12.1.2507.3':'1P9jEM2cgtUkyfdK5bsKlSvFCk_SqpMqU',
                '12.1.2507.4':'12Qk7mEnEe2iIsE-nFUUGOmbt_t8rwjn-',
                '12.1.2507.5':'1ljgI7Re2mT3yv7TgnZLOZv_n0vzzJTxF',
                '12.1.2507.6':'1lwblHVXZUKF8qgdajVB2Va41fxpJkZ9X',
                '12.1.2507.7':'1LWO9GFD8iO6HQEJn_wBybP1EdZ2AZSsD',
                '12.1.2507.8':'1bhB3Pig68EAvmXGoUptLYnJPEnGW4fVr',
                '12.1.2507.9':'1shjpLbeGfQmrV6DMtm4EuIvqdhHTuEIy',
                '12.1.2507.10':'1wU40XkkEMRqw4Ieanf5QrkBz8SwqISzj',
                '12.1.2507.11':'1goM3M1WCXvtdx46fY7ZmeeDtwpnvbld5',
                '12.1.2507.12':'15r-G5LdQpPn9gcktkpYVPQS1exs6Io8t',
                '12.1.2507.13':'1xVHx0mjDewGUVwIGR8GWqTMqX1R_Cj21',
                '12.1.2507.14':'1uFblMZhJaYPFrGKtFCC9bAa-2xxtXmi_',
                '12.1.2507.15':'1vNN6ONnbq1ApNJy6uzGW_hZ27HvhW7Dd',
                '12.1.2507.16':'1g27jhn6ZEliSZhAJ7Co9FUFLtNBfqVHH',
                '12.1.2507.17':'1LkwBvxVy_oykf3gEAwlf2eRn0NMiMnL1',
                '12.1.2507.18':'1he66XmpG6YhgKlxtMv3xik6KccuMKLeS',
                '12.1.2511':'1gPiO2P_mF0wpLX-2g5oFBqi4QS630wKM',
                '12.1.2511.1':'1yv4EZZKrfPgI-RWggMfBANtx6dL8owhA',
                '12.1.2511.3':'14Zd-Npn6VGioc1wsokDL4vfPRVzhb-AY',
                '12.1.2511.4':'1VjoqjmjqCokx4Kv5QDTDa9wZsF1QwICY',
                '12.1.2511.5':'1evpMFJmgDUFX__dC6W83LZqKQXjmy88s',
                '12.1.2511.6':'1_e3AgOsc9Oqy-JoZhus-zyU-961karvw',
                '12.1.2511.7':'19TKZ4fYof03H0pdzldQnV7_ZYjxowkNr',
                '12.1.2511.8':'12ivR5sJUwVwcRJr0Q_aHBT_y4JwlnTd4',
                '12.1.2511.9':'1Exio4F5z2lo6HnEnLpkDquuu8HUiD3C-',
                '12.1.2511.10':'1NRs4aZct5OVmSiXDPgMmUw9iFURlC6Od',
                '12.1.2511.11':'1AAOtpmIahaHaYYUtUFL3OJGJ07dTKLU_',
                '12.1.2511.12':'1c19qwsUQdWb_H58qcamAQ6Fz9Bwg78Bs',
                '12.1.2511.13':'1CS-VXZJLzPSBjov0r4JVAcTPE5daaE4M',
                '12.1.2511.14':'1dei-4_gijuPsGzSQKZpIh9DMCYJ2pw8j',
                '12.1.2511.15':'1qDv9Zm_0CJiKl6iJBzxVxwFCoHNZBky4',
                '12.1.2511.16':'1H51vcp3ierWZE0XB1QEtzUnm0J-0uEVp',
                '12.1.2511.17':'1OwFzjD6j4_OlDi9x7f5xqqoBo_eKY1rd',
                '12.1.2511.18':'1iaMmEP6yDzHR4oTM_SjM2obkaUz1zrBA',
                '12.1.2603.1':'19iieXcJNDoIM8lp09Zd-faD22AWepfTC',
                '12.1.2603.2':'1DFR1cWRUVm3PsPQsVbuJySIjxMIy085L',
                '12.1.2603.3':'1PLCl8hhtuvnW8Q9WDug9NH9F_qO-CUoq',
                '12.1.2603.4':'1qFmELYGulpQizNrXFBCpHdcLOSC5LrsZ',
                '12.1.2603.5':'1Q8ZSMOooNeSgmfdEucEsRO6P8z370enZ',
                '12.1.2603.6':'1P5-nq151raX-NhYufnTRrZMZyeAKsSp2',
                '12.1.2603.7':'1VfNdP7lRvi37ZKSOzX1KyEp6dK_t0I-N',
                '12.1.2603.8':'1pxJPuMKfOWXrkwS7zzmm_3i_GerA44Zi',
                '12.1.2603.9':'1evoXM_3WvL4SGVkwB8EYgwXuD6E4Asmw',
                '12.1.2603.10':'18tytubaH1oywQoWyAycMM-qMq_347CHb',
                '12.1.2603.11':'1ORyeFI8qYQynt20Ud66XLKewYQoVdLA6',
                '12.1.2603.12':'1gDfH7fyZSUGl90ikqO3yXsZGm_EXC4PW',
                '12.1.2607.1':'1ruRPs4fBJrKpLoECMGh0X5Ca4Bc_hfPb',
                '12.1.2607.2':'1njYTB38Ts6_dAZKvkqdvdQcPx99HTRml',
                '12.1.2607.3':'1uQR-2_JLet0Cyo7K6XaClDaXqxBu7udV',
                '12.1.2607.4':'1G41yiKUzoWgIrbQATlhYntb73FSH9U76',
                '12.1.2607.5':'1_BfY0poM0AeAFy39vK-XZmBhEafIzzBf',
                '12.1.2607.6':'1cm7WuMWrQYjGDdeMdmdAqIFX5ugROaHY',
            };
           
            // Função para extrair versão do título "Dicionário de Dados 12.1.2503.14"
            functionextractVersionFromTitle(){
                letversion=null;
                constversionPattern=/(\d+\.\d+\.\d+(?:\.\d+)?)/;
               
                // Método 1: Título da página (Confluence)
                constpageTitle=document.querySelector('h1#title-text, .page-title, h1, [data-page-title]');
                if (pageTitle) {
                    consttitleText=pageTitle.textContent.trim();
                    constmatch=titleText.match(versionPattern);
                    if (match) {
                        version=match[1];
                    }
                }
               
                // Método 2: Meta tags
                if (!version) {
                    constmetaTitle=document.querySelector('meta[property="og:title"], meta[name="title"]');
                    if (metaTitle) {
                        consttitleText=metaTitle.getAttribute('content') ||'';
                        constmatch=titleText.match(versionPattern);
                        if (match) {
                            version=match[1];
                        }
                    }
                }
               
                // Método 3: document.title
                if (!version) {
                    constmatch=document.title.match(versionPattern);
                    if (match) {
                        version=match[1];
                    }
                }
               
                // Método 4: URL (fallback)
                if (!version) {
                    consturlParams=newURLSearchParams(window.location.search);
                    consttitleParam=urlParams.get('title');
                    if (titleParam) {
                        constmatch=decodeURIComponent(titleParam).match(versionPattern);
                        if (match) {
                            version=match[1];
                        }
                    }
                }
               
                returnversion;
            }
           
            // Função principal
            functioninit(){
                constversion=extractVersionFromTitle();
               
                if (!version) {
                    document.getElementById('error').style.display='block';
                    document.getElementById('error').innerHTML=
                        '❌ <strong>Versão não identificada</strong><br>'+
                        'Certifique-se de que o título da página contém a versão no formato: "Dicionário de Dados 12.1.2503.14"';
                    document.getElementById('loading').style.display='none';
                    return;
                }
               
                // Atualizar interface
                document.getElementById('version').textContent=version;
                document.getElementById('page-title').textContent=`Dicionário de Dados ${version}`;
                document.getElementById('last-update').textContent=newDate().toLocaleString('pt-BR');
               
                // Obter Document ID
                constdocId=versionToDocId[version];
               
                if (!docId) {
                    showWarning(version);
                    return;
                }
               
                loadDocument(docId,version);
            }
           
            functionshowWarning(version){
                document.getElementById('warning').style.display='block';
                document.getElementById('warning').innerHTML=
                    `⚠️ <strong>Documento não encontrado para versão ${version}</strong><br>`+
                    `O documento pode ainda não ter sido criado no Google Drive ou o mapeamento precisa ser atualizado.<br><br>`+
                    `Para adicionar este documento ao mapeamento:<br>`+
                    `1. Certifique-se de que existe um Google Doc ou arquivo .txt com o nome "${version}" ou "${version}.txt" na pasta<br>`+
                    `2. Execute o script: <code>python generate_complete_mapping_with_txt.py</code><br>`+
                    `3. Atualize o objeto <code>versionToDocId</code> neste HTML com o novo Document ID`;
                document.getElementById('loading').style.display='none';
            }
           
            functionloadDocument(docId,version){
                // Construir URLs (funciona para Google Docs e arquivos .txt)
                // Para arquivos .txt, o Google Drive permite visualização direta
                constgoogleDocUrl=`https://docs.google.com/document/d/${docId}/edit?usp=sharing`;
                constpreviewUrl=`https://docs.google.com/document/d/${docId}/preview`;
                constdriveViewUrl=`https://drive.google.com/file/d/${docId}/view?usp=sharing`;
               
                // Criar links
                constlinksContainer=document.getElementById('links-container');
                linksContainer.innerHTML=`
                    <a href="${googleDocUrl}" target="_blank">📄 Abrir no Google Docs</a>
                    <a href="${driveViewUrl}" target="_blank">📄 Ver no Google Drive</a>
                    <a href="https://drive.google.com/drive/folders/141aJRhZeYZca4QCBnou6-00WzRLkBYbs" target="_blank">📁 Pasta Release Notes</a>
                    <a href="https://tdn.totvs.com/pages/viewpage.action?pageId=649987902" target="_blank">📚 Release Notes Principal</a>
                `;
               
                // Criar Widget Connector ou iframe
                constplaceholder=document.getElementById('widget-placeholder');
               
                // Verificar se está em modo de edição do Confluence
                constisEditMode=window.location.href.includes('editpage.action') ||
                                  window.location.href.includes('edit');
               
                if (isEditMode) {
                    // Modo de edição: mostrar código do macro Widget Connector
                    constwidgetCode=`<ac:structured-macro ac:name="widget" ac:schema-version="1">
  <ac:parameter ac:name="url">${googleDocUrl}</ac:parameter>
  <ac:parameter ac:name="width">100%</ac:parameter>
  <ac:parameter ac:name="height">800</ac:parameter>
</ac:structured-macro>`;
                   
                    placeholder.innerHTML=`
                        <div style="background: #f4f5f7; padding: 15px; border-radius: 5px; margin: 10px 0;">
                            <p><strong>📋 Código do Widget Connector:</strong></p>
                            <pre style="background: white; padding: 10px; border-radius: 3px; overflow-x: auto; font-size: 12px;">${widgetCode}</pre>
                            <p style="margin-top: 10px; font-size: 12px; color: #666;">
                                💡 <strong>Instruções:</strong> Copie o código acima e cole no editor do Confluence usando o macro "Widget Connector".
                            </p>
                        </div>
                    `;
                }else{
                    // Modo de visualização: usar iframe
                    // Tenta primeiro o preview do Google Docs, se não funcionar, usa o Drive
                    constiframe=document.createElement('iframe');
                    iframe.src=previewUrl;
                    iframe.width='100%';
                    iframe.height='800';
                    iframe.style.border='none';
                    iframe.style.borderRadius='5px';
                    iframe.allow='fullscreen';
                    iframe.title=`Dicionário de Dados ${version}`;
                   
                    placeholder.appendChild(iframe);
                }
               
                document.getElementById('loading').style.display

=

'none';

} // Executar quando a página carregar if (document.readyState === 'loading') {


            }
           
            // Executar quando a página carregar
            if (document.readyState==='loading') {
                document.addEventListener('DOMContentLoaded',

init);

} else { init(); } })(); </script> </body> </html>


            }else{
                init();
            }
        })();
    </script>
</body>
</html>