N°3540 - Migrate printable version of an object

This commit is contained in:
acognet
2020-12-18 11:41:06 +01:00
parent 3876fb9d62
commit 1f4d1d1959
3 changed files with 78 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
<?php
/**
* @copyright Copyright (C) 2010-2020 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Printable\BlockPrintHeader;
use Combodo\iTop\Application\UI\Base\UIBlock;
/**
* Class BlockPrintHeader
*
* @package Combodo\iTop\Application\UI\Printable\BlockPrintHeader
*/
class BlockPrintHeader extends UIBlock
{
// Overloaded constants
public const BLOCK_CODE = 'ibo-block-print-header';
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'application/printable/block-print-header/layout';
public const DEFAULT_JS_ON_READY_TEMPLATE_REL_PATH = 'application/printable/block-print-header/layout';
public const DEFAULT_JS_LIVE_TEMPLATE_REL_PATH = 'application/printable/block-print-header/layout';
public const DEFAULT_CSS_FILES_REL_PATH = ['css/print.css'];
}

View File

@@ -0,0 +1,21 @@
{# @copyright Copyright (C) 2010-2020 Combodo SARL #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
{% apply spaceless %}
<div class="explain-printable not-printable">
<p>{{'UI:ExplainPrintable'| dict_format('<i class="fas fa-eye"></i>')| raw}}</p>
<div id="hiddeable_chapters"></div>
<button class="ibo-button ibo-is-regular ibo-is-primary action" onclick="window.print()">{{'UI:Button:GoPrint'| dict_s}}</button>&#160;&#160;
<button class="ibo-button ibo-is-regular ibo-is-secondary cancel" onclick="window.close()">{{ 'UI:Button:Cancel'| dict_s}}</button>&#160;&#160;
<select name="text" onchange='$(".printable-content").width(this.value); $(charts).each(function(i, chart) { $(chart).trigger("resize"); });'>
<option value='100%'>{{ 'UI:PrintResolution:FullSize'|dict_s }}</option>
<option value='19cm'>{{ 'UI:PrintResolution:A4Portrait'|dict_s }}</option>
<option value='27.7cm' selected>{{ 'UI:PrintResolution:A4Landscape'|dict_s }}</option>
<option value='19.6cm'>{{ 'UI:PrintResolution:LetterPortrait'|dict_s }}</option>
<option value='25.9cm'>{{ 'UI:PrintResolution:LetterLandscape'|dict_s }}</option>
</select>
</div>
{% endapply %}

View File

@@ -0,0 +1,32 @@
{# @copyright Copyright (C) 2010-2020 Combodo SARL #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
{% apply spaceless %}
var sHiddeableChapters = '<ul role="tablist" class="ibo-block-print--tablist">';
for (sId in oHiddeableChapters)
{
sHiddeableChapters += '<li tabindex="-1" role="tab" class="ibo-block-print--tab hideable-chapter" chapter-id="'+sId+'"><span class="tab ui-tabs-anchor">' + oHiddeableChapters[sId] + '</span></li>';
//alert(oHiddeableChapters[sId]);
}
sHiddeableChapters += '</ul>';
$('#hiddeable_chapters').html(sHiddeableChapters);
$('.hideable-chapter').click(function(){
var sChapterId = $(this).attr('chapter-id');
$('#'+sChapterId).toggle();
$(this).toggleClass('strikethrough');
});
$('fieldset').each(function() {
var jLegend = $(this).find('legend');
jLegend.remove();
$(this).wrapInner('<span></span>').prepend(jLegend);
});
$('legend').css('cursor', 'pointer').click(function(){
$(this).parent('fieldset').toggleClass('not-printable strikethrough');
});
{% endapply %}