From 04d6d5ca99ebfd1cebb8ce06618fb3811fc1a8aa Mon Sep 17 00:00:00 2001 From: Charles Date: Thu, 9 Jan 2020 10:55:03 +0100 Subject: phpmyadmin working --- .../table/search/column_comparison_operators.twig | 3 + .../templates/table/search/fields_table.twig | 33 +++ .../templates/table/search/form_tag.twig | 4 + .../templates/table/search/geom_func.twig | 19 ++ .../templates/table/search/input_box.twig | 97 +++++++++ .../templates/table/search/replace_preview.twig | 39 ++++ .../templates/table/search/rows_normal.twig | 39 ++++ .../templates/table/search/rows_zoom.twig | 74 +++++++ .../templates/table/search/selection_form.twig | 226 +++++++++++++++++++++ .../templates/table/search/zoom_result_form.twig | 86 ++++++++ 10 files changed, 620 insertions(+) create mode 100644 srcs/phpmyadmin/templates/table/search/column_comparison_operators.twig create mode 100644 srcs/phpmyadmin/templates/table/search/fields_table.twig create mode 100644 srcs/phpmyadmin/templates/table/search/form_tag.twig create mode 100644 srcs/phpmyadmin/templates/table/search/geom_func.twig create mode 100644 srcs/phpmyadmin/templates/table/search/input_box.twig create mode 100644 srcs/phpmyadmin/templates/table/search/replace_preview.twig create mode 100644 srcs/phpmyadmin/templates/table/search/rows_normal.twig create mode 100644 srcs/phpmyadmin/templates/table/search/rows_zoom.twig create mode 100644 srcs/phpmyadmin/templates/table/search/selection_form.twig create mode 100644 srcs/phpmyadmin/templates/table/search/zoom_result_form.twig (limited to 'srcs/phpmyadmin/templates/table/search') diff --git a/srcs/phpmyadmin/templates/table/search/column_comparison_operators.twig b/srcs/phpmyadmin/templates/table/search/column_comparison_operators.twig new file mode 100644 index 0000000..b72e530 --- /dev/null +++ b/srcs/phpmyadmin/templates/table/search/column_comparison_operators.twig @@ -0,0 +1,3 @@ + diff --git a/srcs/phpmyadmin/templates/table/search/fields_table.twig b/srcs/phpmyadmin/templates/table/search/fields_table.twig new file mode 100644 index 0000000..8b74939 --- /dev/null +++ b/srcs/phpmyadmin/templates/table/search/fields_table.twig @@ -0,0 +1,33 @@ + + + + {% if geom_column_flag %} + + {% endif %} + + + + + + + + + {% if search_type == 'zoom' %} + {% include 'table/search/rows_zoom.twig' with { + 'self': self, + 'column_names': column_names, + 'keys': keys, + 'criteria_column_names': criteria_column_names, + 'criteria_column_types': criteria_column_types + } only %} + {% else %} + {% include 'table/search/rows_normal.twig' with { + 'self': self, + 'geom_column_flag': geom_column_flag, + 'column_names': column_names, + 'column_types': column_types, + 'column_collations': column_collations + } only %} + {% endif %} + +
{% trans 'Function' %}{% trans 'Column' %}{% trans 'Type' %}{% trans 'Collation' %}{% trans 'Operator' %}{% trans 'Value' %}
diff --git a/srcs/phpmyadmin/templates/table/search/form_tag.twig b/srcs/phpmyadmin/templates/table/search/form_tag.twig new file mode 100644 index 0000000..1017abd --- /dev/null +++ b/srcs/phpmyadmin/templates/table/search/form_tag.twig @@ -0,0 +1,4 @@ +
+ {{ get_hidden_inputs(db, table) }} + + diff --git a/srcs/phpmyadmin/templates/table/search/geom_func.twig b/srcs/phpmyadmin/templates/table/search/geom_func.twig new file mode 100644 index 0000000..f7a7415 --- /dev/null +++ b/srcs/phpmyadmin/templates/table/search/geom_func.twig @@ -0,0 +1,19 @@ +{# Displays 'Function' column if it is present #} + + {% set geom_types = get_gis_datatypes() %} + {% if column_types[column_index] in geom_types %} + + {% else %} +   + {% endif %} + diff --git a/srcs/phpmyadmin/templates/table/search/input_box.twig b/srcs/phpmyadmin/templates/table/search/input_box.twig new file mode 100644 index 0000000..5c30535 --- /dev/null +++ b/srcs/phpmyadmin/templates/table/search/input_box.twig @@ -0,0 +1,97 @@ +{# Get inputbox based on different column types (Foreign key, geometrical, enum) #} +{% if foreigners and search_column_in_foreigners(foreigners, column_name) %} + {% if foreign_data['disp_row'] is iterable %} + + {% elseif foreign_data['foreign_link'] == true %} + + + {{ titles['Browse']|replace({"'": "\\'"})|raw }} + + {% endif %} +{% elseif column_type in get_gis_datatypes() %} + + {% if in_fbs %} + {% set edit_url = 'gis_data_editor.php' ~ get_common() %} + {% set edit_str = get_icon('b_edit', 'Edit/Insert'|trans) %} + + {{ link_or_button(edit_url, edit_str, [], '_blank') }} + + {% endif %} +{% elseif column_type starts with 'enum' + or (column_type starts with 'set' and in_zoom_search_edit) %} + {% set in_zoom_search_edit = false %} + {% set value = column_type|e|slice(5, -1)|replace({''': ''})|split(', ') %} + {% set cnt_value = value|length %} + {# + Enum in edit mode --> dropdown + Enum in search mode --> multiselect + Set in edit mode --> multiselect + Set in search mode --> input (skipped here, so the 'else' section would handle it) + #} + {% if (column_type starts with 'enum' and not in_zoom_search_edit) + or (column_type starts with 'set' and in_zoom_search_edit) %} + + {% endif %} + {# Add select options #} + + {% for i in 0..cnt_value - 1 %} + {% if criteria_values[column_index] is defined + and criteria_values[column_index] is iterable + and value[i] in criteria_values[column_index] %} + + {% else %} + + {% endif %} + {% endfor %} + +{% else %} + {% set the_class = 'textfield' %} + {% if column_type == 'date' %} + {% set the_class = the_class ~ ' datefield' %} + {% elseif column_type == 'datetime' or column_type starts with 'timestamp' %} + {% set the_class = the_class ~ ' datetimefield' %} + {% elseif column_type starts with 'bit' %} + {% set the_class = the_class ~ ' bit' %} + {% endif %} + +{% endif %} diff --git a/srcs/phpmyadmin/templates/table/search/replace_preview.twig b/srcs/phpmyadmin/templates/table/search/replace_preview.twig new file mode 100644 index 0000000..e7a2423 --- /dev/null +++ b/srcs/phpmyadmin/templates/table/search/replace_preview.twig @@ -0,0 +1,39 @@ + + {{ get_hidden_inputs(db, table) }} + + + + + + +
+ {% trans 'Find and replace - preview' %} + + + + + + + + + + {% if result is iterable %} + {% for row in result %} + + {# count #} + {# original #} + {# replaced #} + + {% endfor %} + {% endif %} + +
{% trans 'Count' %}{% trans 'Original string' %}{% trans 'Replaced string' %}
{{ row[2] }}{{ row[0] }}{{ row[1] }}
+
+ +
+ +
+
diff --git a/srcs/phpmyadmin/templates/table/search/rows_normal.twig b/srcs/phpmyadmin/templates/table/search/rows_normal.twig new file mode 100644 index 0000000..5e21efa --- /dev/null +++ b/srcs/phpmyadmin/templates/table/search/rows_normal.twig @@ -0,0 +1,39 @@ +{% for column_index in 0..column_names|length - 1 %} + + {# If 'Function' column is present trying to change comment #} + {% if geom_column_flag %} + {% include 'table/search/geom_func.twig' with { + 'column_index': column_index, + 'column_types': column_types + } only %} + {% endif %} + {# Displays column's name, type, collation and value #} + + {{ column_names[column_index] }} + + {% set properties = self.getColumnProperties(column_index, column_index) %} + + {{ properties['type'] }} + + + {{ properties['collation'] }} + + + {{ properties['func']|raw }} + + {# here, the data-type attribute is needed for a date/time picker #} + + {{ properties['value']|raw }} + {# Displays hidden fields #} + + + + + +{% endfor %} diff --git a/srcs/phpmyadmin/templates/table/search/rows_zoom.twig b/srcs/phpmyadmin/templates/table/search/rows_zoom.twig new file mode 100644 index 0000000..dc46f1d --- /dev/null +++ b/srcs/phpmyadmin/templates/table/search/rows_zoom.twig @@ -0,0 +1,74 @@ +{# Get already set search criteria (if any) #} +{% set type = [] %} +{% set collation = [] %} +{% set func = [] %} +{% set value = [] %} + +{% for i in 0..3 %} + {# After X-Axis and Y-Axis column rows, display additional criteria option #} + {% if i == 2 %} + + + {% trans 'Additional search criteria' %} + + + {% endif %} + + + + + {% if criteria_column_names[i] is defined + and criteria_column_names[i] != 'pma_null' %} + {% set key = keys[criteria_column_names[i]] %} + {% set properties = self.getColumnProperties(i, key) %} + {% set type = type|merge({i: properties['type']}) %} + {% set collation = collation|merge({i: properties['collation']}) %} + {% set func = func|merge({i: properties['func']}) %} + {% set value = value|merge({i: properties['value']}) %} + {% endif %} + {# Column type #} + + {{ type[i] is defined ? type[i] }} + + {# Column Collation #} + + {{ collation[i] is defined ? collation[i] }} + + {# Select options for column operators #} + + {{ func[i] is defined ? func[i]|raw }} + + {# Inputbox for search criteria value #} + + + + {{ value[i] is defined ? value[i]|raw }} + {# Displays hidden fields #} + + + + +{% endfor %} diff --git a/srcs/phpmyadmin/templates/table/search/selection_form.twig b/srcs/phpmyadmin/templates/table/search/selection_form.twig new file mode 100644 index 0000000..2ba4d60 --- /dev/null +++ b/srcs/phpmyadmin/templates/table/search/selection_form.twig @@ -0,0 +1,226 @@ +{% if search_type == 'zoom' %} + {% include 'table/search/form_tag.twig' with { + 'script_name': 'tbl_zoom_select.php', + 'form_id': 'zoom_search_form', + 'db': db, + 'table': table, + 'goto': goto + } only %} + +{% elseif search_type == 'normal' %} + {% include 'table/search/form_tag.twig' with { + 'script_name': 'tbl_select.php', + 'form_id': 'tbl_search_form', + 'db': db, + 'table': table, + 'goto': goto + } only %} + +{% elseif search_type == 'replace' %} + {% include 'table/search/form_tag.twig' with { + 'script_name': 'tbl_find_replace.php', + 'form_id': 'find_replace_form', + 'db': db, + 'table': table, + 'goto': goto + } only %} +
+
+ + {% trans 'Find and replace' %} + {% trans 'Find:' %} + + {% trans 'Replace with:' %} + + + {% trans 'Column:' %} + + + {% include 'checkbox.twig' with { + 'html_field_id': 'useRegex', + 'html_field_name': 'useRegex', + 'label': 'Use regular expression'|trans, + 'checked': false, + 'onclick': false + } only %} +
+
+{% else %} + {% include 'table/search/form_tag.twig' with { + 'script_name': '', + 'form_id': '', + 'db': db, + 'table': table, + 'goto': goto + } only %} +{% endif %} + +{# Displays selection form's footer elements #} +
+ +
+ +
diff --git a/srcs/phpmyadmin/templates/table/search/zoom_result_form.twig b/srcs/phpmyadmin/templates/table/search/zoom_result_form.twig new file mode 100644 index 0000000..7543f85 --- /dev/null +++ b/srcs/phpmyadmin/templates/table/search/zoom_result_form.twig @@ -0,0 +1,86 @@ +
+ {{ get_hidden_inputs(db, table) }} + + + +
+ {% trans 'Browse/Edit the points' %} + + {# JSON encode the data(query result) #} +
+ {% if zoom_submit and data is not empty %} +
+
+ + {% trans 'How to use' %} + +
+
+ {{ data_json }} +
+
+ +
+ {% endif %} +
+ + {# Displays rows in point edit form #} +
+ + + + + + + + + + {% for column_index in 0..column_names|length - 1 %} + {% set field_popup = column_names[column_index] %} + {% set foreign_data = get_foreign_data( + foreigners, + field_popup, + false, + '', + '' + ) %} + + + {# Null checkbox if column can be null #} + + {# Column's Input box #} + + + {% endfor %} + +
{% trans 'Column' %}{% trans 'Null' %}{% trans 'Value' %}
{{ column_names[column_index] }} + {% if column_null_flags[column_index] == 'YES' %} + + {% endif %} + + {% include 'table/search/input_box.twig' with { + 'str': '', + 'column_type': column_types[column_index], + 'column_id': column_types[column_index] ? 'edit_fieldID_' : 'fieldID_', + 'in_zoom_search_edit': true, + 'foreigners': foreigners, + 'column_name': field_popup, + 'column_name_hash': column_name_hashes[field_popup], + 'foreign_data': foreign_data, + 'table': table, + 'column_index': column_index, + 'foreign_max_limit': foreign_max_limit, + 'criteria_values': '', + 'db': db, + 'titles': titles, + 'in_fbs': false + } only %} +
+
+ +
+
-- cgit