diff --git a/core/csvbulkexport.class.inc.php b/core/csvbulkexport.class.inc.php index d50f841c0..36eb3cf71 100644 --- a/core/csvbulkexport.class.inc.php +++ b/core/csvbulkexport.class.inc.php @@ -211,15 +211,15 @@ class CSVBulkExport extends TabularBulkExport $sDefaultFormat = htmlentities((string)AttributeDateTime::GetFormat(), ENT_QUOTES, 'UTF-8'); $sExample = htmlentities(date((string)AttributeDateTime::GetFormat()), ENT_QUOTES, 'UTF-8'); - $oRadioDefault = InputUIBlockFactory::MakeForInputWithLabel(Dict::Format('Core:BulkExport:DateTimeFormatDefault_Example', $sDefaultFormat, $sExample), "csv_custom_date_time_format", "default", "csv_date_time_format_default", "radio"); + $oRadioDefault = InputUIBlockFactory::MakeForInputWithLabel(Dict::Format('Core:BulkExport:DateTimeFormatDefault_Example', $sDefaultFormat, $sExample), "csv_date_format_radio", "default", "csv_date_time_format_default", "radio"); $oRadioDefault->GetInput()->SetIsChecked(($sDateTimeFormat == (string)AttributeDateTime::GetFormat())); $oRadioDefault->SetBeforeInput(false); $oRadioDefault->GetInput()->AddCSSClass('ibo-input-checkbox'); $oFieldSetDate->AddSubBlock($oRadioDefault); $oFieldSetDate->AddSubBlock(new Html('
')); - $sFormatInput = ''; - $oRadioCustom = InputUIBlockFactory::MakeForInputWithLabel(Dict::Format('Core:BulkExport:DateTimeFormatCustom_Format', $sFormatInput), "csv_custom_date_time_format", "custom", "csv_date_time_format_custom", "radio"); + $sFormatInput = ''; + $oRadioCustom = InputUIBlockFactory::MakeForInputWithLabel(Dict::Format('Core:BulkExport:DateTimeFormatCustom_Format', $sFormatInput), "csv_date_format_radio", "custom", "csv_date_time_format_custom", "radio"); $oRadioCustom->GetInput()->SetIsChecked($sDateTimeFormat !== (string)AttributeDateTime::GetFormat()); $oRadioCustom->SetBeforeInput(false); $oRadioCustom->GetInput()->AddCSSClass('ibo-input-checkbox'); diff --git a/core/pdfbulkexport.class.inc.php b/core/pdfbulkexport.class.inc.php index f1310cfaa..f40fa77c9 100644 --- a/core/pdfbulkexport.class.inc.php +++ b/core/pdfbulkexport.class.inc.php @@ -56,7 +56,7 @@ class PDFBulkExport extends HTMLBulkExport //page format $oSelectFormat = SelectUIBlockFactory::MakeForSelectWithLabel("page_size", Dict::S('Core:BulkExport:PDFPageSize')); $oSelectFormat->SetIsLabelBefore(false); - $oSelectFormat->AddCSSClass('ibo-input-checkbox'); + //$oSelectFormat->AddCSSClass('ibo-input-checkbox'); $oFieldSetFormat->AddSubBlock($oSelectFormat); $aPossibleFormat = ['A3', 'A4', 'Letter']; @@ -66,10 +66,10 @@ class PDFBulkExport extends HTMLBulkExport } $oFieldSetFormat->AddSubBlock(new Html('
')); - $oSelectOrientation = SelectUIBlockFactory::MakeForSelectWithLabel("page_size", + $oSelectOrientation = SelectUIBlockFactory::MakeForSelectWithLabel("page_orientation", Dict::S('Core:BulkExport:PDFPageOrientation')); $oSelectOrientation->SetIsLabelBefore(false); - $oSelectOrientation->AddCSSClass('ibo-input-checkbox'); + //$oSelectOrientation->AddCSSClass('ibo-input-checkbox'); $oFieldSetFormat->AddSubBlock($oSelectOrientation); $aPossibleOrientation = ['P', 'L']; @@ -86,15 +86,15 @@ class PDFBulkExport extends HTMLBulkExport $sDefaultFormat = htmlentities((string)AttributeDateTime::GetFormat(), ENT_QUOTES, 'UTF-8'); $sExample = htmlentities(date((string)AttributeDateTime::GetFormat()), ENT_QUOTES, 'UTF-8'); - $oRadioDefault = InputUIBlockFactory::MakeForInputWithLabel(Dict::Format('Core:BulkExport:DateTimeFormatDefault_Example', $sDefaultFormat, $sExample), "pdf_custom_date_time_format", "default", "pdf_date_time_format_default", "radio"); + $oRadioDefault = InputUIBlockFactory::MakeForInputWithLabel(Dict::Format('Core:BulkExport:DateTimeFormatDefault_Example', $sDefaultFormat, $sExample), "pdf_date_format_radio", "default", "pdf_date_time_format_default", "radio"); $oRadioDefault->GetInput()->SetIsChecked(($sDateTimeFormat == (string)AttributeDateTime::GetFormat())); $oRadioDefault->SetBeforeInput(false); $oRadioDefault->GetInput()->AddCSSClass('ibo-input-checkbox'); $oFieldSetDate->AddSubBlock($oRadioDefault); $oFieldSetDate->AddSubBlock(new Html('
')); - $sFormatInput = ''; - $oRadioCustom = InputUIBlockFactory::MakeForInputWithLabel(Dict::Format('Core:BulkExport:DateTimeFormatCustom_Format', $sFormatInput), "pdf_custom_date_time_format", "custom", "pdf_date_time_format_custom", "radio"); + $sFormatInput = ''; + $oRadioCustom = InputUIBlockFactory::MakeForInputWithLabel(Dict::Format('Core:BulkExport:DateTimeFormatCustom_Format', $sFormatInput), "pdf_date_format_radio", "custom", "pdf_date_time_format_custom", "radio"); $oRadioCustom->GetInput()->SetIsChecked($sDateTimeFormat !== (string)AttributeDateTime::GetFormat()); $oRadioCustom->SetBeforeInput(false); $oRadioCustom->GetInput()->AddCSSClass('ibo-input-checkbox'); @@ -184,9 +184,8 @@ EOF $sData = parent::GetFooter(); // We need a lot of time for the PDF conversion - set_time_limit(60*10); // 10 minutes max ??? - - require_once(APPROOT.'application/pdfpage.class.inc.php'); + set_time_limit(60 * 10); // 10 minutes max ??? + $oPage = new PDFPage(Dict::Format('Core:BulkExportOf_Class', MetaModel::GetName($this->oSearch->GetClass())), $this->aStatusInfo['page_size'], $this->aStatusInfo['page_orientation']); $oPDF = $oPage->get_tcpdf(); $oPDF->SetFontSize(8); diff --git a/datamodels/2.x/itop-portal-base/portal/public/js/export.js b/datamodels/2.x/itop-portal-base/portal/public/js/export.js index 771fb252e..456402fbc 100644 --- a/datamodels/2.x/itop-portal-base/portal/public/js/export.js +++ b/datamodels/2.x/itop-portal-base/portal/public/js/export.js @@ -17,22 +17,21 @@ */ function ExportStartExport() { - var oParams = {}; - oParams.operation = 'export_build_portal'; - oParams.format = sFormat; - oParams.token = sToken; - oParams.start = 1; - $.post(GetAbsoluteUrlAppRoot() + 'pages/ajax.render.php', oParams, function (data) { - if (data == null) { - ExportError('Export failed (no data provided), please contact your administrator'); - } - else { - ExportRun(data); - } - }, 'json') - .fail(function () { - ExportError('Export failed, please contact your administrator'); - }); + var oParams = {}; + oParams.operation = 'export_build_portal'; + oParams.format = sFormat; + oParams.token = sToken; + oParams.start = 1; + $.post(GetAbsoluteUrlAppRoot()+'pages/ajax.render.php', oParams, function (data) { + if (data == null) { + ExportError('Export failed (no data provided), please contact your administrator'); + } else { + ExportRun(data); + } + }, 'json') + .fail(function (data) { + ExportError('Export failed, please contact your administrator
'+data.responseText); + }); } function ExportError(sMessage) { diff --git a/js/utils.js b/js/utils.js index ed2229231..67159f307 100644 --- a/js/utils.js +++ b/js/utils.js @@ -453,8 +453,8 @@ function ExportStartExport() { ExportRun(data); } }, 'json') - .fail(function () { - ExportError('Export failed, please contact your administrator'); + .fail(function (data) { + ExportError('Export failed, please contact your administrator
'+data.responseText); }); } @@ -490,14 +490,11 @@ function ExportRun(data) { sMessage = ''+data.message+''; $('.export-message').html(sMessage); $('.export-progress-bar').hide(); - $('#export-btn').hide(); $('#export-form').attr('data-state', 'done'); if (data.text_result != undefined) { if (data.mime_type == 'text/html') { $('#export_content').parent().html(data.text_result); - $('#export_text_result').show(); - //$('#export_text_result .listResults').tableHover(); - $('#export_text_result .listResults').tablesorter({widgets: ['myZebra']}); + $('#export_text_result').removeClass('ibo-is-hidden'); } else { if ($('#export_text_result').closest('ui-dialog').length == 0) { // not inside a dialog box, adjust the height... approximately @@ -511,7 +508,7 @@ function ExportRun(data) { $('#export_content').height(iTotalHeight-80); } $('#export_content').val(data.text_result); - $('#export_text_result').show(); + $('#export_text_result').removeClass('ibo-is-hidden'); } } $('#export-dlg-submit').button('option', 'label', Dict.S('UI:Button:Done')).button('enable'); diff --git a/sources/application/WebPage/PDFPage.php b/sources/application/WebPage/PDFPage.php index 246ab3efd..403c51ed8 100644 --- a/sources/application/WebPage/PDFPage.php +++ b/sources/application/WebPage/PDFPage.php @@ -17,6 +17,8 @@ * You should have received a copy of the GNU Affero General Public License */ +use Combodo\iTop\Renderer\BlockRenderer; + /** * Special class of WebPage for printing into a PDF document @@ -107,17 +109,16 @@ EOF */ public function flush() { - if (strlen($this->s_content) > 0) - { - $sHtml = ''; - if (count($this->a_styles) > 0) - { - $sHtml .= "\n"; - } + $sHtml = ''; + if (count($this->a_styles) > 0) { + $sHtml .= "\n"; + } + if (strlen($this->s_content) > 0) { $sHtml .= $this->s_content; - $this->oPdf->writeHTML($sHtml); // The style(s) must be supplied each time we call writeHtml $this->s_content = ''; } + $sHtml .= BlockRenderer::RenderBlockTemplates($this->oContentLayout); + $this->oPdf->writeHTML($sHtml); // The style(s) must be supplied each time we call writeHtml } /** diff --git a/webservices/export-v2.php b/webservices/export-v2.php index acab94c5e..a8793427e 100644 --- a/webservices/export-v2.php +++ b/webservices/export-v2.php @@ -294,7 +294,7 @@ EOF $aSupportedFormats = BulkExport::FindSupportedFormats(); asort($aSupportedFormats); foreach ($aSupportedFormats as $sFormatCode => $sLabel) { - $oSelect->AddSubBlock(SelectOptionUIBlockFactory::MakeForSelectOption($sFormatCode, htmlentities($sLabel, ENT_QUOTES, 'UTF-8'), ($sFormatCode == $sDefaultFormat))); + $oSelect->AddSubBlock(SelectOptionUIBlockFactory::MakeForSelectOption($sFormatCode, $sLabel, ($sFormatCode == $sDefaultFormat))); $oExporter = BulkExport::FindExporter($sFormatCode); $oExporter->SetObjectList($oExportSearch); $aParts = $oExporter->EnumFormParts(); @@ -329,7 +329,7 @@ EOF if ($sFormat == null) {//if it's global export $oP->AddSubBlock(ButtonUIBlockFactory::MakeForPrimaryAction('export', Dict::S('UI:Button:Export'), 'export', false, 'export-btn')); } - $oBlockResult = UIContentBlockUIBlockFactory::MakeStandard("export-export_text_result")->SetIsHidden(true); + $oBlockResult = UIContentBlockUIBlockFactory::MakeStandard("export_text_result")->SetIsHidden(true); $oBlockResult->AddSubBlock(new Html(Dict::S('Core:BulkExport:ExportResult'))); $oTextArea = new TextArea('export_content', '', 'export_content');