Sluiten

menu-img-alt vale-wave

Filtro atual: 'folderId:2699492'

Faça sua busca

Para a facilitar a procura pelos documentos que você precisa, utilize a busca por palavra-chave, tipo de documento e/ou um tema-chave.

    Er trad een fout op tijdens de verwerking van de sjabloon.
    The following has evaluated to null or missing:
    ==> taxonomyCategoryResource  [in template "44549#44620#1292787" at line 102, column 60]
    
    ----
    Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
    ----
    
    ----
    FTL stack trace ("~" means nesting-related):
    	- Failed at: documentSubCategoriesIds = taxonomyCa...  [in template "44549#44620#1292787" at line 102, column 33]
    ----
    1<#assign images_path = "/documents/d/guest/" /> 
    2<#assign total = searchContainer.getTotal() /> 
    3<#assign start = searchContainer.getStart() /> 
    4<#assign delta = searchContainer.getDelta() />     
    5<#assign totalPages = (total/delta)?ceiling /> 
    6<#assign currentPage = ((start+1)/delta)?ceiling />     
    7<#assign isFirstPage = currentPage == 1 /> 
    8<#assign isLastPage = currentPage == totalPages /> 
    9<#assign iteratorURL = searchContainer.getIteratorURL().toString() /> 
    10<#assign iteratorURL += iteratorURL?contains("?")?then("", "?") /> 
    11<#assign firstPageURL = iteratorURL + '&start=1'/> 
    12<#assign lastPageURL = iteratorURL + '&start=' + totalPages?string/> 
    13<#assign previousURL = iteratorURL + '&start=' + (currentPage - 1)?string /> 
    14<#assign nextURL = iteratorURL + '&start=' + (currentPage + 1)?string /> 
    15 
    16<#assign startPage = (currentPage < 3)?then(1, currentPage - 1) /> 
    17<#assign endPage = 2 + startPage /> 
    18<#assign endPage = (totalPages < endPage)?then(totalPages, endPage) /> 
    19<#assign diff = startPage - endPage + 2 /> 
    20<#assign startPage -= (startPage - diff > 0)?then(diff, 0) /> 
    21 
    22<#assign FOLDER_NAME_CUSTOM_FIELD_NAME = 'name'/> 
    23<#assign DATE_CUSTOM_FIELD_NAME = 'date'/> 
    24 
    25<#assign documentFolderResource = resourceLocator.locate("/headless-delivery/v1.0", "DocumentFolder") /> 
    26<#assign documentResource = resourceLocator.locate("/headless-delivery/v1.0", "Document") /> 
    27<#assign structuredContentResource = resourceLocator.locate("/headless-delivery/v1.0", "StructuredContent") /> 
    28<#assign 
    29	vocabularyId = 1970869 
    30	categories = restClient.get("/headless-admin-taxonomy/v1.0/taxonomy-vocabularies/" + vocabularyId + "/taxonomy-categories?fields=id&restricFields=actions,availableLanguages,taxonomyCategoryUsageCount&page=1&pageSize=30").items 
    31/> 
    32 
    33<#function getVocabularyCategoriesIds> 
    34  <#return categories?map(category -> category.id?number)/> 
    35</#function> 
    36 
    37<#function getDocumentDate entry> 
    38    <#if entry.className == "com.liferay.document.library.kernel.model.DLFolder"> 
    39        <#assign documentOrFolder = documentFolderResource.getDocumentFolder(entry.getClassPK()) /> 
    40    <#else> 
    41        <#assign documentOrFolder = documentResource.getDocument(entry.getClassPK()) /> 
    42    </#if> 
    43 
    44    <#list documentOrFolder.getCustomFields() as customField> 
    45        <#if customField.getName() == DATE_CUSTOM_FIELD_NAME && customField.getCustomValue().getData()?has_content> 
    46            <#return customField.getCustomValue().getData()?datetime.iso> 
    47        </#if> 
    48    </#list> 
    49     
    50    <#return ""> 
    51</#function> 
    52 
    53<#assign documentsCategoriesIds = getVocabularyCategoriesIds() /> 
    54 
    55<div class="vale-widget-resultados-biblioteca-documentos position-relative" id="resultados-biblioteca-documentos-${randomNamespace}"> 
    56    <p class="results-count texto-sm text-right position-absolute"> 
    57        ${searchContainer.getTotal()} <@liferay.language key="results" /> 
    58    </p> 
    59    <table class="mb-6 table table-autofit"> 
    60        <thead class="thead"> 
    61            <tr> 
    62                <th class="pl-0"> 
    63                    <img class="pl-0" src="${images_path}folder" /> 
    64                </th> 
    65                <th class="table-cell-expand font-weight-medium text-verde-vale"> 
    66                    <@liferay.language key="name" /> 
    67                </th> 
    68                <th class="table-cell-expand-smallest table-cell-minw-150 d-table-cell font-weight-medium text-verde-vale text-right text-lg-left"> 
    69                    <@liferay.language key="category" /> 
    70                </th> 
    71                <th class="table-cell-expand-smallest table-cell-minw-150 d-none d-lg-table-cell font-weight-medium text-verde-vale"> 
    72                    <@liferay.language key="subcategory" /> 
    73                </th> 
    74                <th class="table-cell-expand-smallest table-cell-minw-150 d-none d-lg-table-cell font-weight-medium text-verde-vale"> 
    75                    <span class="mr-2"><@liferay.language key="date" /></span> 
    76                    <img data-sorting-field="expando__keyword__custom_fields__date_sortable" class="sort-arrow" src="${images_path}seta-bai_sec" /> 
    77                </th> 
    78                <th class="table-cell-expand-smallest table-cell-minw-150 d-none d-lg-table-cell table-column-text-end font-weight-medium text-verde-vale"> 
    79                    <span class="mr-2"><@liferay.language key="size" /></span> 
    80                    <img data-sorting-field="size" class="sort-arrow" src="${images_path}seta-bai_sec" /> 
    81                </th> 
    82        </thead> 
    83        <tbody> 
    84            <tr><td class="border-none py-3"></td></tr> 
    85        </tbody> 
    86        <tbody class="border-none"> 
    87            <#if entries?has_content>  
    88                <#list entries as entry > 
    89                    <#assign isFile = (entry.className == "com.liferay.document.library.kernel.model.DLFileEntry")/> 
    90                    <#assign documentCategoryName = "-" /> 
    91                    <#assign documentSubCategoryName = "-" /> 
    92                    <#if isFile> 
    93                        <#assign document = documentResource.getDocument(entry.getClassPK())/> 
    94                        <#assign documentCategoriesBriefs = document.getTaxonomyCategoryBriefs()/> 
    95                        <#assign documentCategory = documentCategoriesBriefs?filter( 
    96                            category -> documentsCategoriesIds?seq_contains(category.getTaxonomyCategoryId()?number) 
    97                        )?first!"-" /> 
    98                        <#assign documentCategoryName = (documentCategory == "-")?then("-", documentCategory.getTaxonomyCategoryName()) /> 
    99                        <#if documentCategory != "-"> 
    100                            <#assign 
    101                                documentCategoryId = documentCategory.getTaxonomyCategoryId()?string 
    102                                documentSubCategoriesIds = taxonomyCategoryResource.getTaxonomyCategoryTaxonomyCategoriesPage( 
    103                                    documentCategoryId, null, null, null, null, null).getItems()?map(c -> c.getId()?number) 
    104                                documentSubCatogoryBrief = documentCategoriesBriefs?filter( 
    105                                    categoryBrief -> documentSubCategoriesIds?seq_contains(categoryBrief.getTaxonomyCategoryId()) 
    106                                )?first!"" 
    107                                documentSubCategoryName = documentSubCatogoryBrief?has_content?then(documentSubCatogoryBrief.getTaxonomyCategoryName(), "-") 
    108                            /> 
    109                        </#if> 
    110                    </#if> 
    111                    <tr> 
    112                        <td class="pl-0"> 
    113                            <img src="${images_path + isFile?then('pdf_ic','folder')}" /> 
    114                        </td> 
    115                        <#--  Nome  --> 
    116                        <td class="table-cell-expand font-weight-normal"> 
    117                            <#if isFile> 
    118                                <a href="${document.contentUrl}" target="_blank">${entry.getTitle()}</a> 
    119															<#else> 
    120                                <a href="#" data-folder-id="${entry.classPK}">${getFolderLocalizedName(entry)}</a> 
    121                            </#if> 
    122                        </td> 
    123                        <#--  Categoria  --> 
    124                        <td class="table-cell-expand-smallest d-table-cell font-weight-normal text-right text-lg-left"> 
    125                            ${documentCategoryName} 
    126                        </td> 
    127                        <#--  Subcategoria  --> 
    128                        <td class="table-cell-expand-smallest d-none d-lg-table-cell font-weight-normal"> 
    129                            ${documentSubCategoryName} 
    130                        </td> 
    131                        <#--  Data  --> 
    132                        <#setting date_format="dd/MM/yyyy"> 
    133                        <td class="table-cell-expand-smallest d-none d-lg-table-cell font-weight-normal"> 
    134                            ${getDocumentDate(entry)?date} 
    135                        </td> 
    136                        <#--  Tamanho  --> 
    137                        <#--   
    138                            A opção de "Exibir resultados em forma de documento" deve estar  
    139                            selecionada para esse valor funcionar 
    140                        --> 
    141                        <td class="table-cell-expand-smallest d-none d-lg-table-cell table-column-text-end font-weight-normal"> 
    142                            <#if isFile> 
    143                                <#assign size = document.sizeInBytes/> 
    144                                <#if size < 1000000>  
    145                                    <#assign size = (size / 10)?round / 100 /> 
    146                                    ${(locale == 'pt_BR')?then(size?string?replace('.', ','), size)} KB 
    147                                <#else> 
    148                                    <#assign size = (size / 10000)?round / 100 /> 
    149                                    ${(locale == 'pt_BR')?then(size?string?replace('.', ','), size)} MB 
    150                                </#if> 
    151                            </#if> 
    152                        </td> 
    153                    </tr> 
    154                </#list> 
    155            </#if> 
    156        </tbody> 
    157    </table> 
    158    <div class="line-divider"></div> 
    159    <div class="pagination d-flex justify-content-center my-5"> 
    160        <a  
    161            class="pagination-option text-decoration-none mr-sm-5 ${isFirstPage?then('disabled', '')}"  
    162            href="${previousURL}"  
    163            disabled="${isFirstPage?string}" 
    164
    165            <img 
    166                class="btn btn-primary border-amarelo-vale bg-amarelo-vale mr-2 p-1 rounded-circle" 
    167                src="${images_path}seta-2-esq_bra" 
    168                alt="button-prev" 
    169            /> 
    170            <span class="btn btn-link text-amarelo-vale p-0 d-none d-sm-inline"> 
    171                <@liferay.language key="previous" /> 
    172            </span> 
    173        </a> 
    174         
    175        <#if (startPage > 1)> 
    176            <a 
    177                class="mr-2" 
    178                href="${firstPageURL}" 
    179
    180                <span 
    181                    class="pagination-item btn btn-primary p-1 rounded-circle" 
    182                    alt="first-page-button" 
    183                >1 
    184                </span> 
    185            </a> 
    186            <#if currentPage != 3>  
    187                <span class="elipsis h-100 mt-auto mr-2">...</span> 
    188            </#if> 
    189        </#if> 
    190 
    191        <#list startPage..endPage as i> 
    192            <a 
    193                class="mr-2 ${(i == currentPage)?then('disabled', '')}" 
    194                href="${iteratorURL + '&start=' + i?string}" 
    195
    196                <span 
    197                    class="pagination-item ${(currentPage == i)?then('is-active', '')} btn btn-primary p-1 rounded-circle" 
    198                    alt="first-page-button" 
    199                >${i} 
    200                </span> 
    201            </a> 
    202        </#list> 
    203 
    204        <#if (endPage < totalPages)> 
    205            <#if currentPage != totalPages - 2>  
    206                <span class="elipsis h-100 mt-auto mr-2">...</span> 
    207            </#if> 
    208            <a 
    209                class="mr-2" 
    210                href="${lastPageURL}" 
    211
    212                <span 
    213                    class="pagination-item btn btn-primary p-1 rounded-circle" 
    214                    alt="last-page-button" 
    215                >${totalPages} 
    216                </span> 
    217            </a> 
    218        </#if> 
    219 
    220        <a  
    221            class="pagination-option text-decoration-none ml-sm-5 ${isLastPage?then('disabled', '')}"  
    222            href="${nextURL}"  
    223            disabled="${isLastPage?string}" 
    224        >       
    225        <span class="btn btn-link text-amarelo-vale mr-2 p-0 d-none d-sm-inline"> 
    226            <@liferay.language key="next" /> 
    227        </span> 
    228        <img 
    229            class="btn btn-primary border-amarelo-vale bg-amarelo-vale p-1 rounded-circle" 
    230            src="${images_path}seta-2-dir_bra" 
    231            alt="button-next" 
    232        /> 
    233        </a> 
    234    </div> 
    235</div> 
    236 
    237<#function getFolderLocalizedName entry> 
    238    <#if entry.className != "com.liferay.document.library.kernel.model.DLFolder"> 
    239        <#return entry.getTitle()> 
    240    </#if> 
    241 
    242    <#assign folder = documentFolderResource.getDocumentFolder(entry.getClassPK()) /> 
    243    <#list folder.customFields as customField> 
    244        <#if customField.name == FOLDER_NAME_CUSTOM_FIELD_NAME && customField.customValue.data?has_content> 
    245            <#return customField.customValue.data> 
    246        </#if> 
    247    </#list> 
    248     
    249    <#return entry.getTitle()> 
    250</#function> 
    251 
    252<script> 
    253(function(){ 
    254    const SORT_QUERY_PARAM = 'sort'; 
    255    const FOLDER_FILTER_QUERY_PARAM = 'folder-filter'; 
    256 
    257    const resultsWidget = document.querySelector('#resultados-biblioteca-documentos-${randomNamespace}'); 
    258 
    259    // Seta links para pastas 
    260    resultsWidget.querySelectorAll('[data-folder-id]').forEach(el => el.addEventListener('click', goToFolder)); 
    261 
    262    const anchorId = resultsWidget.closest('.vale-fragmento-biblioteca-de-documentos').querySelector('.portlet').id; 
    263     
    264    // adiciona âncora nos links de paginação  
    265    resultsWidget.querySelectorAll('.pagination a').forEach(link => link.href += '#' + anchorId); 
    266 
    267    function goToFolder(e) { 
    268        e.preventDefault(); 
    269        const folderId = e.currentTarget.dataset.folderId; 
    270        const url = new URL(window.location); 
    271 
    272        clearQueryParams(url); 
    273        url.searchParams.set(FOLDER_FILTER_QUERY_PARAM, 'folderId:' + folderId); 
    274        url.hash = anchorId; 
    275 
    276        if (e.ctrlKey) { 
    277            window.open(url.href, '_blank'); // abrir em outra aba 
    278        } else { 
    279            navigateTo(url.href) 
    280
    281
    282 
    283    function clearQueryParams(url) { 
    284        const params = []; 
    285        for (let entry of url.searchParams.entries()) params.push(entry[0]); 
    286        params.forEach(param => url.searchParams.delete(param)); 
    287
    288 
    289    // Configura seta de ordenação 
    290    const sortingParam = new URLSearchParams(window.location.search).get(SORT_QUERY_PARAM); 
    291    const sortingColumns = resultsWidget.querySelectorAll('[data-sorting-field]').forEach(column => { 
    292        const sortingField = column.dataset.sortingField; 
    293 
    294        if (sortingParam === sortingField) column.classList.add("invert"); // ordem crescente (seta para cima) 
    295         
    296        column.addEventListener('click', debounce_leading(() => { 
    297            let newSortingField; 
    298            if (column.classList.contains("invert")) { 
    299                newSortingField = sortingField + "-"; // descrescente 
    300                column.classList.remove("invert"); 
    301            } else { 
    302                newSortingField = sortingField; 
    303                column.classList.add("invert"); 
    304
    305 
    306            const url = new URL(window.location); 
    307            url.searchParams.set(SORT_QUERY_PARAM, newSortingField); 
    308            url.hash = anchorId; 
    309             
    310            navigateTo(url.href); 
    311        })); 
    312    }); 
    313 
    314    function navigateTo(url) { 
    315        if(Liferay && Liferay.SPA.app) { 
    316            Liferay.SPA.app.navigate(url); 
    317        } else { 
    318            document.location.href = url; 
    319
    320
    321 
    322    function debounce_leading(func, timeout = 50) { // ignora chamadas em sequência 
    323        let timer; 
    324        return (...args) => { 
    325            if (!timer) { 
    326                func.apply(this, args); 
    327
    328            clearTimeout(timer); 
    329            timer = setTimeout(() => { 
    330                timer = undefined; 
    331            }, timeout); 
    332        }; 
    333
    334})() 
    335</script>