N°3634 - Feedback alpha 3.0 : finish list

This commit is contained in:
acognet
2021-02-18 14:49:28 +01:00
parent 1e18a5ce07
commit 4e0c21a2ac
7 changed files with 174 additions and 138 deletions

View File

@@ -126,24 +126,30 @@ $ibo-datatable--selection-validation-buttons-toolbar--margin-top: 10px !default;
padding-left: $ibo-datatable--paginate--padding-left; padding-left: $ibo-datatable--paginate--padding-left;
} }
.paginate_button { .paginate_button {
display: inline-block; display: inline-block;
box-sizing: border-box; box-sizing: border-box;
} }
.paginate_button a{ .paginate_button a{
@extend %ibo-font-ral-med-100; @extend %ibo-font-ral-med-100;
color: $ibo-datatable--paginate-button--link--color; color: $ibo-datatable--paginate-button--link--color;
} }
.paginate_button a:hover { .paginate_button a:hover {
color: $ibo-datatable--paginate-button--link--hover--color; color: $ibo-datatable--paginate-button--link--hover--color;
} }
.paginate_button.disabled a:hover {
cursor: default;
}
.paginate_button.active a { .paginate_button.active a {
@extend %ibo-font-ral-med-100; @extend %ibo-font-ral-med-100;
color: $ibo-datatable--paginate-button-active--link--color; color: $ibo-datatable--paginate-button-active--link--color;
background-color: $ibo-datatable--paginate-button-active--link--background-color; background-color: $ibo-datatable--paginate-button-active--link--background-color;
padding: $ibo-datatable--paginate-button-active--link--padding-y $ibo-datatable--paginate-button-active--link--padding-x; padding: $ibo-datatable--paginate-button-active--link--padding-y $ibo-datatable--paginate-button-active--link--padding-x;
box-shadow: $ibo-datatable--paginate-button-active--link--box-shadow; box-shadow: $ibo-datatable--paginate-button-active--link--box-shadow;
border-radius: $ibo-border-radius-300; border-radius: $ibo-border-radius-300;
} }
.ibo-datatable thead tr th{ .ibo-datatable thead tr th{
position: relative; position: relative;
@@ -178,4 +184,4 @@ $ibo-datatable--selection-validation-buttons-toolbar--margin-top: 10px !default;
.ibo-datatable--selection-validation-buttons-toolbar { .ibo-datatable--selection-validation-buttons-toolbar {
clear: both; clear: both;
margin-top: $ibo-datatable--selection-validation-buttons-toolbar--margin-top; margin-top: $ibo-datatable--selection-validation-buttons-toolbar--margin-top;
} }

View File

@@ -109,8 +109,16 @@ $ibo-field--value--padding-bottom--is-fullscreen: $ibo-field--label--padding-y--
display: table-cell; display: table-cell;
vertical-align: top; vertical-align: top;
padding-right: 10px; padding-right: 10px;
> input[type="checkbox"] {
margin-left: 5px;
}
} }
.multi_values, .mono_value {
display: inline-block;
padding-left: 5px;
}
/* Fullscreen mode */ /* Fullscreen mode */
.ibo-field-large { .ibo-field-large {
&.ibo-is-fullscreen { &.ibo-is-fullscreen {

View File

@@ -428,16 +428,17 @@ class TableDetailsAttachmentsRenderer extends AbstractAttachmentsRenderer
'uploader' => array('label' => $sFileUploader, 'description' => $sFileUploader), 'uploader' => array('label' => $sFileUploader, 'description' => $sFileUploader),
'type' => array('label' => $sFileType, 'description' => $sFileType), 'type' => array('label' => $sFileType, 'description' => $sFileType),
); );
if($bWithDeleteButton) if ($bWithDeleteButton) {
{ $aAttribs['delete'] = array('label' => '', 'description' => '');
$aAttribs['delete'] = array('label' => '', 'description' => ''); }
}
$oAttachmentTableBlock = DataTableUIBlockFactory::MakeForStaticData('', $aAttribs, $aData);
$oAttachmentTableBlock = DataTableUIBlockFactory::MakeForStaticData('',$aAttribs, $aData);
$oAttachmentTableBlock->AddCSSClass('ibo-attachment--datatable'); $oAttachmentTableBlock->AddCSSClass('ibo-attachment--datatable');
$this->oPage->AddUiBlock($oAttachmentTableBlock); $this->oPage->AddUiBlock($oAttachmentTableBlock);
foreach ($aData as $aRow) {
$this->oPage->add_ready_script($aRow['js']);
}
} }
/** /**
@@ -525,7 +526,8 @@ class TableDetailsAttachmentsRenderer extends AbstractAttachmentsRenderer
'formatted-size' => $sFileFormattedSize, 'formatted-size' => $sFileFormattedSize,
'upload-date' => $sAttachmentDateFormatted, 'upload-date' => $sAttachmentDateFormatted,
'uploader' => $sAttachmentUploader, 'uploader' => $sAttachmentUploader,
'type' => $sFileType 'type' => $sFileType,
'js' => 'CombodoGlobalToolbox.InitTooltipFromMarkup($("#$sTrId [data-tooltip-content]"));',
); );
if ($bWithDeleteButton) if ($bWithDeleteButton)
@@ -536,11 +538,7 @@ class TableDetailsAttachmentsRenderer extends AbstractAttachmentsRenderer
$this->oPage->add_ready_script($oBlockRenderer->RenderJsInline($sDeleteButton::ENUM_JS_TYPE_ON_INIT)); $this->oPage->add_ready_script($oBlockRenderer->RenderJsInline($sDeleteButton::ENUM_JS_TYPE_ON_INIT));
$aAttachmentLine['delete'] = $oBlockRenderer->RenderHtml(); $aAttachmentLine['delete'] = $oBlockRenderer->RenderHtml();
} }
$this->oPage->add_ready_script(
<<<JS
CombodoGlobalToolbox.InitTooltipFromMarkup($('#$sTrId [data-tooltip-content]'));
JS
);
return $aAttachmentLine; return $aAttachmentLine;
} }
} }

View File

@@ -21,36 +21,40 @@ $.fn.dataTable.pipeline = function ( opts ) {
var draw_number = 1; var draw_number = 1;
return function ( request, drawCallback, settings ) { return function ( request, drawCallback, settings ) {
var ajax = false; var ajax = false;
var requestStart = request.start; var requestStart = request.start;
var drawStart = request.start; var drawStart = request.start;
var requestLength = request.length; var requestLength = request.length;
if(request.start=undefined) if (request.start = undefined) {
{ requestStart = settings._iDisplayStart;
requestStart = settings._iDisplayStart; drawStart = settings._iDisplayStart;
drawStart = settings._iDisplayStart;
requestLength = settings._iDisplayLength; requestLength = settings._iDisplayLength;
} }
var requestEnd = requestStart + requestLength; var requestEnd = requestStart+requestLength;
if ( settings.clearCache ) { //Manage case requestLength=-1 => all the row are display
if (requestLength == -1) {
requestLength = cacheLastJson.recordsTotal;
if (cacheLower != 0 || cacheLastJson.recordsTotal > cacheUpper) {
//new server request is mandatory
ajax = true;
}
}
if (settings.clearCache) {
// API requested that the cache be cleared // API requested that the cache be cleared
ajax = true; ajax = true;
settings.clearCache = false; settings.clearCache = false;
} } else if (cacheLower < 0 || requestStart < cacheLower || requestEnd > cacheUpper) {
else if ( cacheLower < 0 || requestStart < cacheLower || requestEnd > cacheUpper ) {
// outside cached data - need to make a request // outside cached data - need to make a request
ajax = true; ajax = true;
} } else if (JSON.stringify(request.order) !== JSON.stringify(cacheLastRequest.order) ||
else if ( JSON.stringify( request.order ) !== JSON.stringify( cacheLastRequest.order ) || JSON.stringify(request.columns) !== JSON.stringify(cacheLastRequest.columns) ||
JSON.stringify( request.columns ) !== JSON.stringify( cacheLastRequest.columns ) || JSON.stringify(request.search) !== JSON.stringify(cacheLastRequest.search)
JSON.stringify( request.search ) !== JSON.stringify( cacheLastRequest.search )
) { ) {
// properties changed (ordering, columns, searching) // properties changed (ordering, columns, searching)
ajax = true; ajax = true;
} } else if (cacheLastJson == undefined || cacheLastJson.length == 0) {
else if(cacheLastJson == undefined || cacheLastJson.length==0)
{
ajax = true; ajax = true;
} }
@@ -97,13 +101,13 @@ $.fn.dataTable.pipeline = function ( opts ) {
"success": function ( json ) { "success": function ( json ) {
cacheLastJson = $.extend(true, {}, json); cacheLastJson = $.extend(true, {}, json);
if ( cacheLower != drawStart ) { if (cacheLower != drawStart && requestLength != -1) {
json.data.splice( 0, drawStart-cacheLower ); json.data.splice(0, drawStart-cacheLower);
} }
if ( requestLength >= -1 ) { if (requestLength >= -1) {
json.data.splice( requestLength, json.data.length ); json.data.splice(requestLength, json.data.length);
} }
drawCallback( json ); drawCallback(json);
} }
} ); } );
} }

View File

@@ -316,7 +316,7 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
'attribute_code' => $sAttCode, 'attribute_code' => $sAttCode,
'attribute_type' => '_key_', 'attribute_type' => '_key_',
'attribute_label' => $aData['alias'], 'attribute_label' => $aData['alias'],
"render" => "return '<a class=\'object-ref-link\' href= \'UI.php?operation=details&class=".$sClassName."&id='+data+'\'>'+row['".$sClassAlias."/friendlyname']+'</a>' ;", "render" => "let displayField = '<span class=\"object-ref\" title=\"".$sClassAlias."::'+data+'\"><a class=\'object-ref-link\' href=\'UI.php?operation=details&class=".$sClassName."&id='+data+'\'>'+row['".$sClassAlias."/friendlyname']+'</a></span>'; if (row['".$sClassAlias."/obsolescence_flag'].indexOf('no') == -1){displayField = '<span class=\"object-ref obsolete\" title=\"obsolete\"><a class=\'object-ref-link\' href=\'UI.php?operation=details&class=".$sClassName."&id='+data+'\'><span class=\"object-ref-icon fas fa-eye-slash object-obsolete fa-1x fa-fw\"></span>'+row['".$sClassAlias."/friendlyname']+'</a></span>';} return displayField;",
]; ];
} }
} else { } else {
@@ -542,7 +542,7 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
'attribute_code' => $sAttCode, 'attribute_code' => $sAttCode,
'attribute_type' => '_key_', 'attribute_type' => '_key_',
'attribute_label' => $aData['alias'], 'attribute_label' => $aData['alias'],
"render" => "return '<a class=\'object-ref-link\' href= \'UI.php?operation=details&class=".$sClassName."&id='+data+'\'>'+row['".$sClassAlias."/friendlyname']+'</a>' ;", "render" => "let displayField = '<span class=\"object-ref\" title=\"".$sClassAlias."::'+data+'\"><a class=\'object-ref-link\' href=\'UI.php?operation=details&class=".$sClassName."&id='+data+'\'>'+row['".$sClassAlias."/friendlyname']+'</a></span>'; if (row['".$sClassAlias."/obsolescence_flag'].indexOf('no') == -1){displayField = '<span class=\"object-ref obsolete\" title=\"obsolete\"><span class=\"object-ref-icon fas fa-eye-slash object-obsolete fa-1x fa-fw\"></span><a class=\'object-ref-link\' href=\'UI.php?operation=details&class=".$sClassName."&id='+data+'\'>'+row['".$sClassAlias."/friendlyname']+'</a></span>';} return displayField;",
]; ];
} }
} else { } else {
@@ -669,7 +669,7 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
]; ];
$aColumnDefinition["data"] = $sClassAlias."/".$sAttCode; $aColumnDefinition["data"] = $sClassAlias."/".$sAttCode;
$aColumnDefinition["render"] = [ $aColumnDefinition["render"] = [
"display" => "return '<a class=\'object-ref-link\' href=\'UI.php?operation=details&class=".$sClassName."&id='+data+'\'>'+row['".$sClassAlias."/friendlyname']+'</a>' ;", "display" => "let displayField = '<span class=\"object-ref\" title=\"".$sClassAlias."::'+data+'\"><a class=\'object-ref-link\' href=\'UI.php?operation=details&class=".$sClassName."&id='+data+'\'>'+row['".$sClassAlias."/friendlyname']+'</a></span>'; if (row['".$sClassAlias."/obsolescence_flag'].indexOf('no') == -1){displayField = '<span class=\"object-ref obsolete\" title=\"obsolete\"><span class=\"object-ref-icon fas fa-eye-slash object-obsolete fa-1x fa-fw\"></span><a class=\'object-ref-link\' href=\'UI.php?operation=details&class=".$sClassName."&id='+data+'\'>'+row['".$sClassAlias."/friendlyname']+'</a></span>';} return displayField;",
"_" => $sClassAlias."/".$sAttCode, "_" => $sClassAlias."/".$sAttCode,
]; ];
} else { } else {

View File

@@ -22,17 +22,21 @@ var maxHeight{{ sListId }} = 300;
if ($('#{{ oUIBlock.GetId() }}').closest('.ui-dialog').length > 0) if ($('#{{ oUIBlock.GetId() }}').closest('.ui-dialog').length > 0)
{ {
//we are in dialogbox //we are in dialogbox
maxHeight{{ sListId }} = $('#{{ oUIBlock.GetId() }}').closest('.ui-dialog').height(); maxHeight{{ sListId }} = $('#{{ oUIBlock.GetId() }}').closest('.ui-dialog-content').height();
a
} }
else else
{ {
maxHeight{{ sListId }} = $(window).height()-$('#ibo-top-container').outerHeight()+$('#ibo-main-content').height()-$('#ibo-main-content').outerHeight(); maxHeight{{ sListId }} = $(window).height()-$('#ibo-top-container').outerHeight()+$('#ibo-main-content').height()-$('#ibo-main-content').outerHeight();
} }
if ($('#{{ oUIBlock.GetId() }}').closest('[data-target=search_results]').parent().find('.ibo-search-form-panel').length > 0) if ($('#{{ oUIBlock.GetId() }}').closest('[data-target=search_results]').parent().find('.ibo-search-form-panel').length > 0)
{ {
//we are in dialogbox //we are in dialogbox
maxHeight{{ sListId }} = maxHeight{{ sListId }}-$('#{{ oUIBlock.GetId() }}').closest('[data-target=search_results]').parent().find('.ibo-search-form-panel').height(); maxHeight{{ sListId }} = maxHeight{{ sListId }}-$('#{{ oUIBlock.GetId() }}').closest('[data-target=search_results]').parent().find('.ibo-search-form-panel').outerHeight();
}
if ($('#{{ oUIBlock.GetId() }}').closest('.ibo-panel--header').length > 0)
{
maxHeight{{ sListId }} = maxHeight{{ sListId }}-$('#{{ oUIBlock.GetId() }}').closest('.ibo-panel--header').outerHeight();
} }
if (maxHeight{{ sListId }} < 300) if (maxHeight{{ sListId }} < 300)
{ {
@@ -42,7 +46,7 @@ else
{ {
maxHeight{{ sListId }} = maxHeight{{ sListId }} -50; maxHeight{{ sListId }} = maxHeight{{ sListId }} -50;
} }
console.warn(maxHeight{{ sListId }});
var oTable{{ sListId }} = $('#{{ oUIBlock.GetId() }}').DataTable({ var oTable{{ sListId }} = $('#{{ oUIBlock.GetId() }}').DataTable({
language: { language: {
processing: "{{ 'UI:Datatables:Language:Processing'|dict_s }}", processing: "{{ 'UI:Datatables:Language:Processing'|dict_s }}",
@@ -182,93 +186,109 @@ var oTable{{ sListId }} = $('#{{ oUIBlock.GetId() }}').DataTable({
} }
}); });
$('#{{ oUIBlock.GetId() }}').closest(".dataTables_scrollBody").css('max-height', maxHeight{{ sListId }}-100);
{% if oUIBlock.GetOption("select_mode") is not empty %} {% if oUIBlock.GetOption("select_mode") is not empty %}
{% if oUIBlock.GetOption("select_mode") != "single" %} {% if oUIBlock.GetOption("select_mode") != "single" %}
oTable{{ sListId }}.off('select').on('select', function (oEvent, dt, type, indexes) { oTable{{ sListId }}.off('select').on('select', function (oEvent, dt, type, indexes) {
let aData = oTable{{ sListId }}.rows(indexes).data().toArray(); let aData = oTable{{ sListId }}.rows(indexes).data().toArray();
if( $(this).closest('.ibo-panel--body').find('[name=selectionMode]').val() === "negative") if ($(this).closest('.ibo-panel--body').find('[name=selectionMode]').val() === "negative")
{ {
// Checking input // Checking input
$('#{{ oUIBlock.GetId() }} tr[role="row"].selected td:first-child input').prop('checked', true); $('#{{ oUIBlock.GetId() }} tr[role="row"].selected td:first-child input').prop('checked', true);
// Saving values in temp array // Saving values in temp array
for (let i in aData) { for (let i in aData)
let iItemId = aData[i].id; {
if (oSelectedItems{{ sListId }}.indexOf(iItemId) > -1) { let iItemId = aData[i].id;
oSelectedItems{{ sListId }}.splice(oSelectedItems{{ sListId }}.indexOf(iItemId), 1); if (oSelectedItems{{ sListId }}.indexOf(iItemId) > -1)
updateDataTableSelection('{{ sListId }}'); {
} oSelectedItems{{ sListId }}.splice(oSelectedItems{{ sListId }}.indexOf(iItemId), 1);
} updateDataTableSelection('{{ sListId }}');
} }
else { }
// Checking input }
$('#{{ oUIBlock.GetId() }} tr[role="row"].selected td:first-child input').prop('checked', true); else
// Saving values in temp array {
for (let i in aData) { // Checking input
let iItemId = aData[i].id; $('#{{ oUIBlock.GetId() }} tr[role="row"].selected td:first-child input').prop('checked', true);
if (oSelectedItems{{ sListId }}.indexOf(iItemId) === -1) { // Saving values in temp array
oSelectedItems{{ sListId }}.push(iItemId); for (let i in aData)
updateDataTableSelection('{{ sListId }}'); {
} let iItemId = aData[i].id;
} if (oSelectedItems{{ sListId }}.indexOf(iItemId) === -1)
} {
}); oSelectedItems{{ sListId }}.push(iItemId);
updateDataTableSelection('{{ sListId }}');
}
}
}
});
oTable{{ sListId }}.off('deselect').on('deselect', function (oEvent, dt, type, indexes) { oTable{{ sListId }}.off('deselect').on('deselect', function (oEvent, dt, type, indexes) {
let aData = oTable{{ sListId }}.rows(indexes).data().toArray(); let aData = oTable{{ sListId }}.rows(indexes).data().toArray();
// Checking input // Checking input
$('#{{ oUIBlock.GetId() }} tr[role="row"]:not(.selected) td:first-child input').prop('checked', false); $('#{{ oUIBlock.GetId() }} tr[role="row"]:not(.selected) td:first-child input').prop('checked', false);
// Saving values in temp array // Saving values in temp array
if ($(this).closest('.ibo-panel--body').find('[name=selectionMode]').val() === "negative") { if ($(this).closest('.ibo-panel--body').find('[name=selectionMode]').val() === "negative")
for (let i in aData) { {
let iItemId = aData[i].id; for (let i in aData)
if (oSelectedItems{{ sListId }}.indexOf(iItemId) === -1) { {
oSelectedItems{{ sListId }}.push(iItemId); let iItemId = aData[i].id;
updateDataTableSelection('{{ sListId }}'); if (oSelectedItems{{ sListId }}.indexOf(iItemId) === -1)
} {
} oSelectedItems{{ sListId }}.push(iItemId);
} else { updateDataTableSelection('{{ sListId }}');
for (let i in aData) { }
let iItemId = aData[i].id; }
if (oSelectedItems{{ sListId }}.indexOf(iItemId) > -1) { }
oSelectedItems{{ sListId }}.splice(oSelectedItems{{ sListId }}.indexOf(iItemId), 1); else
updateDataTableSelection('{{ sListId }}'); {
} for (let i in aData)
} {
} let iItemId = aData[i].id;
}); if (oSelectedItems{{ sListId }}.indexOf(iItemId) > -1)
{% else %} {
oTable{{ sListId }}.off('select').on('select', function (oEvent, dt, type, indexes) { oSelectedItems{{ sListId }}.splice(oSelectedItems{{ sListId }}.indexOf(iItemId), 1);
let aData = oTable{{ sListId }}.rows(indexes).data().toArray(); updateDataTableSelection('{{ sListId }}');
// Checking input }
$('#{{ oUIBlock.GetId() }} tr[role="row"].selected td:first-child input').prop('checked', true); }
// Saving values in temp array }
for (let i in aData) { });
let iItemId = aData[i].id; {% else %}
if (oSelectedItems{{ sListId }}.indexOf(iItemId) === -1) { oTable{{ sListId }}.off('select').on('select', function (oEvent, dt, type, indexes) {
oSelectedItems{{ sListId }}.push(iItemId); let aData = oTable{{ sListId }}.rows(indexes).data().toArray();
updateDataTableSelection('{{ sListId }}'); // Checking input
} $('#{{ oUIBlock.GetId() }} tr[role="row"].selected td:first-child input').prop('checked', true);
} // Saving values in temp array
}); for (let i in aData)
{
let iItemId = aData[i].id;
if (oSelectedItems{{ sListId }}.indexOf(iItemId) === -1)
{
oSelectedItems{{ sListId }}.push(iItemId);
updateDataTableSelection('{{ sListId }}');
}
}
});
oTable{{ sListId }}.off('deselect').on('deselect', function (oEvent, dt, type, indexes) { oTable{{ sListId }}.off('deselect').on('deselect', function (oEvent, dt, type, indexes) {
let aData = oTable{{ sListId }}.rows(indexes).data().toArray(); let aData = oTable{{ sListId }}.rows(indexes).data().toArray();
// Checking input // Checking input
$('#{{ oUIBlock.GetId() }} tr[role="row"]:not(.selected) td:first-child input').prop('checked', false); $('#{{ oUIBlock.GetId() }} tr[role="row"]:not(.selected) td:first-child input').prop('checked', false);
// Saving values in temp array // Saving values in temp array
for (let i in aData) { for (let i in aData)
let iItemId = aData[i].id; {
if (oSelectedItems{{ sListId }}.indexOf(iItemId) > -1) { let iItemId = aData[i].id;
oSelectedItems{{ sListId }}.splice(oSelectedItems{{ sListId }}.indexOf(iItemId), 1); if (oSelectedItems{{ sListId }}.indexOf(iItemId) > -1)
updateDataTableSelection('{{ sListId }}'); {
} oSelectedItems{{ sListId }}.splice(oSelectedItems{{ sListId }}.indexOf(iItemId), 1);
} updateDataTableSelection('{{ sListId }}');
}); }
{% endif %} }
});
{% endif %}
{% if oUIBlock.GetOption('sCountSelector') is not empty %} {% if oUIBlock.GetOption('sCountSelector') is not empty %}
$('#{{ sListId }} [name="selectionCount"]').bind('change', function() { $('#{{ sListId }} [name="selectionCount"]').bind('change', function() {

View File

@@ -25,6 +25,6 @@
{% endfor %} {% endfor %}
</div> </div>
{% if oUIBlock.GetComments() %} {% if oUIBlock.GetComments() %}
<div class="ibo-field--comments">{{ oUIBlock.GetComments() }}</div> <div class="ibo-field--comments">{{ oUIBlock.GetComments()|raw }}</div>
{% endif %} {% endif %}
</div> </div>