mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°3912 - Polishing: Export
This commit is contained in:
@@ -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('</br>'));
|
||||
|
||||
$sFormatInput = '<input type="text" size="15" name="date_format" id="excel_custom_date_time_format" title="" value="'.htmlentities($sDateTimeFormat, ENT_QUOTES, 'UTF-8').'"/>';
|
||||
$oRadioCustom = InputUIBlockFactory::MakeForInputWithLabel(Dict::Format('Core:BulkExport:DateTimeFormatCustom_Format', $sFormatInput), "csv_custom_date_time_format", "custom", "csv_date_time_format_custom", "radio");
|
||||
$sFormatInput = '<input type="text" size="15" name="date_format" id="csv_custom_date_time_format" title="" value="'.htmlentities($sDateTimeFormat, ENT_QUOTES, 'UTF-8').'"/>';
|
||||
$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');
|
||||
|
||||
@@ -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('</br>'));
|
||||
|
||||
$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('</br>'));
|
||||
|
||||
$sFormatInput = '<input type="text" size="15" name="date_format" id="excel_custom_date_time_format" title="" value="'.htmlentities($sDateTimeFormat, ENT_QUOTES, 'UTF-8').'"/>';
|
||||
$oRadioCustom = InputUIBlockFactory::MakeForInputWithLabel(Dict::Format('Core:BulkExport:DateTimeFormatCustom_Format', $sFormatInput), "pdf_custom_date_time_format", "custom", "pdf_date_time_format_custom", "radio");
|
||||
$sFormatInput = '<input type="text" size="15" name="date_format" id="pdf_custom_date_time_format" title="" value="'.htmlentities($sDateTimeFormat, ENT_QUOTES, 'UTF-8').'"/>';
|
||||
$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);
|
||||
|
||||
@@ -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<br/>'+data.responseText);
|
||||
});
|
||||
}
|
||||
|
||||
function ExportError(sMessage) {
|
||||
|
||||
11
js/utils.js
11
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<br/>'+data.responseText);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -490,14 +490,11 @@ function ExportRun(data) {
|
||||
sMessage = '<a href="'+GetAbsoluteUrlAppRoot()+'pages/ajax.render.php?operation=export_download&token='+data.token+'" target="_blank">'+data.message+'</a>';
|
||||
$('.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');
|
||||
|
||||
@@ -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 .= "<style>\n".implode("\n", $this->a_styles)."\n</style>\n";
|
||||
}
|
||||
$sHtml = '';
|
||||
if (count($this->a_styles) > 0) {
|
||||
$sHtml .= "<style>\n".implode("\n", $this->a_styles)."\n</style>\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
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user