mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-22 10:08:45 +02:00
N°3905 - Polishing: CSV Import
This commit is contained in:
@@ -35,9 +35,9 @@ $ibo-field--value-decoration--spacing-x: 0.5rem !default;
|
|||||||
|
|
||||||
/* Avoid value to overflow from its container with very long strings (typically URLs) */
|
/* Avoid value to overflow from its container with very long strings (typically URLs) */
|
||||||
/* Note: Some types of attribute must be excluding as it can alter their rendering */
|
/* Note: Some types of attribute must be excluding as it can alter their rendering */
|
||||||
&:not([data-attribute-type="AttributeBlob"]):not([data-attribute-type="AttributeFile"]):not([data-attribute-type="AttributeImage"]) {
|
&:not([data-attribute-type="AttributeBlob"]):not([ data-attribute-type = "AttributeFile" ]):not([ data-attribute-type = "AttributeImage" ]):not(.ibo-input-file-select--container) {
|
||||||
/* We need the rule to apply for the class and all its descendants */
|
/* We need the rule to apply for the class and all its descendants */
|
||||||
.ibo-field--value {
|
. ibo-field--value {
|
||||||
* {
|
* {
|
||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -120,7 +120,6 @@ function GetMappingForField($sClassName, $sFieldName, $iFieldIndex, $bAdvancedMo
|
|||||||
$aChoices['id'] = Dict::S('UI:CSVImport:idField');
|
$aChoices['id'] = Dict::S('UI:CSVImport:idField');
|
||||||
}
|
}
|
||||||
foreach (MetaModel::ListAttributeDefs($sClassName) as $sAttCode => $oAttDef) {
|
foreach (MetaModel::ListAttributeDefs($sClassName) as $sAttCode => $oAttDef) {
|
||||||
$sStar = '';
|
|
||||||
if ($oAttDef->IsExternalKey()) {
|
if ($oAttDef->IsExternalKey()) {
|
||||||
if (($sFieldName == $oAttDef->GetLabel()) || ($sFieldName == $sAttCode)) {
|
if (($sFieldName == $oAttDef->GetLabel()) || ($sFieldName == $sAttCode)) {
|
||||||
$sFieldCode = $sAttCode;
|
$sFieldCode = $sAttCode;
|
||||||
@@ -128,10 +127,6 @@ function GetMappingForField($sClassName, $sFieldName, $iFieldIndex, $bAdvancedMo
|
|||||||
if ($bAdvancedMode) {
|
if ($bAdvancedMode) {
|
||||||
$aChoices[$sAttCode] = $oAttDef->GetLabel();
|
$aChoices[$sAttCode] = $oAttDef->GetLabel();
|
||||||
}
|
}
|
||||||
$oExtKeyAttDef = MetaModel::GetAttributeDef($sClassName, $oAttDef->GetKeyAttCode());
|
|
||||||
if (!$oExtKeyAttDef->IsNullAllowed()) {
|
|
||||||
$sStar = '*';
|
|
||||||
}
|
|
||||||
// Get fields of the external class that are considered as reconciliation keys
|
// Get fields of the external class that are considered as reconciliation keys
|
||||||
$sTargetClass = $oAttDef->GetTargetClass();
|
$sTargetClass = $oAttDef->GetTargetClass();
|
||||||
foreach (MetaModel::ListAttributeDefs($sTargetClass) as $sTargetAttCode => $oTargetAttDef) {
|
foreach (MetaModel::ListAttributeDefs($sTargetClass) as $sTargetAttCode => $oTargetAttDef) {
|
||||||
@@ -151,7 +146,7 @@ function GetMappingForField($sClassName, $sFieldName, $iFieldIndex, $bAdvancedMo
|
|||||||
$aChoices[$sAttCode.'->'.$sTargetAttCode] = MetaModel::GetLabel($sClassName, $sAttCode.'->'.$sTargetAttCode, true);
|
$aChoices[$sAttCode.'->'.$sTargetAttCode] = MetaModel::GetLabel($sClassName, $sAttCode.'->'.$sTargetAttCode, true);
|
||||||
foreach ($aSignatures as $sSignature) {
|
foreach ($aSignatures as $sSignature) {
|
||||||
if (strcasecmp($sFieldName, $sSignature) == 0) {
|
if (strcasecmp($sFieldName, $sSignature) == 0) {
|
||||||
$sFieldCode = $sAttCode.'->'.$sTargetAttCode.$sStar;
|
$sFieldCode = $sAttCode.'->'.$sTargetAttCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,12 +148,25 @@ class StaticTable extends UIContentBlock
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $aOptions
|
* @param array $aOptions
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function SetOptions($aOptions)
|
public function SetOptions($aOptions)
|
||||||
{
|
{
|
||||||
$this->aOptions = $aOptions;
|
$this->aOptions = $aOptions;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $aOptions
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function AddOption($sName, $sValue)
|
||||||
|
{
|
||||||
|
$this->aOptions[$sName] = $sValue;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -41,8 +41,8 @@ var oTable{{ sListIDForVarSuffix }} = $('#{{ oUIBlock.GetId() }}').DataTable({
|
|||||||
},
|
},
|
||||||
scrollX: true,
|
scrollX: true,
|
||||||
{% if oUIBlock.GetOption('sMaxHeight') is not empty %}
|
{% if oUIBlock.GetOption('sMaxHeight') is not empty %}
|
||||||
scrollY: "{{ oUIBlock.GetOption('sMaxHeight') }}",
|
scrollY: {{ oUIBlock.GetOption('sMaxHeight') }},
|
||||||
scrollCollapse: true,
|
scrollCollapse: true,
|
||||||
{% endif %}
|
{% endif %}
|
||||||
lengthMenu: [[ {{ iPageSize }}, {{ iPageSize*2 }}, {{ iPageSize*3 }}, {{ iPageSize*4 }}, -1], [ {{ iPageSize }}, {{ iPageSize*2 }}, {{ iPageSize*3 }}, {{ iPageSize*4 }}, "{{ 'UI:Datatables:Language:DisplayLength:All'|dict_s }}"]],
|
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>>",
|
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>>",
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ var table{{ sListIDForVarSuffix }} = $('#{{ oUIBlock.GetId() }}').DataTable({
|
|||||||
},
|
},
|
||||||
scrollX: true,
|
scrollX: true,
|
||||||
scrollCollapse: true,
|
scrollCollapse: true,
|
||||||
|
{% if oUIBlock.GetOption('sMaxHeight') is not empty %}
|
||||||
|
scrollY: {{ oUIBlock.GetOption('sMaxHeight') }},
|
||||||
|
{% endif %}
|
||||||
paging: false,
|
paging: false,
|
||||||
filter: false,
|
filter: false,
|
||||||
autoWidth: false,
|
autoWidth: false,
|
||||||
@@ -26,27 +29,34 @@ var table{{ sListIDForVarSuffix }} = $('#{{ oUIBlock.GetId() }}').DataTable({
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
drawCallback: function () {
|
drawCallback: function () {
|
||||||
// Hiding pagination if only one page
|
// Hiding pagination if only one page
|
||||||
if ($(this).closest('.dataTables_wrapper').find('.dataTables_paginate:last .paginate_button:not(.previous):not(.next)').length < 2) {
|
if ($(this).closest('.dataTables_wrapper').find('.dataTables_paginate:last .paginate_button:not(.previous):not(.next)').length < 2)
|
||||||
|
{
|
||||||
$(this).closest('.dataTables_wrapper').find('.dataTables_paginate, .dataTables_info').hide();
|
$(this).closest('.dataTables_wrapper').find('.dataTables_paginate, .dataTables_info').hide();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$(this).closest('.dataTables_wrapper').find('.dataTables_paginate, .dataTables_info').show();
|
$(this).closest('.dataTables_wrapper').find('.dataTables_paginate, .dataTables_info').show();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
createdRow: function( row, data, dataIndex ) {
|
createdRow: function (row, data, dataIndex) {
|
||||||
if (data['@class'] !== undefined) {
|
if (data['@class'] !== undefined)
|
||||||
|
{
|
||||||
$(row).addClass(data['@class']);
|
$(row).addClass(data['@class']);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if ($('#{{ oUIBlock.GetId() }}').find('thead').is(':visible')) {
|
|
||||||
|
if ($('#{{ oUIBlock.GetId() }}').find('thead').is(':visible'))
|
||||||
|
{
|
||||||
table{{ sListIDForVarSuffix }}.columns.adjust().draw();
|
table{{ sListIDForVarSuffix }}.columns.adjust().draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(window.ResizeObserver){
|
if (window.ResizeObserver)
|
||||||
|
{
|
||||||
let oFromTable{{ sListIDForVarSuffix }}ResizeTimeout = null;
|
let oFromTable{{ sListIDForVarSuffix }}ResizeTimeout = null;
|
||||||
const oFromTable{{ sListIDForVarSuffix }}Resize = new ResizeObserver(function(){
|
const oFromTable{{ sListIDForVarSuffix }}Resize = new ResizeObserver(function () {
|
||||||
clearTimeout(oFromTable{{ sListIDForVarSuffix }}ResizeTimeout);
|
clearTimeout(oFromTable{{ sListIDForVarSuffix }}ResizeTimeout);
|
||||||
oFromTable{{ sListIDForVarSuffix }}ResizeTimeout = setTimeout(function(){
|
oFromTable{{ sListIDForVarSuffix }}ResizeTimeout = setTimeout(function () {
|
||||||
$('#{{ oUIBlock.GetId() }}').DataTable().columns.adjust();
|
$('#{{ oUIBlock.GetId() }}').DataTable().columns.adjust();
|
||||||
}, 120);
|
}, 120);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ $('#{{ oUIBlock.GetId() }}').DataTable({
|
|||||||
},
|
},
|
||||||
scrollX: true,
|
scrollX: true,
|
||||||
{% if oUIBlock.GetOption('sMaxHeight') is not empty %}
|
{% if oUIBlock.GetOption('sMaxHeight') is not empty %}
|
||||||
scrollY: "{{ oUIBlock.GetOption('sMaxHeight') }}",
|
scrollY: {{ oUIBlock.GetOption('sMaxHeight') }},
|
||||||
scrollCollapse: true,
|
scrollCollapse: true,
|
||||||
{% endif %}
|
{% endif %}
|
||||||
order: [],
|
order: [],
|
||||||
autoWidth: false,
|
autoWidth: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user