From 04d6d5ca99ebfd1cebb8ce06618fb3811fc1a8aa Mon Sep 17 00:00:00 2001 From: Charles Date: Thu, 9 Jan 2020 10:55:03 +0100 Subject: phpmyadmin working --- .../table/structure/display_structure.twig | 516 +++++++++++++++++++++ 1 file changed, 516 insertions(+) create mode 100644 srcs/phpmyadmin/templates/table/structure/display_structure.twig (limited to 'srcs/phpmyadmin/templates/table/structure/display_structure.twig') diff --git a/srcs/phpmyadmin/templates/table/structure/display_structure.twig b/srcs/phpmyadmin/templates/table/structure/display_structure.twig new file mode 100644 index 0000000..16e11db --- /dev/null +++ b/srcs/phpmyadmin/templates/table/structure/display_structure.twig @@ -0,0 +1,516 @@ +{% extends 'table/page_with_secondary_tabs.twig' %} +{% block content %} +
+ {{ get_hidden_inputs(db, table) }} + +
+ + {# Table header #} + + + + + + + + + + + {% if show_column_comments -%} + + {%- endif %} + + {# @see table/structure.js, function moreOptsMenuResize() #} + {% if not db_is_system_schema and not tbl_is_view %} + + {% endif %} + + + + {# Table body #} + {% set rownum = 0 %} + {% for row in fields %} + {% set rownum = rownum + 1 %} + + {% set extracted_columnspec = extracted_columnspecs[rownum] %} + {% set field_name = row['Field']|e %} + {# For column comments #} + {% set comments = row_comments[rownum] %} + {# Underline commented fields and display a hover-title (CSS only) #} + + + + + + + + {{ extracted_columnspec['displayed_type']|raw }} + {% if relation_commwork and relation_mimework and browse_mime + and mime_map[row['Field']]['mimetype'] is defined %} +
{% trans 'Media (MIME) type:' %} {{ mime_map[row['Field']]['mimetype']|replace({'_': '/'})|lower }} + {% endif %} +
+ +
+ + + + {% if show_column_comments %} + + {% endif %} + + {% if not tbl_is_view and not db_is_system_schema %} + + + {% endif %} + + {% if not tbl_is_view and not db_is_system_schema %} + {% set type = extracted_columnspec['print_type'] is not empty ? extracted_columnspec['print_type'] %} + + {% endif %} + + {% endfor %} + +
#{% trans 'Name' %}{% trans 'Type' %}{% trans 'Collation' %}{% trans 'Attributes' %}{% trans 'Null' %}{% trans 'Default' %}{% trans 'Comments' %}{% trans 'Extra' %}{% trans 'Action' %}
{{ rownum }} + + + {% if row['Collation'] is not empty %} + {{ collations[row['Collation']].name }} + {% endif %} + {{ attributes[rownum] }}{{ row['Null'] == 'YES' ? 'Yes'|trans : 'No'|trans }} + {% if row['Default'] is not null %} + {% if extracted_columnspec['type'] == 'bit' %} + {{ row['Default']|convert_bit_default_value }} + {% else %} + {{ row['Default'] }} + {% endif %} + {% elseif row['Null'] == 'YES' %} + NULL + {% else %} + {% trans %}None{% context %}None for default{% endtrans %} + {% endif %} + + {{ comments }} + {{ row['Extra']|upper }}
+
+ +
+ +
+

{% trans 'Move the columns by dragging them up and down.' %}

+
+
+ {{ get_hidden_inputs(db, table) }} +
    +
    +
    +
    +{# Work on the table #} + +{% if not tbl_is_view and not db_is_system_schema %} +
    + {{ get_hidden_inputs(db, table) }} + {% if show_icons('ActionLinksMode') %} + {{ get_image('b_insrow', 'Add column'|trans) }}  + {% endif %} + {% set num_fields -%} + + {%- endset %} + {{ 'Add %s column(s)'|trans|format(num_fields)|raw }} +   + {# I tried displaying the drop-down inside the label but with Firefox the drop-down was blinking #} + + +
    +{% endif %} + +{# Displays indexes #} +{% if not tbl_is_view and not db_is_system_schema + and 'ARCHIVE' != tbl_storage_engine %} + {{ displayIndexesHtml|raw }} +{% endif %} + +{# Display partition details #} +{% if have_partitioning %} + {# Detect partitioning #} + {% if partition_names is not empty and partition_names[0] is not null %} + {% set first_partition = partitions[0] %} + {% set range_or_list = first_partition.getMethod() == 'RANGE' + or first_partition.getMethod() == 'RANGE COLUMNS' + or first_partition.getMethod() == 'LIST' + or first_partition.getMethod() == 'LIST COLUMNS' %} + {% set sub_partitions = first_partition.getSubPartitions() %} + {% set has_sub_partitions = first_partition.hasSubPartitions() %} + {% if has_sub_partitions %} + {% set first_sub_partition = sub_partitions[0] %} + {% endif %} + + {% set action_icons = { + 'ANALYZE': get_icon('b_search', 'Analyze'|trans), + 'CHECK': get_icon('eye', 'Check'|trans), + 'OPTIMIZE': get_icon('normalize', 'Optimize'|trans), + 'REBUILD': get_icon('s_tbl', 'Rebuild'|trans), + 'REPAIR': get_icon('b_tblops', 'Repair'|trans), + 'TRUNCATE': get_icon('b_empty', 'Truncate'|trans), + } %} + {% if range_or_list %} + {% set action_icons = action_icons|merge({'DROP': get_icon('b_drop', 'Drop'|trans)}) %} + {% endif %} + + {# open Slider Effect div #} + {% include 'div_for_slider_effect.twig' with { + 'id': 'partitions-2', + 'message': 'Partitions'|trans, + 'initial_sliders_state': default_sliders_state + } only %} + + {% set remove_sql = 'ALTER TABLE ' ~ backquote(table) ~ ' REMOVE PARTITIONING' %} + {% set remove_url = 'sql.php' ~ url_query ~ '&sql_query=' ~ remove_sql|url_encode %} + + {% include 'table/structure/display_partitions.twig' with { + 'db': db, + 'table': table, + 'url_query': url_query, + 'partitions': partitions, + 'partition_method': first_partition.getMethod(), + 'partition_expression': first_partition.getExpression(), + 'has_description': first_partition.getDescription() is not empty, + 'has_sub_partitions': has_sub_partitions, + 'sub_partition_method': has_sub_partitions ? first_sub_partition.getMethod(), + 'sub_partition_expression': has_sub_partitions ? first_sub_partition.getExpression(), + 'action_icons': action_icons, + 'range_or_list': range_or_list, + 'remove_url': remove_url + } only %} + {% else %} + {% include 'table/structure/display_partitions.twig' with { + 'db': db, + 'table': table + } only %} + {% endif %} + {# For closing Slider effect div #} + +{% endif %} + +{# Displays Space usage and row statistics #} +{% if show_stats %} + {{ table_stats|raw }} +{% endif %} +
    +{% endblock %} -- cgit