Issue #13032 - fix designer on QA_4_8
Used cherry-pick : Merge pull request #14376 from williamdes/issue-13032-designer
Cherry-picked-from: cb2dae58be
Issue #13032 - fix designer
Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
parent
8b106a44f9
commit
18c23df20f
@ -23,17 +23,16 @@ AJAX.registerOnload('designer/init.js', function () {
|
||||
$('#ab').accordion('refresh');
|
||||
return false;
|
||||
});
|
||||
var tables_data = JSON.parse($('#script_tables').html());
|
||||
|
||||
j_tabs = tables_data.j_tabs;
|
||||
h_tabs = tables_data.h_tabs;
|
||||
contr = JSON.parse($('#script_contr').html());
|
||||
display_field = JSON.parse($('#script_display_field').html());
|
||||
j_tabs = designer_config.scriptTables.j_tabs;
|
||||
h_tabs = designer_config.scriptTables.h_tabs;
|
||||
contr = designer_config.scriptContr;
|
||||
display_field = designer_config.scriptDisplayField;
|
||||
|
||||
server = $('#script_server').html();
|
||||
db = $('#script_db').html();
|
||||
selected_page = $('#script_display_page').html() === '' ? '-1' : $('#script_display_page').html();
|
||||
designer_tables_enabled = $('#designer_tables_enabled').html() === '1';
|
||||
server = designer_config.server;
|
||||
db = designer_config.db;
|
||||
selected_page = designer_config.displayPage;
|
||||
designer_tables_enabled = designer_config.tablesEnabled;
|
||||
|
||||
Main();
|
||||
|
||||
|
||||
@ -151,14 +151,16 @@ class Designer
|
||||
$display_page
|
||||
) {
|
||||
$cfgRelation = $this->relation->getRelationsParam();
|
||||
$designerConfig = new \stdClass();
|
||||
$designerConfig->db = $_GET['db'];
|
||||
$designerConfig->scriptTables = $script_tables;
|
||||
$designerConfig->scriptContr = $script_contr;
|
||||
$designerConfig->server = $GLOBALS['server'];
|
||||
$designerConfig->scriptDisplayField = $script_display_field;
|
||||
$designerConfig->displayPage = $display_page;
|
||||
$designerConfig->tablesEnabled = $cfgRelation['pdfwork'];
|
||||
return Template::get('database/designer/js_fields')->render([
|
||||
'server' => $GLOBALS['server'],
|
||||
'db' => $_GET['db'],
|
||||
'script_tables' => json_encode($script_tables),
|
||||
'script_contr' => json_encode($script_contr),
|
||||
'script_display_field' => json_encode($script_display_field),
|
||||
'display_page' => $display_page,
|
||||
'relation_pdfwork' => $cfgRelation['pdfwork'],
|
||||
'designer_config' => json_encode($designerConfig)
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@ -45,7 +45,15 @@ class Common
|
||||
$GLOBALS['designer']['TABLE_NAME'] = array();// that foreach no error
|
||||
$GLOBALS['designer']['OWNER'] = array();
|
||||
$GLOBALS['designer']['TABLE_NAME_SMALL'] = array();
|
||||
$GLOBALS['designer']['TABLE_TYPE'] = array();
|
||||
|
||||
$GLOBALS['designer_url']['TABLE_NAME'] = array();
|
||||
$GLOBALS['designer_url']['OWNER'] = array();
|
||||
$GLOBALS['designer_url']['TABLE_NAME_SMALL'] = array();
|
||||
|
||||
$GLOBALS['designer_out']['TABLE_NAME'] = array();
|
||||
$GLOBALS['designer_out']['OWNER'] = array();
|
||||
$GLOBALS['designer_out']['TABLE_NAME_SMALL'] = array();
|
||||
$tables = $GLOBALS['dbi']->getTablesFull($GLOBALS['db']);
|
||||
// seems to be needed later
|
||||
$GLOBALS['dbi']->selectDb($GLOBALS['db']);
|
||||
@ -80,7 +88,8 @@ class Common
|
||||
|
||||
$DF = $this->relation->getDisplayField($GLOBALS['db'], $one_table['TABLE_NAME']);
|
||||
if ($DF != '') {
|
||||
$retval[$GLOBALS['designer_url']["TABLE_NAME_SMALL"][$i]] = $DF;
|
||||
$DF = rawurlencode((string)$DF);
|
||||
$retval[rawurlencode($GLOBALS['designer_url']["TABLE_NAME_SMALL"][$i])] = $DF;
|
||||
}
|
||||
|
||||
$i++;
|
||||
@ -144,12 +153,12 @@ class Common
|
||||
if ($row !== false) {
|
||||
foreach ($row as $field => $value) {
|
||||
$con['C_NAME'][$i] = '';
|
||||
$con['DTN'][$i] = urlencode($GLOBALS['db'] . "." . $val[0]);
|
||||
$con['DCN'][$i] = urlencode($field);
|
||||
$con['STN'][$i] = urlencode(
|
||||
$con['DTN'][$i] = rawurlencode($GLOBALS['db'] . "." . $val[0]);
|
||||
$con['DCN'][$i] = rawurlencode($field);
|
||||
$con['STN'][$i] = rawurlencode(
|
||||
$value['foreign_db'] . "." . $value['foreign_table']
|
||||
);
|
||||
$con['SCN'][$i] = urlencode($value['foreign_field']);
|
||||
$con['SCN'][$i] = rawurlencode($value['foreign_field']);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
@ -158,15 +167,15 @@ class Common
|
||||
if ($row !== false) {
|
||||
foreach ($row['foreign_keys_data'] as $one_key) {
|
||||
foreach ($one_key['index_list'] as $index => $one_field) {
|
||||
$con['C_NAME'][$i] = $one_key['constraint'];
|
||||
$con['DTN'][$i] = urlencode($GLOBALS['db'] . "." . $val[0]);
|
||||
$con['DCN'][$i] = urlencode($one_field);
|
||||
$con['STN'][$i] = urlencode(
|
||||
$con['C_NAME'][$i] = rawurlencode($one_key['constraint']);
|
||||
$con['DTN'][$i] = rawurlencode($GLOBALS['db'] . "." . $val[0]);
|
||||
$con['DCN'][$i] = rawurlencode($one_field);
|
||||
$con['STN'][$i] = rawurlencode(
|
||||
(isset($one_key['ref_db_name']) ?
|
||||
$one_key['ref_db_name'] : $GLOBALS['db'])
|
||||
. "." . $one_key['ref_table_name']
|
||||
);
|
||||
$con['SCN'][$i] = urlencode($one_key['ref_index_list'][$index]);
|
||||
$con['SCN'][$i] = rawurlencode($one_key['ref_index_list'][$index]);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
@ -180,8 +189,8 @@ class Common
|
||||
$dtn_i = $con['DTN'][$i];
|
||||
$retval[$ti] = array();
|
||||
$retval[$ti][$c_name_i] = array();
|
||||
if (in_array($dtn_i, $GLOBALS['designer_url']["TABLE_NAME"])
|
||||
&& in_array($con['STN'][$i], $GLOBALS['designer_url']["TABLE_NAME"])
|
||||
if (in_array(rawurldecode($dtn_i), $GLOBALS['designer_url']["TABLE_NAME"])
|
||||
&& in_array(rawurldecode($con['STN'][$i]), $GLOBALS['designer_url']["TABLE_NAME"])
|
||||
) {
|
||||
$retval[$ti][$c_name_i][$dtn_i] = array();
|
||||
$retval[$ti][$c_name_i][$dtn_i][$con['DCN'][$i]] = array(
|
||||
@ -248,8 +257,8 @@ class Common
|
||||
if (Util::isForeignKeySupported($GLOBALS['designer']['TABLE_TYPE'][$i])) {
|
||||
$j = 1;
|
||||
}
|
||||
$retval['j_tabs'][$GLOBALS['designer_url']['TABLE_NAME'][$i]] = $j;
|
||||
$retval['h_tabs'][$GLOBALS['designer_url']['TABLE_NAME'][$i]] = 1;
|
||||
$retval['j_tabs'][\rawurlencode($GLOBALS['designer_url']['TABLE_NAME'][$i])] = $j;
|
||||
$retval['h_tabs'][\rawurlencode($GLOBALS['designer_url']['TABLE_NAME'][$i])] = 1;
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
{% for i in 0..table_names|length - 1 %}
|
||||
{% set t_n = table_names[i] %}
|
||||
{% for t_n in table_names %}
|
||||
{% set i = loop.index0 %}
|
||||
{% set t_n_url = table_names_url[i] %}
|
||||
<input name="t_x[{{ t_n_url }}]" type="hidden" id="t_x_{{ t_n_url }}_" />
|
||||
<input name="t_y[{{ t_n_url }}]" type="hidden" id="t_y_{{ t_n_url }}_" />
|
||||
<input name="t_v[{{ t_n_url }}]" type="hidden" id="t_v_{{ t_n_url }}_" />
|
||||
<input name="t_h[{{ t_n_url }}]" type="hidden" id="t_h_{{ t_n_url }}_" />
|
||||
<table id="{{ t_n_url }}"
|
||||
<input name="t_x[{{ t_n_url|url_encode }}]" type="hidden" id="t_x_{{ t_n_url|url_encode }}_" />
|
||||
<input name="t_y[{{ t_n_url|url_encode }}]" type="hidden" id="t_y_{{ t_n_url|url_encode }}_" />
|
||||
<input name="t_v[{{ t_n_url|url_encode }}]" type="hidden" id="t_v_{{ t_n_url|url_encode }}_" />
|
||||
<input name="t_h[{{ t_n_url|url_encode }}]" type="hidden" id="t_h_{{ t_n_url|url_encode }}_" />
|
||||
<table id="{{ t_n_url|url_encode }}"
|
||||
cellpadding="0"
|
||||
cellspacing="0"
|
||||
class="designer_tab"
|
||||
@ -20,17 +20,17 @@
|
||||
<input class="select_all_1"
|
||||
type="checkbox"
|
||||
style="margin: 0;"
|
||||
value="select_all_{{ t_n_url }}"
|
||||
id="select_all_{{ t_n_url }}"
|
||||
value="select_all_{{ t_n_url|url_encode }}"
|
||||
id="select_all_{{ t_n_url|url_encode }}"
|
||||
title="select all"
|
||||
designer_url_table_name="{{ t_n_url }}"
|
||||
designer_url_table_name="{{ t_n_url|url_encode }}"
|
||||
designer_out_owner="{{ owner_out[i]|raw }}">
|
||||
</td>
|
||||
{% endif %}
|
||||
<td class="small_tab"
|
||||
title="{% trans 'Show/hide columns' %}"
|
||||
id="id_hide_tbody_{{ t_n_url }}"
|
||||
table_name="{{ t_n_url }}">
|
||||
id="id_hide_tbody_{{ t_n_url|url_encode }}"
|
||||
table_name="{{ t_n_url|url_encode }}">
|
||||
{{ tab_pos[t_n] is not defined or tab_pos[t_n]['V'] is not empty ? 'v' : '>' }}
|
||||
</td>
|
||||
<td class="small_tab_pref small_tab_pref_1"
|
||||
@ -38,9 +38,9 @@
|
||||
<img src="{{ theme.getImgPath('designer/exec_small.png') }}"
|
||||
title="{% trans 'See table structure' %}" />
|
||||
</td>
|
||||
<td id="id_zag_{{ t_n_url }}"
|
||||
<td id="id_zag_{{ t_n_url|url_encode }}"
|
||||
class="tab_zag nowrap tab_zag_noquery"
|
||||
table_name="{{ t_n_url }}"
|
||||
table_name="{{ t_n_url|url_encode }}"
|
||||
query_set="{{ has_query ? 1 : 0 }}">
|
||||
<span class="owner">
|
||||
{{ owner_out[i]|raw }}
|
||||
@ -49,13 +49,13 @@
|
||||
</td>
|
||||
{% if has_query %}
|
||||
<td class="tab_zag tab_zag_query"
|
||||
id="id_zag_{{ t_n_url }}_2"
|
||||
table_name="{{ t_n_url }}">
|
||||
id="id_zag_{{ t_n_url|url_encode }}_2"
|
||||
table_name="{{ t_n_url|url_encode }}">
|
||||
</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="id_tbody_{{ t_n_url }}"
|
||||
<tbody id="id_tbody_{{ t_n_url|url_encode }}"
|
||||
{{- tab_pos[t_n] is defined and tab_pos[t_n]['V'] is empty ? ' style="display: none"' }}>
|
||||
{% set display_field = Relation_getDisplayField(get_db, table_names_small[i]) %}
|
||||
{% for j in 0..tab_column[t_n]['COLUMN_ID']|length - 1 %}
|
||||
@ -78,9 +78,9 @@
|
||||
{% if has_query %}
|
||||
<td class="select_all">
|
||||
<input class="select_all_store_col"
|
||||
value="{{ t_n_url }}{{ tab_column[t_n]['COLUMN_NAME'][j]|url_encode }}"
|
||||
value="{{ t_n_url|url_encode }}{{ tab_column[t_n]['COLUMN_NAME'][j]|url_encode }}"
|
||||
type="checkbox"
|
||||
id="select_{{ t_n_url }}._{{ tab_column[t_n]['COLUMN_NAME'][j]|url_encode }}"
|
||||
id="select_{{ t_n_url|url_encode }}._{{ tab_column[t_n]['COLUMN_NAME'][j]|url_encode }}"
|
||||
style="margin: 0;"
|
||||
title="select_{{ tab_column[t_n]['COLUMN_NAME'][j]|url_encode }}"
|
||||
store_column_param="{{ table_names_small_out[i]|url_encode }},
|
||||
@ -88,7 +88,7 @@
|
||||
{{- tab_column[t_n]['COLUMN_NAME'][j]|url_encode }}">
|
||||
</td>
|
||||
{% endif %}
|
||||
<td width="10px" colspan="3" id="{{ t_n_url }}.
|
||||
<td width="10px" colspan="3" id="{{ t_n_url|url_encode }}.
|
||||
{{- tab_column[t_n]['COLUMN_NAME'][j]|url_encode }}">
|
||||
<div class="nowrap">
|
||||
{% if tables_pk_or_unique_keys[t_n ~ '.' ~ tab_column[t_n]['COLUMN_NAME'][j]] is defined %}
|
||||
|
||||
@ -1,10 +1,6 @@
|
||||
{# Invisible characters will make javascript crash #}
|
||||
{% spaceless %}
|
||||
<div id="script_server" class="hide">{{ server }}</div>
|
||||
<div id="script_db" class="hide">{{ db }}</div>
|
||||
<div id="script_tables" class="hide">{{ script_tables }}</div>
|
||||
<div id="script_contr" class="hide">{{ script_contr }}</div>
|
||||
<div id="script_display_field" class="hide">{{ script_display_field }}</div>
|
||||
<div id="script_display_page" class="hide">{{ display_page }}</div>
|
||||
<div id="designer_tables_enabled" class="hide">{{ relation_pdfwork }}</div>
|
||||
<script type="text/javascript">
|
||||
var designer_config = {{ designer_config | raw }};
|
||||
</script>
|
||||
{% endspaceless %}
|
||||
|
||||
@ -32,10 +32,10 @@
|
||||
<td width="1px">
|
||||
<input class="scroll_tab_checkbox"
|
||||
title="{% trans 'Hide' %}"
|
||||
id="check_vis_{{ table_names_url[i] }}"
|
||||
id="check_vis_{{ table_names_url[i]|url_encode }}"
|
||||
style="margin:0;"
|
||||
type="checkbox"
|
||||
value="{{ table_names_url[i] }}"
|
||||
value="{{ table_names_url[i]|url_encode }}"
|
||||
{% if (tab_pos[table_names[i]] is defined
|
||||
and tab_pos[table_names[i]]['H'])
|
||||
or display_page == -1 -%}
|
||||
@ -43,7 +43,7 @@
|
||||
{%- endif %} />
|
||||
</td>
|
||||
<td class="designer_Tabs"
|
||||
designer_url_table_name="{{ table_names_url[i] }}">
|
||||
designer_url_table_name="{{ table_names_url[i]|url_encode }}">
|
||||
{{ table_names_out[i]|raw }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user