N°4230 - Printable version issues

This commit is contained in:
acognet
2021-09-29 10:54:33 +02:00
parent 8dbbc9a124
commit e2904fb0ee
9 changed files with 108 additions and 77 deletions

View File

@@ -43,30 +43,38 @@ var oTable{{ sListIDForVarSuffix }} = $('#{{ oUIBlock.GetId() }}').DataTable({
},
scrollX: true,
{% if oUIBlock.GetOption('sMaxHeight') is not empty %}
scrollY: "{{ oUIBlock.GetOption('sMaxHeight') }}",
scrollY: "{{ oUIBlock.GetOption('sMaxHeight') }}",
{% endif %}
scrollCollapse: true,
{% if oUIBlock.GetOption('printVersion') is not empty %}
paging: false,
info: false,
{% endif %}
lengthMenu: [[ {{ iPageSize }}, {{ iPageSize*2 }}, {{ iPageSize*3 }}, {{ iPageSize*4 }}, -1], [ {{ iPageSize }}, {{ iPageSize*2 }}, {{ iPageSize*3 }}, {{ iPageSize*4 }}, "{{ 'UI:Datatables:Language:DisplayLength:All'|dict_s }}"]],
dom: "<'ibo-datatable--toolbar'<'ibo-datatable--toolbar-left' pl><'ibo-datatable--toolbar-right' i>>t<'ibo-datatable--toolbar'<'ibo-datatable--toolbar-left' pl><'ibo-datatable--toolbar-right' i>>",
{% if( oUIBlock.GetOption("sort")[0] is defined ) %}
order: [[{{ oUIBlock.GetOptions()["sort"][0] }}, '{{ oUIBlock.GetOptions()["sort"][1] }}']],
order: [[{{ oUIBlock.GetOptions()["sort"][0] }}, '{{ oUIBlock.GetOptions()["sort"][1] }}']],
{% else %}
order: [],
order: [],
{% endif %}
ordering: true,
{% if oUIBlock.GetOption("select_mode") is not empty %}
select: {
style: "{% if oUIBlock.GetOption("select_mode") == "multiple" %}multi{% else %}single{% endif %}",
info: false
},
rowCallback: function (oRow, oData) {
if ($(this).closest('.ibo-panel--body').find('[name=selectionMode]').val() === "negative") {
if (oSelectedItems{{ sListId }}.indexOf(oData.id) === -1) {
this.api().row($(oRow)).select();
// $(oRow).addClass('selected');
$(oRow).find('td:first-child input').prop('checked', true);
}
} else {
select: {
style: "{% if oUIBlock.GetOption("select_mode") == "multiple" %}multi{% else %}single{% endif %}",
info: false
},
rowCallback: function (oRow, oData) {
if ($(this).closest('.ibo-panel--body').find('[name=selectionMode]').val() === "negative")
{
if (oSelectedItems{{ sListId }}.indexOf(oData.id) === -1)
{
this.api().row($(oRow)).select();
// $(oRow).addClass('selected');
$(oRow).find('td:first-child input').prop('checked', true);
}
}
else
{
if (oSelectedItems{{ sListId }}.indexOf(oData.id) > -1) {
this.api().row($(oRow)).select();
$(oRow).find('td:first-child input').prop('checked', true);

View File

@@ -4,15 +4,34 @@
{% if not aPage.isPrintable %}
$('#{{ oUIBlock.GetId() }}').tab_container({'remote_tab_load_dict': '{{ 'UIBlock:TabContainer:RemoteTabLoad'|dict_s|escape('js') }}'});
{% else %}
function refresh_status() {
var loaded = true;
$('#{{ oUIBlock.GetId() }}').find('.ibo-tab-container--tab-container').each(function (i, elt) {
if ($(elt).attr('data-status') != 'loaded')
{
loaded = false;
}
});
if (loaded)
{
$('#{{ oUIBlock.GetId() }}').attr('data-status', 'loaded');
}
}
{% for oTab in oUIBlock.GetSubBlocks() %}
oHiddeableChapters['tab_{{ oTab.GetId()|sanitize(constant('utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER')) }}'] = '{{ oTab.GetTitle()|escape('js') }}';
{% if oTab.GetType() == constant('TabManager::ENUM_TAB_TYPE_AJAX') %}
$.post('{{ oTab.GetUrl()|raw }}', {printable: '1'}, function (data)
{
$.post('{{ oTab.GetUrl()|raw }}', {printable: '1'}, function (data) {
$('#tab_{{ oTab.GetId()|sanitize(constant('utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER')) }} > .printable-tab-content').append(data);
$('#tab_{{ oTab.GetId()|sanitize(constant('utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER')) }}').attr('data-status', 'loaded');
refresh_status();
});
{% else %}
$('#tab_{{ oTab.GetId()|sanitize(constant('utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER')) }}').attr('data-status', 'loaded');
{% endif %}
{% endfor %}
refresh_status();
{% endif %}

View File

@@ -2,19 +2,6 @@
{# @license http://opensource.org/licenses/AGPL-3.0 #}
{% extends "pages/backoffice/nicewebpage/layout.html.twig" %}
{% block iboPageBodyHtml %}
{% if aPage.isPrintable %}
<div class="printable-content" style="width: 27.7cm;">
<div id="ibo-page-container">
{{ render_block(aLayouts.oPageContent, {aPage: aPage, aLayouts: aLayouts}) }}
{# TODO: Remove this when modal development is done #}
<div id="at_the_end">{{ aPage.sDeferredContent|raw }}</div>
<div style="display:none" title="ex2" id="ex2">Please wait...</div>
<div style="display:none" title="dialog" id="ModalDlg"></div>
<div style="display:none" id="ajax_content"></div>
</div>
</div>
{% else %}
{{ render_block(aLayouts.oNavigationMenu, {aPage: aPage}) }}
<div id="ibo-page-container">
<div id="ibo-top-container">
@@ -30,7 +17,6 @@
<div style="display:none" id="ajax_content"></div>
<div class="ibo-is-hidden" id="ibo-user-disconnected-dialog">{{ 'UI:DisconnectedDlgMessage'|dict_s }}</div>
</div>
{% endif %}
{% endblock %}
{% block iboDeferredBlocks %}

View File

@@ -49,11 +49,15 @@
{% endblock %}
</head>
<body data-gui-type="backoffice">
{% block iboPageBodyHtml %}
<div id="ibo-page-container">
{{ render_block(oLayout, {aPage: aPage}) }}
</div>
{% endblock %}
{% if aPage.isPrintable %}
<div class="printable-content" style="width: 27.7cm;"> {% endif %}
{% block iboPageBodyHtml %}
<div id="ibo-page-container">
{{ render_block(oLayout, {aPage: aPage}) }}
</div>
{% endblock %}
{% if aPage.isPrintable %}</div> {% endif %}
{% block iboDeferredBlocks %}
{% for oBlock in aDeferredBlocks %}
@@ -62,8 +66,8 @@
{% endblock %}
{% if aPage.aJsFiles is not empty %}
<script type="text/javascript">
var aListJsFiles = [];
{% for sJsFile in aPage.aJsFiles %}
var aListJsFiles = [];
{% for sJsFile in aPage.aJsFiles %}
aListJsFiles.push("{{ sJsFile|raw }}");
{% endfor %}
</script>