N°3123 - Refactor Directories

This commit is contained in:
Eric
2020-12-02 13:18:01 +01:00
parent d1b12ee04b
commit 15aa9e508c
259 changed files with 862 additions and 869 deletions

View File

@@ -0,0 +1,7 @@
<div id="{{ oUIBlock.GetId() }}" class="ibo-alert ibo-is-{{ oUIBlock.GetColor() }} ibo-is-opened">
<div class="ibo-alert--action-button ibo-alert--maximize-button" data-role="ibo-alert--maximize-button"><i class="fas fa-caret-down"></i></div>
<div class="ibo-alert--action-button ibo-alert--minimize-button" data-role="ibo-alert--minimize-button"><i class="fas fa-caret-up"></i></div>
<div class="ibo-alert--action-button ibo-alert--close-button" data-role="ibo-alert--close-button"><i class="fas fa-times"></i></div>
<div class="ibo-alert--title">{{ oUIBlock.GetTitle() }}</div>
<div class="ibo-alert--body">{{ oUIBlock.GetContent()|raw }}</div>
</div>

View File

@@ -0,0 +1 @@
$('#{{ oUIBlock.GetId() }}').alert();

View File

@@ -0,0 +1,3 @@
{# @copyright Copyright (C) 2010-2020 Combodo SARL #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
{% extends "base/layouts/content-block/layout.html.twig" %}

View File

@@ -0,0 +1 @@
<div id="{{ oUIBlock.GetId() }}" class="ibo-breadcrumbs"></div>

View File

@@ -0,0 +1 @@
$('#{{ oUIBlock.GetId() }}').breadcrumbs({{ oUIBlock.GetJsWidgetOptions()|json_encode|raw }});

View File

@@ -0,0 +1,16 @@
<button id="{{ oUIBlock.GetId() }}"
class="ibo-button ibo-is-{{ oUIBlock.GetActionType() }} ibo-is-{{ oUIBlock.GetColor() }} {{ oUIBlock.GetAdditionalCSSClass() }}"
data-role="ibo-button"
type="{{ oUIBlock.GetType() }}"
name="{{ oUIBlock.GetName() }}"
value="{{ oUIBlock.GetValue() }}"
{% if oUIBlock.IsDisabled() is same as(true) %} disabled {% endif %}
{% if oUIBlock.GetTooltip() is not empty %} data-tooltip-content="{{ oUIBlock.GetTooltip() }}" {% endif %}
>
{% if oUIBlock.GetIconClass() is not empty %}
<span class="ibo-button--icon {{ oUIBlock.GetIconClass() }}"></span>
{% endif %}
{% if oUIBlock.GetLabel() is not empty %}
<span class="ibo-button--label">{{ oUIBlock.GetLabel() }}</span>
{% endif %}
</button>

View File

@@ -0,0 +1,10 @@
{% if (oUIBlock.GetOnClickJsCode() is not empty) or (oUIBlock.GetJsCode() is not empty) %}
{% if oUIBlock.GetOnClickJsCode() is not empty %}
$('#{{ oUIBlock.GetId() }}').on('click', function () {
{{ oUIBlock.GetOnClickJsCode()|raw }}
})
{% endif %}
{% if oUIBlock.GetJsCode() is not empty %}
{{ oUIBlock.GetJsCode()|raw }}
{% endif %}
{% endif %}

View File

@@ -0,0 +1,21 @@
{# @copyright Copyright (C) 2010-2020 Combodo SARL #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
{% apply spaceless %}
<div class="ibo-dashlet-badge--body">
<div class="ibo-dashlet-badge--icon-container">
<img class="ibo-dashlet-badge--icon" src="{{ oUIBlock.GetClassIconUrl() }}"/>
</div>
<div class="ibo-dashlet-badge--actions">
<a class="ibo-dashlet-badge--action-list" href="{{ oUIBlock.GetHyperlink() }}">
<span class="ibo-dashlet-badge--action-list-count">{{ oUIBlock.GetCount() }}</span>
<span class="ibo-dashlet-badge--action-list-label">{{ oUIBlock.GetClassLabel() }}</span>
</a>
{% if oUIBlock.GetCreateActionUrl() is not empty %}
<a class="ibo-dashlet-badge--action-create" href="{{ oUIBlock.GetCreateActionUrl() }}">
<span class="ibo-dashlet-badge--action-create-icon fas fa-plus"></span>
<span class="ibo-dashlet-badge--action-create-label">{{ oUIBlock.GetCreateActionLabel() }}</span>
</a>
{% endif %}
</div>
</div>
{% endapply %}

View File

@@ -0,0 +1,17 @@
{# @copyright Copyright (C) 2010-2020 Combodo SARL #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
{% apply spaceless %}
<div class="ibo-dashlet-header-static">
<div class="ibo-dashlet-header-static--body">
{% if oUIBlock.GetIconUrl() is not empty %}
<div class="ibo-dashlet-header-static--icon-container">
<img class="ibo-dashlet-header-static--icon" src="{{ oUIBlock.GetIconUrl() }}" alt="{{ oUIBlock.GetTitle() }}"/>
</div>
{% endif %}
{% if oUIBlock.GetTitle() is not empty %}
<div class="ibo-dashlet-header-static--title">{{ oUIBlock.GetTitle() }}</div>
{% endif %}
<div class="ibo-dashlet-header-static--text">{{ oUIBlock.GetText() }}</div>
</div>
</div>
{% endapply %}

View File

@@ -0,0 +1,5 @@
{# @copyright Copyright (C) 2010-2020 Combodo SARL #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
{% apply spaceless %}
{% endapply %}

View File

@@ -0,0 +1,44 @@
<div id="datatable_dlg_{{ oUIBlock.GetTableId() }}" style="display: none; background : white;" class="{{ oUIBlock.GetBlockCode() }}">
<input type="hidden" name="action" value="none"/>
<form id="form_{{ oUIBlock.GetTableId() }}" onsubmit="return false">
<p>
<input id="dtbl_dlg_settings_{{ oUIBlock.GetTableId() }}" type="radio" name="settings" {% if (oUIBlock.GetOption("bUseCustomSettings") == false) %} checked {% endif %} value="defaults">
<label for="dtbl_dlg_settings_{{ oUIBlock.GetTableId() }}">&nbsp;{{ 'UI:UseDefaultSettings'|dict_s }}</label>
</p>
<fieldset>
<legend class="transparent">
<input id="dtbl_dlg_specific_{{ oUIBlock.GetTableId() }}" type="radio" class="specific_settings" name="settings" {% if oUIBlock.GetOption("bUseCustomSettings") %} checked {% endif %} value="specific">
<label for="dtbl_dlg_specific_{{ oUIBlock.GetTableId() }}">&nbsp;&nbsp;{{ 'UI:UseSpecificSettings'|dict_s }}</label>
</legend>
{{ 'UI:ColumnsAndSortOrder'|dict_s }}<br/>
<ul class="sortable_field_list" id="sfl_{{ oUIBlock.GetTableId() }}">
</ul>
<p> {{ 'UI:Display_X_ItemsPerPage_prefix'|dict_s }}<input type="text" size="4" name="page_size" value="{{ oUIBlock.GetOption("iPageSize") }}">{{ 'UI:Display_X_ItemsPerPage_suffix'|dict_s }}</p>
</fieldset>
<fieldset>
<legend class="transparent">
<input id="dtbl_dlg_save_{{ oUIBlock.GetTableId() }}" type="checkbox" {% if oUIBlock.GetOption("sTableId") != null %}checked{% endif %} name="save_settings">
<label for="dtbl_dlg_save_{{ oUIBlock.GetTableId() }}">&nbsp;&nbsp;{{ 'UI:UseSavetheSettings'|dict_s }}</label>
</legend>
<p>
<input id="dtbl_dlg_this_list_{{ oUIBlock.GetTableId() }}" type="radio" name="scope" {% if oUIBlock.GetOption("sTableId") != null %} checked {% else %} disabled="disabled" stay-disabled="true"{% endif %} value="this_list">
<label for="dtbl_dlg_this_list_{{ oUIBlock.GetTableId() }}">&nbsp;&nbsp;{{ 'UI:OnlyForThisList'|dict_s }}</label>&nbsp;&nbsp;&nbsp;&nbsp;
<input id="dtbl_dlg_all_{{ oUIBlock.GetTableId() }}" type="radio" name="scope" {% if oUIBlock.GetOption("sTableId") == null %} checked {% endif %} value="defaults">
<label for="dtbl_dlg_all_{{ oUIBlock.GetTableId() }}">&nbsp;&nbsp;{{ 'UI:ForAllLists'|dict_s }}</label>
</p>
</fieldset>
<table style="width:100%">
<tr>
<td style="text-align:center;">
<button type="button" onclick="$('#datatable_dlg_{{ oUIBlock.GetTableId() }}').dialog('close')">&nbsp;{{ 'UI:Button:Cancel'|dict_s }}</button>
</td>
<td style="text-align:center;">
<button type="submit" onclick="$('#datatable_dlg_{{ oUIBlock.GetTableId() }}').DataTableSettings('onDlgOk'); ">&nbsp;{{ 'UI:Button:Ok'|dict_s }}</button>
</td>
</tr>
</table>
</form>
</div>

View File

@@ -0,0 +1,21 @@
{% for oSubBlock in oUIBlock.GetSubBlocks() %}{{ render_block(oSubBlock, {aPage: aPage}) }}{% endfor %}
{% if oUIBlock.GetOptions()["select_mode"] is defined %}
<input type="hidden" name="selectionMode" value="positive"/>
{% if oUIBlock.GetAjaxData()["extra_params"] is not empty %}
<input type="hidden" name="extra_params" value="{{ oUIBlock.GetAjaxData()["extra_params"] }}"/>
{% endif %}
{% if oUIBlock.GetAjaxData()["filter"] is not empty %}
<input type="hidden" name="filter" value="{{ oUIBlock.GetAjaxData()["filter"] }}"/>
{% endif %}
{% endif %}
<table id="{{ oUIBlock.GetId() }}" width="100%" class="{{ oUIBlock.GetBlockCode() }}">
<thead>
{% if oUIBlock.GetOptions()["select_mode"] is defined %}
<th></th>
{% endif %}
{% for aColumn in oUIBlock.GetDisplayColumns() %}
<th class="ibo-datatable-header" {% if aColumn["description"] is not empty %}title="{{ aColumn["description"] }}"{% endif %}>{{ aColumn["attribute_label"] }} </th>
{% endfor %}
</thead>
</table>

View File

@@ -0,0 +1,303 @@
function checkAllDataTable(table, value) {
// Set the 'selectionMode' for the future objects to load
var selectionMode = 'positive';
if (value) {
selectionMode = 'negative';
}
oSelectedItems{{ oUIBlock.GetOption('sListId') }} =[];
// Mark all the displayed items as check or unchecked depending on the value
$(table).find(':checkbox[name^=selectObj]:not([disabled])').each(function () {
var $currentCheckbox = $(this);
$currentCheckbox.prop('checked', value);
$currentLine = $currentCheckbox.closest("tr");
(value) ? $currentLine.addClass("selected") : $currentLine.removeClass("selected");
});
$(table).parent().parent().find(':input[name=selectionMode]').val(selectionMode);
// Reset the list of saved selection...
$(':input[name^=storedSelection]').remove();
$(table).parent().find(':checkbox[name^=selectObj]').trigger("change");
if (value) {
$(table).DataTable().rows().select();
$('#btn_ok_{{ oUIBlock.GetOption('sTableId') }}').prop('disabled', false);
} else {
$(table).DataTable().rows({page: 'current'}).deselect();
$('#btn_ok_{{ oUIBlock.GetOption('sTableId') }}').prop('disabled', true);
}
return true;
}
$('#{{ oUIBlock.GetId() }}').closest("[role=dialog]").on("dialogbeforeclose", function () {
$('#{{ oUIBlock.GetId() }}').DataTable().clear();
});
{% if oUIBlock.GetOption("select_mode") is defined %}
var oSelectedItems{{ oUIBlock.GetOption('sListId') }} = [];
{% endif %}
if ($.fn.dataTable.isDataTable('#{{ oUIBlock.GetId() }}')) {
$('#{{ oUIBlock.GetId() }}').DataTable().destroy(false);
}
var oTable{{ oUIBlock.GetId() }} = $('#{{ oUIBlock.GetId() }}').DataTable({
language: {
processing: "{{ 'UI:Datatables:Language:Processing'|dict_s }}",
search: "{{ 'UI:Datatables:Language:Search'|dict_s }}",
lengthMenu: "{{ 'UI:Datatables:Language:LengthMenu'|dict_s }}",
zeroRecords: "{{ 'UI:Datatables:Language:ZeroRecords'|dict_s }}",
info: "{{ 'UI:Datatables:Language:Info'|dict_s }}",
infoEmpty: "{{ 'UI:Datatables:Language:InfoEmpty'|dict_s }}",
infoFiltered: "({{ 'UI:Datatables:Language:InfoFiltered'|dict_s }})",
emptyTable: "{{ 'UI:Datatables:Language:EmptyTable'|dict_s }}",
paginate: {
first: "<<",
previous: "<i class=\"fas fa-angle-left\"></i>",
next: "<i class=\"fas fa-angle-right\"></i>",
last: ">>"
},
aria: {
sortAscending: ": {{ 'UI:Datatables:Language:Sort:Ascending'|dict_s }}",
sortDescending: ": {{ 'UI:Datatables:Language:Sort:Descending'|dict_s }}"
}
},
lengthMenu: [[ {{ oUIBlock.GetOptions()["iPageSize"] }}, {{ oUIBlock.GetOptions()["iPageSize"]*2 }}, {{ oUIBlock.GetOptions()["iPageSize"]*3 }}, {{ oUIBlock.GetOptions()["iPageSize"]*4 }}, -1], [ {{ oUIBlock.GetOptions()["iPageSize"] }}, {{ oUIBlock.GetOptions()["iPageSize"]*2 }}, {{ oUIBlock.GetOptions()["iPageSize"]*3 }}, {{ oUIBlock.GetOptions()["iPageSize"]*4 }}, "{{ 'Portal:Datatables:Language:DisplayLength:All'|dict_s }}"]],
dom: "<'ibo-datatable-toolbar'pil>t<'ibo-datatable-toolbar'pil>",
{% if( oUIBlock.GetOptions()["sort"][0] is defined ) %}
order: [[{{ oUIBlock.GetOptions()["sort"][0] }}, '{{ oUIBlock.GetOptions()["sort"][1] }}']],
{% else %}
order: [],
{% endif %}
ordering: true,
{% if oUIBlock.GetOption("select_mode") is defined %}
select: {
style: "{{ oUIBlock.GetOption("select_mode") }}"
},
rowCallback: function (oRow, oData) {
// Hiding pagination if only one page
if ($(this).closest('.ibo-panel--body').find('[name=selectionMode]') === "negative") {
if (!oData.id in oSelectedItems{{ oUIBlock.GetOption('sListId') }}) {
$(oRow).select();
$(oRow).find('td:first-child input').prop('checked', true);
}
} else {
if (oData.id in oSelectedItems{{ oUIBlock.GetOption('sListId') }}) {
$(oRow).select();
$(oRow).find('td:first-child input').prop('checked', true);
}
}
},
drawCallback: function () {
// Hiding pagination if only one page
if ($(this).closest('.ibo-panel--body').find('[name=selectionMode]') === "negative") {
$(this).find('[name=selectAll]').checked();
$(table).DataTable().rows({page: 'current'}).select();
} else {
$(this).closest('.dataTables_wrapper').find('.dataTables_paginate, .dataTables_info').show();
}
},
{% endif %}
rowId: "id",
filter: false,
retrieve: true,
destroy: true,
processing: true,
serverSide: true,
columns: [
{% if oUIBlock.GetOption("select_mode") is not empty %}
{
width: "auto",
searchable: false,
sortable: false,
title:
{% if oUIBlock.GetOption("select_mode") != "single" %}
'<span class="row_input"><input type="checkbox" onclick="checkAllDataTable(\'#{{ oUIBlock.GetId() }}\',this.checked);" class="checkAll" id="field_{{ oUIBlock.GetId() }}_check_all" name="field_{{ oUIBlock.GetId() }}_check_all" title="{{ 'UI:SearchValue:CheckAll'|dict_s }} / {{ 'UI:SearchValue:UncheckAll'|dict_s }}" /></span>'
{% else %}
'<span class="row_input"><input type="checkbox" style="display: none;" onclick="checkAllDataTable(\'#{{ oUIBlock.GetId() }}\',this.checked);" class="checkAll" id="field_{{ oUIBlock.GetId() }}_check_all" name="field_{{ oUIBlock.GetId() }}_check_all" title="{{ 'UI:SearchValue:CheckAll'|dict_s }} / {{ 'UI:SearchValue:UncheckAll'|dict_s }}" /></span>'
{% endif %},
type: "html",
data: "",
render: function (data, type, row) {
var oCheckboxElem =
{% if oUIBlock.GetOption("select_mode") != "single" %}
$('<span class="row_input"><input type="checkbox" class="selectList{{ oUIBlock.GetId() }}" name="selectObject[]" /></span>');
{% else %}
$('<span class="row_input"><input type="radio" class="selectList{{ oUIBlock.GetId() }}" name="selectObject[]" /></span>');
{% endif %}
if (row.limited_access) {
oCheckboxElem.html('-');
} else {
oCheckboxElem.find(':input').attr('data-object-id', row.id).attr('data-target-object-id', row.target_id);
}
return oCheckboxElem.prop('outerHTML');
}
},
{% endif %}
{% for aColumn in oUIBlock.GetDisplayColumns() %}
{
width: "auto",
searchable: false,
sortable: true,
title: "{{ aColumn["attribute_label"] }}",
defaultContent: "",
type: "html",
metadata: {
object_class: "{{ aColumn["object_class"] }}",
attribute_code: "{{ aColumn["attribute_code"] }}",
attribute_type: "{{ aColumn["attribute_type"] }}",
attribute_label: "{{ aColumn["attribute_label"] }}"
},
data: "{{ aColumn["class_alias"] }}/{{ aColumn["attribute_code"] }}",
render: {
display: function (data, type, row) { {{ aColumn["render"]|raw }}},
_: "{{ aColumn["class_alias"] }}/{{ aColumn["attribute_code"] }}"
}
},
{% endfor %}
],
ajax: $.fn.dataTable.pipeline({
url: "{{ oUIBlock.GetAjaxUrl() }}",
data: {{ oUIBlock.GetAjaxData() |raw }},
method: "post",
pages: 5 // number of pages to cache
}),
initComplete: function () {
if (this.api().page.info().pages === 1) {
$('.dataTables_paginate').hide();
$('.dataTables_length').hide();
}
}
});
{% if oUIBlock.GetOption("select_mode") is not empty %}
{% if oUIBlock.GetOption("select_mode") != "single" %}
oTable{{ oUIBlock.GetId() }}.off('select').on('select', function (oEvent, dt, type, indexes) {
var aData = oTable{{ oUIBlock.GetId() }}.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 (var i in aData) {
var iItemId = aData[i].id;
if (oSelectedItems{{ oUIBlock.GetOption('sListId') }}.indexOf(iItemId) > -1) {
oSelectedItems{{ oUIBlock.GetOption('sListId') }}.splice(oSelectedItems{{ oUIBlock.GetOption('sListId') }}.indexOf(iItemId), 1);
}
}
if (oSelectedItems{{ oUIBlock.GetOption('sListId') }}.length === oTable{{ oUIBlock.GetId() }}.page.info()["recordsTotal"] ) {
$('#btn_ok_{{ oUIBlock.GetOption('sTableId') }}').prop('disabled', true);
} else {
$('#btn_ok_{{ oUIBlock.GetOption('sTableId') }}').prop('disabled', false);
}
}
else {
// Checking input
$('#{{ oUIBlock.GetId() }} tr[role="row"].selected td:first-child input').prop('checked', true);
// Saving values in temp array
for (var i in aData) {
var iItemId = aData[i].id;
if (oSelectedItems{{ oUIBlock.GetOption('sListId') }}.indexOf(iItemId) === -1) {
oSelectedItems{{ oUIBlock.GetOption('sListId') }}.push(iItemId);
}
}
$('#btn_ok_{{ oUIBlock.GetOption('sTableId') }}').prop('disabled', false);
}
});
oTable{{ oUIBlock.GetId() }}.off('deselect').on('deselect', function (oEvent, dt, type, indexes) {
var aData = oTable{{ oUIBlock.GetId() }}.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 (var i in aData) {
var iItemId = aData[i].id;
if (oSelectedItems{{ oUIBlock.GetOption('sListId') }}.indexOf(iItemId) === -1) {
oSelectedItems{{ oUIBlock.GetOption('sListId') }}.push(iItemId);
}
}
if (oSelectedItems{{ oUIBlock.GetOption('sListId') }}.length === oTable{{ oUIBlock.GetId() }}.page.info()["recordsTotal"]) {
$('#btn_ok_{{ oUIBlock.GetOption('sTableId') }}').prop('disabled', true);
} else {
$('#btn_ok_{{ oUIBlock.GetOption('sTableId') }}').prop('disabled', false);
}
} else {
for (var i in aData) {
var iItemId = aData[i].id;
if (oSelectedItems{{ oUIBlock.GetOption('sListId') }}.indexOf(iItemId) > -1) {
oSelectedItems{{ oUIBlock.GetOption('sListId') }}.splice(oSelectedItems{{ oUIBlock.GetOption('sListId') }}.indexOf(iItemId), 1);
}
}
if (oSelectedItems{{ oUIBlock.GetOption('sListId') }}.length === 0) {
$('#btn_ok_{{ oUIBlock.GetOption('sTableId') }}').prop('disabled', true);
} else {
$('#btn_ok_{{ oUIBlock.GetOption('sTableId') }}').prop('disabled', false);
}
}
});
{% else %}
oTable{{ oUIBlock.GetId() }}.off('select').on('select', function (oEvent, dt, type, indexes) {
var aData = oTable{{ oUIBlock.GetId() }}.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 (var i in aData) {
var iItemId = aData[i].id;
if (oSelectedItems{{ oUIBlock.GetOption('sListId') }}.indexOf(iItemId) === -1) {
oSelectedItems{{ oUIBlock.GetOption('sListId') }}.push(iItemId);
}
}
$('#btn_ok_{{ oUIBlock.GetOption('sListId') }}').prop('disabled', false);
});
oTable{{ oUIBlock.GetId() }}.off('deselect').on('deselect', function (oEvent, dt, type, indexes) {
var aData = oTable{{ oUIBlock.GetId() }}.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 (var i in aData) {
var iItemId = aData[i].id;
if (oSelectedItems{{ oUIBlock.GetOption('sListId') }}.indexOf(iItemId) > -1) {
oSelectedItems{{ oUIBlock.GetOption('sListId') }}.splice(oSelectedItems{{ oUIBlock.GetOption('sListId') }}.indexOf(iItemId), 1);
}
}
});
{% endif %}
{% endif %}
$('#datatable_dlg_{{ oUIBlock.GetId() }}').dialog(
{
autoOpen: false,
title: "{{ 'UI:ListConfigurationTitle'|dict_s }}",
width: 500,
open: function(){
$('#datatable_dlg_{{ oUIBlock.GetId() }}').find('[name=action]').val("none");
},
close: function (event, ui) { //save data and refresh
if( $('#datatable_dlg_{{ oUIBlock.GetId() }}').find('[name=action]').val() == "none") {
$('#datatable_dlg_{{ oUIBlock.GetId() }}').DataTableSettings('onDlgCancel');
}
}
});
$aOptions = {
sListId: '{{ oUIBlock.GetId() }}',
oColumns: {{ oUIBlock.GetResultColumnsAsJson()|raw }},
sSelectMode: "{{ oUIBlock.GetOption("select_mode") }}",
sViewLink: '{{ oUIBlock.GetOption("bViewLink") }}',
iPageSize: '{{ oUIBlock.GetOption("iPageSize") }}',
oClassAliases: JSON.parse('{{ oUIBlock.GetOption("oClassAliases") |raw }}'),
sTableId: '{{ oUIBlock.GetOption("sTableId") }}',
//oExtraParams
sRenderUrl: "{{ oUIBlock.GetAjaxUrl() }}",
oData: {{ oUIBlock.GetAjaxData() |raw }},//ttt
oDefaultSettings: {{ oUIBlock.GetOption("oDefaultSettings")|raw }},
oLabels: {moveup: "{{ 'UI:Button:MoveUp'|dict_s }}", movedown: "{{ 'UI:Button:MoveDown'|dict_s }}"},
};
$('#datatable_dlg_{{ oUIBlock.GetId() }}').DataTableSettings($aOptions);

View File

@@ -0,0 +1,20 @@
{# @copyright Copyright (C) 2010-2020 Combodo SARL #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
<input type="hidden" name="attr_{{ oUIBlock.GetRef() }}" value="">
{% set columns = oUIBlock.GetColumns() %}
<table id="{{ oUIBlock.GetId() }}" class="ibo-datatable listResults" style="width:100%;">
<thead>
<tr>
{% for column in columns %}
<th class="ibo-datatable-header" title="{{ column.description }}">{{ column.label|raw }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for oSubBlock in oUIBlock.GetRows() %}
{{ render_block(oSubBlock, {aPage: aPage}) }}
{% endfor %}
</tbody>
</table>

View File

@@ -0,0 +1,6 @@
$('#{{ oUIBlock.GetId() }}').DataTable({
language: {
emptyTable: {{ 'UI:Message:EmptyList:UseAdd'|dict_s }}
},
search:false
});

View File

@@ -0,0 +1,19 @@
{# @copyright Copyright (C) 2010-2020 Combodo SARL #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
<tr role="row" id="{{ oUIBlock.GetRef() }}_row_{{ oUIBlock.GetRowId() }}">
{% for colName,column in oUIBlock.GetColumns() %}
<td>
{% set cellValueHtml = '' %}
{% for cellName,cellValue in oUIBlock.GetData() %}
{% if cellName == colName %}
{% set cellValueHtml = cellValue %}
{% endif %}
{% endfor %}
{% if cellValueHtml is empty %}
{% set cellValueHtml = '&nbsp;' %}
{% endif %}
{{ cellValueHtml|raw }}
</td>
{% endfor %}
</tr>

View File

@@ -0,0 +1,48 @@
{# @copyright Copyright (C) 2010-2020 Combodo SARL #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
{% set columns = oUIBlock.GetColumns() %}
<table id="{{ oUIBlock.GetId() }}" class="ibo-datatable listResults" style="width:100%;">
<thead>
<tr>
{% for column in columns %}
<th class="ibo-datatable-header" title="{{ column.description }}">{{ column.label }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for data in oUIBlock.GetData() %}
{% if data['@class'] is not empty %}
<tr role="row" class="{{ data['@class'] }}">
{% else %}
<tr>
{% endif %}
{% for name,column in columns %}
<td {% if column.class is not empty %}class="{{ column.class }}" {% endif %}
{% if column.metadata is not empty %}
{% for prop,value in column.metadata %}
data-{{ prop|replace({'_': '-'}) }}="{{ value }}"
{% endfor %}
{% endif %}
{% set cellValueHtml = '' %}
{% for cellName,cellValue in data %}
{% if cellName == name %}
{% if cellValue.value_raw is empty %}
{% set cellValueHtml = cellValue %}
{% else %}
data-value-raw="{{ cellValue.value_raw }}"
{% if cellValue.value_html is not empty %}
{% set cellValueHtml = cellValue.value_html %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% if cellValueHtml is empty %}
{% set cellValueHtml = '&nbsp;' %}
{% endif %}
>{{ cellValueHtml|raw }}</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>

View File

@@ -0,0 +1,47 @@
{# @copyright Copyright (C) 2010-2020 Combodo SARL #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
{% if oUIBlock.GetOptions() is not empty %}
{% set iPageSize = oUIBlock.GetOptions()["iPageSize"] %}
{% else %}
{% set iPageSize = 10 %}
{% endif %}
$('#{{ oUIBlock.GetId() }}').DataTable({
language: {
processing: "{{ 'UI:Datatables:Language:Processing'|dict_s }}",
search: "{{ 'UI:Datatables:Language:Search'|dict_s }}",
lengthMenu: "{{ 'UI:Datatables:Language:LengthMenu'|dict_s }}",
zeroRecords: "{{ 'UI:Datatables:Language:ZeroRecords'|dict_s }}",
info: "{{ 'UI:Datatables:Language:Info'|dict_s }}",
infoEmpty: "",
infoFiltered: "({{ 'UI:Datatables:Language:InfoFiltered'|dict_s }})",
emptyTable: "{{ 'UI:Datatables:Language:EmptyTable'|dict_s }}",
paginate: {
first: "<<",
previous: "<i class=\"fas fa-angle-left\"></i>",
next: "<i class=\"fas fa-angle-right\"></i>",
last: ">>"
},
aria: {
sortAscending: ": {{ 'UI:Datatables:Language:Sort:Ascending'|dict_s }}",
sortDescending: ": {{ 'UI:Datatables:Language:Sort:Descending'|dict_s }}"
}
},
order: [],
rowId: "id",
filter: false,
{% if oUIBlock.GetData()|length <= iPageSize %}
paging: false,
{% endif %}
dom: "<'ibo-datatable-toolbar'pil>t<'ibo-datatable-toolbar'pil>",
lengthMenu: [[ {{ iPageSize }}, {{ iPageSize*2 }}, {{ iPageSize*3 }}, {{ iPageSize*4 }}, -1], [ {{ iPageSize }}, {{ iPageSize*2 }}, {{ iPageSize*3 }}, {{ iPageSize*4 }}, "{{ 'Portal:Datatables:Language:DisplayLength:All'|dict_s }}"]],
columns: [
{% for column in oUIBlock.GetColumns() %}
{
width: "auto",
sortable: true
},
{% endfor %}
]
});

View File

@@ -0,0 +1,22 @@
{% set aParams = oUIBlock.GetParams() %}
<div id="{{ oUIBlock.GetId() }}" class="ibo-field ibo-field-{{ aParams.layout }}"
data-attribute-code="{{ aParams.attcode }}"
data-attribute-type="{{ aParams.atttype }}"
data-attribute-label="{{ aParams.attlabel }}"
{# Note: This might not the best way to this, we might rather have some properties for this flags in te Field class. #}
{# For the moment this just aims at restoring the metadata introduced in iTop 2.7. Refactoring the Field class with specialization for each type must be designed by all the team #}
{# as we might want to re-use / adapt the Field classes introduced with the end-user portal #}
data-attribute-flag-hidden="{% if (aParams.attflags b-and constant('OPT_ATT_HIDDEN')) == constant('OPT_ATT_HIDDEN') %}true{% else %}false{% endif %}"
data-attribute-flag-read-only="{% if (aParams.attflags b-and constant('OPT_ATT_READONLY')) == constant('OPT_ATT_READONLY') %}true{% else %}false{% endif %}"
data-attribute-flag-mandatory="{% if (aParams.attflags b-and constant('OPT_ATT_MANDATORY')) == constant('OPT_ATT_MANDATORY') %}true{% else %}false{% endif %}"
data-attribute-flag-must-change="{% if (aParams.attflags b-and constant('OPT_ATT_MUSTCHANGE')) == constant('OPT_ATT_MUSTCHANGE') %}true{% else %}false{% endif %}"
data-attribute-flag-must-prompt="{% if (aParams.attflags b-and constant('OPT_ATT_MUSTPROMPT')) == constant('OPT_ATT_MUSTPROMPT') %}true{% else %}false{% endif %}"
data-attribute-flag-slave="{% if (aParams.attflags b-and constant('OPT_ATT_SLAVE')) == constant('OPT_ATT_SLAVE') %}true{% else %}false{% endif %}"
data-value-raw="{{ aParams.value_raw }}"
>
<div class="ibo-field--label">{{ aParams.label|raw }}</div>
<div class="ibo-field--value">{{ aParams.value|raw }}</div>
{% if (aParams.comments is not null) %}
{{ aParams.comments|raw }}
{% endif %}
</div>

View File

@@ -0,0 +1,8 @@
{% if oUIBlock.GetSubBlocks() %}
<fieldset class="ibo-fieldset">
<legend class="ibo-fieldset-legend">{{ oUIBlock.GetLegend() }}</legend>
{% for oSubBlock in oUIBlock.GetSubBlocks() %}
{{ render_block(oSubBlock, {aPage: aPage}) }}
{% endfor %}
</fieldset>
{% endif %}

View File

@@ -0,0 +1,16 @@
<form method="post" enctype="multipart/form-data" id="{{ oUIBlock.GetId() }}"
{% if oUIBlock.GetOnSubmitJsCode() %}
onSubmit="{{ oUIBlock.GetOnSubmitJsCode() }}"
{% endif %}
{% if oUIBlock.GetAction() %}
action="{{ oUIBlock.GetAction() }}"
{% endif %}
>
{% apply spaceless %}
{% block iboContentBlockContainer %}
{% for oSubBlock in oUIBlock.GetSubBlocks() %}
{{ render_block(oSubBlock, {aPage: aPage}) }}
{% endfor %}
{% endblock %}
{% endapply %}
</form>

View File

@@ -0,0 +1,32 @@
<div id="{{ oUIBlock.GetId() }}" class="ibo-global-search" data-role="ibo-global-search">
<form action="{{ oUIBlock.GetEndpoint() }}" method="post" class="ibo-global-search--head" data-role="ibo-global-search--head">
<a href="#" class="ibo-global-search--icon fas fa-search" data-role="ibo-global-search--icon" data-tooltip-content="{{ 'UI:Component:GlobalSearch:Tooltip'|dict_s }}" data-tooltip-placement="bottom-start" data-tooltip-distance-offset="25"></a>
<input type="text" name="query" class="ibo-global-search--input" data-role="ibo-global-search--input" placeholder="{{ 'UI:Component:GlobalSearch:Input:Placeholder'|dict_s }}" autocomplete="off"/>
</form>
<div class="ibo-global-search--drawer" data-role="ibo-global-search--drawer">
<div class="ibo-global-search--compartment">
<div class="ibo-global-search--compartment-title" data-role="ibo-global-search--compartment-title">
<span>{{ 'UI:Component:GlobalSearch:Recents:Title'|dict_s }}</span>
</div>
<div class="ibo-global-search--compartment-content" data-role="ibo-global-search--compartment-content">
{% if oUIBlock.GetLastQueries()|length > 0 %}
{% for aQuery in oUIBlock.GetLastQueries() %}
<a href="#" class="ibo-global-search--compartment-element" data-role="ibo-global-search--compartment-element" data-query-raw="{{ aQuery.query }}" title="{{ aQuery.query }}">
{% if aQuery.icon_url is defined %}
<img src="{{ aQuery.icon_url}}" class="ibo-global-search--compartment-element-image" />
{% endif %}
{{ aQuery.label_html|raw }}
</a>
{% endfor %}
{% else %}
<div class="ibo-global-search--compartment--placeholder">
<div class="ibo-global-search--compartment--placeholder-image ibo-svg-illustration--container">
{{ source("illustrations/undraw_web_search.svg") }}
</div>
<div class="ibo-global-search--compartment--placeholder-hint">{{ 'UI:Component:GlobalSearch:LastQueries:NoQuery:Placeholder'|dict_s }}</div>
</div>
{% endif %}
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1 @@
$('#{{ oUIBlock.GetId() }}').global_search();

View File

@@ -0,0 +1 @@
{{ oUIBlock.GetHtml()|raw }}

View File

@@ -0,0 +1,4 @@
{% block iboInputLabel %}
<label for="{{ oUIBlock.GetId() }}">{{ oUIBlock.GetLabel() }}</label>
{{ render_block(oUIBlock.GetInput()) }}
{% endblock %}

View File

@@ -0,0 +1,5 @@
{% block iboInputLabel %}
{% endblock %}
{% block iboInput %}
<input type="{{ oUIBlock.GetType() }}" id="{{ oUIBlock.GetId() }}" name="{{ oUIBlock.GetName() }}" value="{{ oUIBlock.GetValue()|raw }}"/>
{% endblock %}

View File

@@ -0,0 +1,4 @@
{% extends "base/components/input/layout.html.twig" %}
{% block iboInput %}
<textarea id="{{ oUIBlock.GetId() }}" class="htmlEditor" name="{{ oUIBlock.GetName() }}" ></textarea>
{% endblock %}

View File

@@ -0,0 +1 @@
$('#{{ oUIBlock.GetId() }}').ckeditor(function() { /* callback code */ }, {'language': 'en', 'contentsLanguage' : 'en', 'extraPlugins' : 'disabler,codesnippet'});

View File

@@ -0,0 +1,10 @@
{# @copyright Copyright (C) 2010-2020 Combodo SARL #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
{% extends "base/components/input/layout.html.twig" %}
{% block iboInput %}
<select id="{{ oUIBlock.GetId() }}" name="{{ oUIBlock.GetName() }}">
{% for oSubBlock in oUIBlock.GetSubBlocks() %}
{{ render_block(oSubBlock, {aPage: aPage}) }}
{% endfor %}
</select>
{% endblock %}

View File

@@ -0,0 +1,3 @@
{# @copyright Copyright (C) 2010-2020 Combodo SARL #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
<option id="{{ oUIBlock.GetId() }}" value="{{ oUIBlock.GetValue() }}" {% if oUIBlock.IsSelected() %}selected{% endif %}>{{ oUIBlock.GetLabel() }}</option>

View File

@@ -0,0 +1,25 @@
{# @copyright Copyright (C) 2010-2020 Combodo SARL #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
{% apply spaceless %}
<div id="{{ oUIBlock.GetId() }}" class="ibo-panel ibo-is-{{ oUIBlock.GetColor() }} {{ oUIBlock.GetCSSClasses() }}">
<div class="ibo-panel--header">
{% block iboPanelHeader %}
<div class="ibo-panel--title">{% block iboPanelTitle %}{{ oUIBlock.GetTitle()|raw }}{% endblock %}</div>
<div class="ibo-panel--toolbar">
{% block iboPanelToolbar %}
{% for oToolbarBlock in oUIBlock.GetToolbarBlocks() %}
{{ render_block(oToolbarBlock, {aPage: aPage}) }}
{% endfor %}
{% endblock %}
</div>
{% endblock %}
</div>
<div class="ibo-panel--body">
{% block iboPanelBody %}
{% for oMainBlock in oUIBlock.GetMainBlocks() %}
{{ render_block(oMainBlock, {aPage: aPage}) }}
{% endfor %}
{% endblock %}
</div>
</div>
{% endapply %}

View File

@@ -0,0 +1,17 @@
{# @copyright Copyright (C) 2010-2020 Combodo SARL #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
{% extends 'base/components/panel/layout.html.twig' %}
{% block iboPanelTitle %}
<div class="ibo-panel--title-icon">
<img src="{{ oUIBlock.GetIconUrl() }}" alt="{{ oUIBlock.GetTitle() }}"/>
</div>
<div class="ibo-panel--title-title">
<div class="ibo-panel--title-title-title">{{ oUIBlock.GetTitle() }}</div>
<div class="ibo-panel--title-title-subtitle">
{% for oSubBlock in oUIBlock.GetSubTitle().GetSubBlocks() %}
{{ render_block(oSubBlock, {aPage: aPage}) }}
{% endfor %}
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,2 @@
{% block iboPopoverMenuItem %}
{% endblock %}

View File

@@ -0,0 +1,7 @@
{% extends 'base/components/popover-menu/item/layout.html.twig' %}
{% block iboPopoverMenuItem %}
<a class="ibo-popover-menu--item" data-role="ibo-popover-menu--item" href="{{ oUIBlock.GetUrl() }}" onclick="{{ oUIBlock.GetJsCode()|escape }}">
{{ oUIBlock.GetLabel() }}
</a>
{% endblock %}

View File

@@ -0,0 +1,4 @@
{% extends 'base/components/popover-menu/item/layout.html.twig' %}
{% block iboPopoverMenuItem %}
<hr class="ibo-popover-menu--item ibo-popover-menu--separator">
{% endblock %}

View File

@@ -0,0 +1,8 @@
{% extends 'base/components/popover-menu/item/layout.html.twig' %}
{% block iboPopoverMenuItem %}
<a class="ibo-popover-menu--item" data-role="ibo-popover-menu--item" href="{{ oUIBlock.GetUrl() }}" target="{{ oUIBlock.GetTarget() }}">
{{ oUIBlock.GetLabel() }}
</a>
{% endblock %}

View File

@@ -0,0 +1,11 @@
<div {% if oUIBlock.GetId() is defined %}id="{{ oUIBlock.GetId() }}"{% endif %} class="ibo-popover-menu" data-role="ibo-popover-menu">
{% for aSection in oUIBlock.GetSections() %}
{% if aSection.aItems|length > 0 %}
<div class="ibo-popover-menu--section" data-role="ibo-popover-menu--section">
{% for oUIBlockItem in aSection.aItems %}
{{ render_block(oUIBlockItem, {aPage: aPage}) }}
{% endfor %}
</div>
{% endif %}
{% endfor %}
</div>

View File

@@ -0,0 +1,4 @@
<div data-role="ibo-navigation-menu--notifications-menu--container">
<div {% if oUIBlock.GetId() is defined %}id="{{ oUIBlock.GetId() }}"{% endif %} class="ibo-popover-menu"
data-role="ibo-popover-menu"></div>
</div>

View File

@@ -0,0 +1 @@
$('#{{ oUIBlock.GetId() }}').newsroom_menu({{ oUIBlock.GetParamsAsJson()|raw }});

View File

@@ -0,0 +1,42 @@
<div id="{{ oUIBlock.GetId() }}" class="ibo-quick-create" data-role="ibo-quick-create">
<form action="{{ oUIBlock.GetEndpoint() }}" method="get" class="ibo-quick-create--head" data-role="ibo-quick-create--head">
<input type="hidden" name="operation" value="new"/>
<a href="#" class="ibo-quick-create--icon fas fa-plus" data-role="ibo-quick-create--icon" data-tooltip-content="{{ 'UI:Component:QuickCreate:Tooltip'|dict_s }}"
data-tooltip-placement="bottom-start" data-tooltip-distance-offset="25"></a>
<select name="class" class="ibo-quick-create--input" data-role="ibo-quick-create--input">
<option value="">{{ 'UI:Component:QuickCreate:Input:Placeholder'|dict_s }}</option>
{% for sClassCode, sClassLabel in oUIBlock.GetAvailableClasses() %}
<option value="{{ sClassCode }}">{{ sClassLabel }}</option>
{% endfor %}
</select>
</form>
<div class="ibo-quick-create--drawer" data-role="ibo-quick-create--drawer">
<div class="ibo-quick-create--compartment">
<div class="ibo-quick-create--compartment-content" data-role="ibo-quick-create--compartment-results">
</div>
<div class="ibo-quick-create--compartment-title" data-role="ibo-quick-create--compartment-title">
<span>{{ 'UI:Component:QuickCreate:Recents:Title'|dict_s }}</span>
</div>
<div class="ibo-quick-create--compartment-content" data-role="ibo-quick-create--compartment-content">
{% if oUIBlock.GetLastClasses()|length > 0 %}
{% for aClass in oUIBlock.GetLastClasses() %}
<a href="{{ aClass.target_url }}" class="ibo-quick-create--compartment-element" data-role="ibo-quick-create--compartment-element" data-class-code="{{ aQuery.class }}">
{% if aClass.icon_url is defined %}
<img src="{{ aClass.icon_url}}" class="ibo-quick-create--compartment-element-image" />
{% endif %}
{{ aClass.label_html|raw }}
</a>
{% endfor %}
{% else %}
<div class="ibo-quick-create--compartment--placeholder">
<div class="ibo-quick-create--compartment--placeholder-image ibo-svg-illustration--container">
{{ source("illustrations/undraw_duplicate.svg") }}
</div>
<div class="ibo-quick-create--compartment--placeholder-hint">{{ 'UI:Component:QuickCreate:LastClasses:NoClass:Placeholder'|dict_s }}</div>
</div>
{% endif %}
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,3 @@
$('#{{ oUIBlock.GetId() }}').quick_create({
max_autocomplete_results: {{ oUIBlock.GetMaxAutocompleteResults() }}
});

View File

@@ -0,0 +1,16 @@
{% apply spaceless %}
<div class="ibo-title">
{% if oUIBlock.HasIcon() %}
<div class="ibo-title--medallion">
<img class="ibo-title--icon ibo-title--icon--must-{{ oUIBlock.GetIconCoverMethod() }}" src="{{ oUIBlock.GetIconUrl() }}" />
</div>
{% endif %}
<div class="ibo-title--content">
{% block iboPageTitleText %}
<h{{ oUIBlock.GetLevel() }} class="ibo-title--text title is-size-{{ oUIBlock.GetLevel() + 2 }}">
{{ oUIBlock.GetTitle()|raw }}
</h{{ oUIBlock.GetLevel() }}>
{% endblock %}
</div>
</div>
{% endapply %}

View File

@@ -0,0 +1,11 @@
{# @copyright Copyright (C) 2010-2020 Combodo SARL #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
{% extends 'base/components/title/layout.html.twig' %}
{% block iboPageTitleText %}
<h1 class="ibo-title--for-object-details">{{ oUIBlock.GetClassName() }} <span class="ibo-title--emphasis">{{ oUIBlock.GetObjectName()|raw }}</span></h1>
<div class="ibo-title--status">
<span class="ibo-title--status-dot ibo-is-state-{{ oUIBlock.GetStatusColor() }}"></span>
<span class="ibo-title--status-label">{{ oUIBlock.GetStatusLabel() }}</span>
</div>
{% endblock %}

View File

@@ -0,0 +1 @@
{% extends 'base/layouts/content-block/layout.html.twig' %}