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;
}
.paginate_button {
display: inline-block;
box-sizing: border-box;
display: inline-block;
box-sizing: border-box;
}
.paginate_button a{
@extend %ibo-font-ral-med-100;
color: $ibo-datatable--paginate-button--link--color;
}
.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 {
@extend %ibo-font-ral-med-100;
color: $ibo-datatable--paginate-button-active--link--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;
box-shadow: $ibo-datatable--paginate-button-active--link--box-shadow;
border-radius: $ibo-border-radius-300;
@extend %ibo-font-ral-med-100;
color: $ibo-datatable--paginate-button-active--link--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;
box-shadow: $ibo-datatable--paginate-button-active--link--box-shadow;
border-radius: $ibo-border-radius-300;
}
.ibo-datatable thead tr th{
position: relative;
@@ -178,4 +184,4 @@ $ibo-datatable--selection-validation-buttons-toolbar--margin-top: 10px !default;
.ibo-datatable--selection-validation-buttons-toolbar {
clear: both;
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;
vertical-align: top;
padding-right: 10px;
> input[type="checkbox"] {
margin-left: 5px;
}
}
.multi_values, .mono_value {
display: inline-block;
padding-left: 5px;
}
/* Fullscreen mode */
.ibo-field-large {
&.ibo-is-fullscreen {

View File

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

View File

@@ -21,36 +21,40 @@ $.fn.dataTable.pipeline = function ( opts ) {
var draw_number = 1;
return function ( request, drawCallback, settings ) {
var ajax = false;
var requestStart = request.start;
var drawStart = request.start;
var ajax = false;
var requestStart = request.start;
var drawStart = request.start;
var requestLength = request.length;
if(request.start=undefined)
{
requestStart = settings._iDisplayStart;
drawStart = settings._iDisplayStart;
if (request.start = undefined) {
requestStart = settings._iDisplayStart;
drawStart = settings._iDisplayStart;
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
ajax = true;
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
ajax = true;
}
else if ( JSON.stringify( request.order ) !== JSON.stringify( cacheLastRequest.order ) ||
JSON.stringify( request.columns ) !== JSON.stringify( cacheLastRequest.columns ) ||
JSON.stringify( request.search ) !== JSON.stringify( cacheLastRequest.search )
} else if (JSON.stringify(request.order) !== JSON.stringify(cacheLastRequest.order) ||
JSON.stringify(request.columns) !== JSON.stringify(cacheLastRequest.columns) ||
JSON.stringify(request.search) !== JSON.stringify(cacheLastRequest.search)
) {
// properties changed (ordering, columns, searching)
ajax = true;
}
else if(cacheLastJson == undefined || cacheLastJson.length==0)
{
} else if (cacheLastJson == undefined || cacheLastJson.length == 0) {
ajax = true;
}
@@ -97,13 +101,13 @@ $.fn.dataTable.pipeline = function ( opts ) {
"success": function ( json ) {
cacheLastJson = $.extend(true, {}, json);
if ( cacheLower != drawStart ) {
json.data.splice( 0, drawStart-cacheLower );
if (cacheLower != drawStart && requestLength != -1) {
json.data.splice(0, drawStart-cacheLower);
}
if ( requestLength >= -1 ) {
json.data.splice( requestLength, json.data.length );
if (requestLength >= -1) {
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_type' => '_key_',
'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 {
@@ -542,7 +542,7 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
'attribute_code' => $sAttCode,
'attribute_type' => '_key_',
'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 {
@@ -669,7 +669,7 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
];
$aColumnDefinition["data"] = $sClassAlias."/".$sAttCode;
$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,
];
} else {

View File

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

View File

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