mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
N°2847 - Datatable modal dialogs
This commit is contained in:
44
templates/components/datatable/config/layout.html.twig
Normal file
44
templates/components/datatable/config/layout.html.twig
Normal 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() }}"> {{ '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() }}"> {{ '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() }}"> {{ '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() }}"> {{ 'UI:OnlyForThisList'|dict_s }}</label>
|
||||
<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() }}"> {{ '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')"> {{ 'UI:Button:Cancel'|dict_s }}</button>
|
||||
</td>
|
||||
<td style="text-align:center;">
|
||||
<button type="submit" onclick="$('#datatable_dlg_{{ oUIBlock.GetTableId() }}').DataTableSettings('onDlgOk'); "> {{ 'UI:Button:Ok'|dict_s }}</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
@@ -1,62 +1,17 @@
|
||||
{% 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"/>
|
||||
<input type="hidden" name="extra_params" value="{{ oUIBlock.GetAjaxData()["extra_params"]}}"/>
|
||||
<input type="hidden" name="filter" value="{{ oUIBlock.GetAjaxData()["filter"]}}"/>
|
||||
<input type="hidden" name="extra_params" value="{{ oUIBlock.GetAjaxData()["extra_params"] }}"/>
|
||||
<input type="hidden" name="filter" value="{{ oUIBlock.GetAjaxData()["filter"] }}"/>
|
||||
{% endif %}
|
||||
|
||||
<table id="{{ oUIBlock.GetId() }}" width="100%" class="ibo-datatable">
|
||||
<thead>
|
||||
{% if oUIBlock.GetOptions()["select_mode"] is defined %}
|
||||
<th></th>
|
||||
{% endif %}
|
||||
{% for aColumn in oUIBlock.GetDisplayColumns() %}
|
||||
<th class="ibo-datatable-header" title="{{ aColumn["description"] }}\">{{ aColumn["attribute_label"] }} </th>
|
||||
{% endfor %}
|
||||
</thead>
|
||||
<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" title="{{ aColumn["description"] }}\">{{ aColumn["attribute_label"] }} </th>
|
||||
{% endfor %}
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
<div id="datatable_dlg_{{ oUIBlock.GetId() }}" style="display: none; background : white;" class="">
|
||||
<input type="hidden" name="action" value="none"/>
|
||||
<form id="form_{{ oUIBlock.GetId() }}" onsubmit="return false">
|
||||
<p>
|
||||
<input id="dtbl_dlg_settings_{{ oUIBlock.GetId() }}" type="radio" name="settings" {% if (oUIBlock.GetOptions()['bUseCustomSettings'] == false) %} checked {% endif %} value="defaults">
|
||||
<label for="dtbl_dlg_settings_{{ oUIBlock.GetId() }}"> {{ 'UI:UseDefaultSettings'|dict_s }}</label>
|
||||
</p>
|
||||
<fieldset>
|
||||
<legend class="transparent">
|
||||
<input id="dtbl_dlg_specific_{{ oUIBlock.GetId() }}" type="radio" class="specific_settings" name="settings" {% if oUIBlock.GetOptions()["bUseCustomSettings"] %} checked {% endif %} value="specific">
|
||||
<label for="dtbl_dlg_specific_{{ oUIBlock.GetId() }}"> {{ 'UI:UseSpecificSettings'|dict_s }}</label>
|
||||
</legend>
|
||||
{{'UI:ColumnsAndSortOrder'|dict_s}}<br/>
|
||||
<ul class="sortable_field_list" id="sfl_{{ oUIBlock.GetId() }}">
|
||||
|
||||
</ul>
|
||||
|
||||
<p> {{ 'UI:Display_X_ItemsPerPage_prefix'|dict_s }}<input type="text" size="4" name="page_size" value="{{ oUIBlock.GetOptions()["iPageSize"]}}">{{ 'UI:Display_X_ItemsPerPage_suffix'|dict_s }}</p>
|
||||
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend class="transparent">
|
||||
<input id="dtbl_dlg_save_{{ oUIBlock.GetId() }}" type="checkbox" {% if oUIBlock.GetOptions()["sTableId"] != null %}checked{% endif %} name="save_settings">
|
||||
<label for="dtbl_dlg_save_{{ oUIBlock.GetId() }}"> {{ 'UI:UseSavetheSettings'|dict_s }}</label>
|
||||
</legend>
|
||||
<p>
|
||||
<input id="dtbl_dlg_this_list_{{ oUIBlock.GetId() }}" type="radio" name="scope" {% if oUIBlock.GetOptions()["sTableId"] != null %} checked {% else %} disabled="disabled" stay-disabled="true"{% endif %} value="this_list">
|
||||
<label for="dtbl_dlg_this_list_{{ oUIBlock.GetId() }}"> {{ 'UI:OnlyForThisList'|dict_s }}</label>
|
||||
<input id="dtbl_dlg_all_{{ oUIBlock.GetId() }}" type="radio" name="scope" {% if oUIBlock.GetOptions()["sTableId"] == null %} checked {% endif %} value="defaults">
|
||||
<label for="dtbl_dlg_all_{{ oUIBlock.GetId() }}"> {{ 'UI:ForAllLists'|dict_s }}</label>
|
||||
</p>
|
||||
</fieldset>
|
||||
<table style="width:100%">
|
||||
<tr>
|
||||
<td style="text-align:center;">
|
||||
<button type="button" onclick="$('#datatable_dlg_{{ oUIBlock.GetId() }}').DataTableSettings('onDlgCancel'); $('#datatable_dlg_{{ oUIBlock.GetId() }}').dialog('close')"> {{ 'UI:Button:Cancel'|dict_s }}</button>
|
||||
</td>
|
||||
<td style="text-align:center;">
|
||||
<button type="submit" onclick="$('#datatable_dlg_{{ oUIBlock.GetId() }}').DataTableSettings('onDlgOk'); "> {{ 'UI:Button:Ok'|dict_s }}</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
@@ -288,20 +288,16 @@ $('#datatable_dlg_{{ oUIBlock.GetId() }}').dialog(
|
||||
$aOptions = {
|
||||
sListId: '{{ oUIBlock.GetId() }}',
|
||||
oColumns: {{ oUIBlock.GetResultColumnsAsJson()|raw }},
|
||||
sSelectMode: "{{ oUIBlock.GetOption("select_mode") }}",
|
||||
sSelectMode: "{{ oUIBlock.GetOption("select_mode") }}",
|
||||
sViewLink: '{{ oUIBlock.GetOption("bViewLink") }}',
|
||||
iPageSize: '{{ oUIBlock.GetOption("iPageSize") }}',
|
||||
oClassAliases: JSON.parse('{{ oUIBlock.GetOption("oClassAliases") |raw}}'),
|
||||
oClassAliases: JSON.parse('{{ oUIBlock.GetOption("oClassAliases") |raw }}'),
|
||||
sTableId: '{{ oUIBlock.GetOption("sTableId") }}',
|
||||
//oExtraParams
|
||||
//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 }}"},
|
||||
};
|
||||
|
||||
//if (!typeof $('#datatable_dlg_{{ oUIBlock.GetId() }}').DataTableSettings() !== "undefined")
|
||||
if ($('#datatable_dlg_{{ oUIBlock.GetId() }}').DataTableSettings()) {
|
||||
$('#datatable_dlg_{{ oUIBlock.GetId() }}').DataTableSettings("destroy");
|
||||
}
|
||||
$('#datatable_dlg_{{ oUIBlock.GetId() }}').DataTableSettings($aOptions);
|
||||
@@ -1,6 +1,11 @@
|
||||
<form method="post" enctype="multipart/form-data" id="{{ oUIBlock.GetId() }}"
|
||||
{% if oUIBlock.GetOnSubmitJsCode() %}onSubmit="{{ oUIBlock.GetOnSubmitJsCode() }}"{% endif %}
|
||||
{% if oUIBlock.GetAction() %}action="{{ oUIBlock.GetAction() }}"{% endif %}>
|
||||
{% if oUIBlock.GetOnSubmitJsCode() %}
|
||||
onSubmit="{{ oUIBlock.GetOnSubmitJsCode() }}"
|
||||
{% endif %}
|
||||
{% if oUIBlock.GetAction() %}
|
||||
action="{{ oUIBlock.GetAction() }}"
|
||||
{% endif %}
|
||||
>
|
||||
{% apply spaceless %}
|
||||
{% block iboContentBlockContainer %}
|
||||
{% for oSubBlock in oUIBlock.GetSubBlocks() %}
|
||||
|
||||
@@ -7,6 +7,16 @@
|
||||
{{ render_block(oLayout, {aPage: aPage}) }}
|
||||
{% endif %}
|
||||
|
||||
{% if aDeferredBlocks is not empty %}
|
||||
{# TODO 3.0.0 #}
|
||||
{# <script type="text/javascript"> #}
|
||||
{# $('body').append('{% for oBlock in aDeferredBlocks %}{{ render_block(oBlock, {aPage: aPage})|escape_for_js_string|raw }}{% endfor %}'); #}
|
||||
{# </script> #}
|
||||
{% for oBlock in aDeferredBlocks %}
|
||||
{{ render_block(oBlock, {aPage: aPage})|raw }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% block iboPageJsInlineLive %}
|
||||
{% for sJsInline in aPage.aJsInlineLive %}
|
||||
{# We put each scripts in a dedicated script tag to prevent massive failure if 1 script is broken (eg. missing semi-colon or non closed multi-line comment) #}
|
||||
@@ -16,6 +26,12 @@
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
{% if sDeferredContent %}
|
||||
<script type="text/javascript">
|
||||
$('body').append('{{ sDeferredContent|raw }}');
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
{% block iboPageJsFiles %}
|
||||
{% for sJsFile in aPage.aJsFiles %}
|
||||
<script type="text/javascript">
|
||||
@@ -24,11 +40,6 @@
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
{% if sDeferredContent %}
|
||||
<script type="text/javascript">
|
||||
$('body').append('{{ sDeferredContent|raw }}');
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
{% block iboPageJsInlineOnDomReady %}
|
||||
{% for sJsInline in aPage.aJsInlineOnDomReady %}
|
||||
|
||||
@@ -48,6 +48,13 @@
|
||||
<div style="display:none" id="ajax_content"></div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block iboDeferredBlocks %}
|
||||
{% for oBlock in aDeferredBlocks %}
|
||||
{{ render_block(oBlock, {aPage: aPage}) }}
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
{% block iboPageJsFiles %}
|
||||
{% for sJsFile in aPage.aJsFiles %}
|
||||
<script type="text/javascript" src="{{ sJsFile|add_itop_version }}"></script>
|
||||
|
||||
Reference in New Issue
Block a user