Исходный код вики Описание BI отчетов
Редактировал(а) Alexey Semenihin 22.04.2025
Последние авторы
| author | version | line-number | content |
|---|---|---|---|
| 1 | Описания отчетов, которые помогут понять, каким образом вычисляются различные показатели: | ||
| 2 | |||
| 3 | {{html}} | ||
| 4 | <script> | ||
| 5 | // Ждём загрузки DOM | ||
| 6 | document.observe("dom:loaded", function() { | ||
| 7 | // Находим ссылку на вкладку "Вложения" (по ID или тексту) | ||
| 8 | var attachmentsTab = $('Attachmentslink'); | ||
| 9 | // Если вкладка найдена, имитируем клик | ||
| 10 | if (attachmentsTab) { | ||
| 11 | attachmentsTab.click(); | ||
| 12 | } | ||
| 13 | // Альтернативный вариант (если не сработал ID): | ||
| 14 | else { | ||
| 15 | var tabs = $$('.tab-menu a').find(function(tab) { | ||
| 16 | return tab.textContent.trim().includes('Вложения'); | ||
| 17 | }); | ||
| 18 | if (tabs && tabs.length > 0) tabs[0].click(); | ||
| 19 | } | ||
| 20 | }); | ||
| 21 | </script> | ||
| 22 | {{/html}} | ||
| 23 | |||
| 24 | {{velocity}}#macro(displayDirectChildrenClean) | ||
| 25 | #set ($currentPage = $doc.fullName) | ||
| 26 | #set ($children = $xwiki.getDocument($currentPage).getChildren()) | ||
| 27 | #set ($filteredChildren = []) | ||
| 28 | |||
| 29 | ## Фильтруем список, исключая ненужные страницы | ||
| 30 | #foreach ($child in $children) | ||
| 31 | #set ($childDoc = $xwiki.getDocument($child)) | ||
| 32 | #set ($childTitle = $!childDoc.getPlainTitle()) | ||
| 33 | #set ($childName = $childDoc.getName()) | ||
| 34 | ## Исключаем страницу администрирования и другие нежелательные | ||
| 35 | #if (!$childName.contains('Admin') && !$childTitle.contains('Администрирование')) | ||
| 36 | #set ($discard = $filteredChildren.add($child)) | ||
| 37 | #end | ||
| 38 | #end | ||
| 39 | |||
| 40 | ## Выводим отфильтрованный список с корректной нумерацией | ||
| 41 | #if ($filteredChildren.size() > 0) | ||
| 42 | #foreach ($child in $filteredChildren) | ||
| 43 | #set ($childDoc = $xwiki.getDocument($child)) | ||
| 44 | #set ($displayName = $!childDoc.getPlainTitle()) | ||
| 45 | #if ($displayName == '') | ||
| 46 | #set ($displayName = $childDoc.getName()) | ||
| 47 | #end | ||
| 48 | |||
| 49 | #set ($index = $foreach.index + 1) | ||
| 50 | =====$index. [[$displayName>>$child]]===== | ||
| 51 | #end | ||
| 52 | #end | ||
| 53 | #end | ||
| 54 | ## Выводим список | ||
| 55 | #displayDirectChildrenClean() | ||
| 56 | |||
| 57 | #set($attachments = $doc.getAttachmentList()) | ||
| 58 | #foreach($attachment in $attachments) | ||
| 59 | #set($filename = $attachment.filename) | ||
| 60 | #set($fileurl = $doc.getAttachmentURL($filename)) | ||
| 61 | |||
| 62 | #if($filename.toLowerCase().endsWith('.pdf')) | ||
| 63 | ===Документ: ${attachment.filename}=== | ||
| 64 | {{html}} | ||
| 65 | <iframe | ||
| 66 | src="/resources/pdfjs/web/viewer.html?file=${fileurl}" | ||
| 67 | width="100%" | ||
| 68 | height="600px"> | ||
| 69 | </iframe> | ||
| 70 | {{/html}} | ||
| 71 | |||
| 72 | #end | ||
| 73 | #if(!$filename.toLowerCase().endsWith('.pdf')) | ||
| 74 | |||
| 75 | ===Документ: ${attachment.filename}=== | ||
| 76 | |||
| 77 | {{office attachment="${attachment.filename}" filterStyles="false"/}} | ||
| 78 | |||
| 79 | #end | ||
| 80 | #end | ||
| 81 | {{html}} | ||
| 82 | <style> | ||
| 83 | .pdf-viewer-container { | ||
| 84 | margin: 20px 0; | ||
| 85 | border: 1px solid #eee; | ||
| 86 | padding: 10px; | ||
| 87 | background: #f9f9f9; | ||
| 88 | } | ||
| 89 | </style> | ||
| 90 | {{/html}}{{/velocity}} |