diff options
Diffstat (limited to 'srcs/phpmyadmin/templates/database/structure')
9 files changed, 524 insertions, 0 deletions
diff --git a/srcs/phpmyadmin/templates/database/structure/body_for_table_summary.twig b/srcs/phpmyadmin/templates/database/structure/body_for_table_summary.twig new file mode 100644 index 0000000..8dcebdf --- /dev/null +++ b/srcs/phpmyadmin/templates/database/structure/body_for_table_summary.twig @@ -0,0 +1,95 @@ +<tbody id="tbl_summary_row"> +<tr> + <th class="print_ignore"></th> + <th class="tbl_num nowrap"> + {% set num_tables_trans -%} + {% trans %}%s table{% plural num_tables %}%s tables{% endtrans %} + {%- endset %} + {{ num_tables_trans|format(format_number(num_tables, 0)) }} + </th> + {% if server_slave_status %} + <th>{% trans 'Replication' %}</th> + {% endif %} + {% set sum_colspan = db_is_system_schema ? 4 : 7 %} + {% if num_favorite_tables == 0 %} + {% set sum_colspan = sum_colspan - 1 %} + {% endif %} + <th colspan="{{ sum_colspan }}" class="print_ignore">{% trans 'Sum' %}</th> + {% set row_count_sum = format_number(sum_entries, 0) %} + {# If a table shows approximate rows count, display update-all-real-count anchor. #} + {% set row_sum_url = [] %} + {% if approx_rows is defined %} + {% set row_sum_url = { + 'ajax_request': true, + 'db': db, + 'real_row_count': 'true', + 'real_row_count_all': 'true' + } %} + {% endif %} + {% if approx_rows %} + {% set cell_text -%} + <a href="db_structure.php + {{- get_common(row_sum_url) }}" class="ajax row_count_sum">~ + {{- row_count_sum -}} + </a> + {%- endset %} + {% else %} + {% set cell_text = row_count_sum %} + {% endif %} + <th class="value tbl_rows">{{ cell_text }}</th> + {% if not (properties_num_columns > 1) %} + {# MySQL <= 5.5.2 #} + {% set default_engine = dbi.fetchValue('SELECT @@storage_engine;') %} + {% if default_engine is empty %} + {# MySQL >= 5.5.3 #} + {% set default_engine = dbi.fetchValue('SELECT @@default_storage_engine;') %} + {% endif %} + <th class="center"> + <dfn title="{{ '%s is the default storage engine on this MySQL server.'|trans|format(default_engine) }}"> + {{ default_engine }} + </dfn> + </th> + <th> + {% if database_collation is not empty %} + <dfn title="{{ database_collation.description }} ({% trans 'Default' %})"> + {{ database_collation.name }} + </dfn> + {% endif %} + </th> + {% endif %} + + {% if is_show_stats %} + {% set sum = format_byte_down(sum_size, 3, 1) %} + {% set sum_formatted = sum[0] %} + {% set sum_unit = sum[1] %} + <th class="value tbl_size">{{ sum_formatted }} {{ sum_unit }}</th> + + {% set overhead = format_byte_down(overhead_size, 3, 1) %} + {% set overhead_formatted = overhead[0] %} + {% set overhead_unit = overhead[1] %} + <th class="value tbl_overhead">{{ overhead_formatted }} {{ overhead_unit }}</th> + {% endif %} + + {% if show_charset %} + <th>{{ database_charset }}</th> + {% endif %} + {% if show_comment %} + <th></th> + {% endif %} + {% if show_creation %} + <th class="value tbl_creation"> + {{ create_time_all }} + </th> + {% endif %} + {% if show_last_update %} + <th class="value tbl_last_update"> + {{ update_time_all }} + </th> + {% endif %} + {% if show_last_check %} + <th class="value tbl_last_check"> + {{ check_time_all }} + </th> + {% endif %} +</tr> +</tbody> diff --git a/srcs/phpmyadmin/templates/database/structure/check_all_tables.twig b/srcs/phpmyadmin/templates/database/structure/check_all_tables.twig new file mode 100644 index 0000000..7a4e7e9 --- /dev/null +++ b/srcs/phpmyadmin/templates/database/structure/check_all_tables.twig @@ -0,0 +1,40 @@ +<div class="clearfloat print_ignore"> + <img class="selectallarrow" src="{{ pma_theme_image }}arrow_{{ text_dir }}.png" width="38" height="22" alt="{% trans 'With selected:' %}"> + <input type="checkbox" id="tablesForm_checkall" class="checkall_box" title="{% trans 'Check all' %}"> + <label for="tablesForm_checkall">{% trans 'Check all' %}</label> + {% if overhead_check != '' %} + / <a href="#" class="checkall-filter" data-checkall-selector=".tbl-overhead">{% trans 'Check tables having overhead' %}</a> + {% endif %} + <select name="submit_mult" style="margin: 0 3em 0 3em;"> + <option value="{% trans 'With selected:' %}" selected="selected">{% trans 'With selected:' %}</option> + <option value="copy_tbl">{% trans 'Copy table' %}</option> + <option value="show_create">{% trans 'Show create' %}</option> + <option value="export">{% trans 'Export' %}</option> + {% if not db_is_system_schema and not disable_multi_table %} + <optgroup label="{% trans 'Delete data or table' %}"> + <option value="empty_tbl">{% trans 'Empty' %}</option> + <option value="drop_tbl">{% trans 'Drop' %}</option> + </optgroup> + <optgroup label="{% trans 'Table maintenance' %}"> + <option value="analyze_tbl">{% trans 'Analyze table' %}</option> + <option value="check_tbl">{% trans 'Check table' %}</option> + <option value="checksum_tbl">{% trans 'Checksum table' %}</option> + <option value="optimize_tbl">{% trans 'Optimize table' %}</option> + <option value="repair_tbl">{% trans 'Repair table' %}</option> + </optgroup> + <optgroup label="{% trans 'Prefix' %}"> + <option value="add_prefix_tbl">{% trans 'Add prefix to table' %}</option> + <option value="replace_prefix_tbl">{% trans 'Replace table prefix' %}</option> + <option value="copy_tbl_change_prefix">{% trans 'Copy table with prefix' %}</option> + </optgroup> + {% endif %} + {% if central_columns_work is defined and central_columns_work %} + <optgroup label="{% trans 'Central columns' %}"> + <option value="sync_unique_columns_central_list">{% trans 'Add columns to central list' %}</option> + <option value="delete_unique_columns_central_list">{% trans 'Remove columns from central list' %}</option> + <option value="make_consistent_with_central_list">{% trans 'Make consistent with central list' %}</option> + </optgroup> + {% endif %} + </select> + {{ hidden_fields|join('\n')|raw }} +</div> diff --git a/srcs/phpmyadmin/templates/database/structure/favorite_anchor.twig b/srcs/phpmyadmin/templates/database/structure/favorite_anchor.twig new file mode 100644 index 0000000..91e002e --- /dev/null +++ b/srcs/phpmyadmin/templates/database/structure/favorite_anchor.twig @@ -0,0 +1,7 @@ +<a id="{{ table_name_hash }}_favorite_anchor" + class="ajax favorite_table_anchor" + href="db_structure.php{{ get_common(fav_params) }}" + title="{{ already_favorite ? 'Remove from Favorites'|trans : 'Add to Favorites'|trans }}" + data-favtargets="{{ db_table_name_hash }}" > + {{ already_favorite ? titles['Favorite']|raw : titles['NoFavorite']|raw }} +</a> diff --git a/srcs/phpmyadmin/templates/database/structure/index.twig b/srcs/phpmyadmin/templates/database/structure/index.twig new file mode 100644 index 0000000..1632839 --- /dev/null +++ b/srcs/phpmyadmin/templates/database/structure/index.twig @@ -0,0 +1,24 @@ +{% if has_tables %} + <div id="tableslistcontainer"> + {{ list_navigator_html|raw }} + + {{ table_list_html|raw }} + + {{ list_navigator_html|raw }} + </div> + <hr> + <p class="print_ignore"> + <a href="#" id="printView"> + {{ get_icon('b_print', 'Print'|trans, true) }} + </a> + <a href="db_datadict.php{{ get_common({'db': database, 'goto': 'db_structure.php'}) }}" target="print_view"> + {{ get_icon('b_tblanalyse', 'Data dictionary'|trans, true) }} + </a> + </p> +{% else %} + {{ 'No tables found in database.'|trans|notice }} +{% endif %} + +{% if not is_system_schema %} + {{ create_table_html|raw }} +{% endif %} diff --git a/srcs/phpmyadmin/templates/database/structure/show_create.twig b/srcs/phpmyadmin/templates/database/structure/show_create.twig new file mode 100644 index 0000000..520e974 --- /dev/null +++ b/srcs/phpmyadmin/templates/database/structure/show_create.twig @@ -0,0 +1,31 @@ +<div class="show_create_results"> + <h2>{% trans 'Showing create queries' %}</h2> + {% set views = [] %} + {% set tables = [] %} + {% for object in db_objects %} + {% if dbi.getTable(db, object).isView() %} + {% set views = views|merge([object]) %} + {% else %} + {% set tables = tables|merge([object]) %} + {% endif %} + {% endfor %} + {% if tables is not empty %} + {% include 'database/structure/show_create_row.twig' with { + 'db': db, + 'title': 'Tables'|trans, + 'raw_title': 'Table', + 'db_objects': tables, + 'dbi': dbi + } only %} + {% endif %} + + {% if views is not empty %} + {% include 'database/structure/show_create_row.twig' with { + 'db': db, + 'title': 'Views'|trans, + 'raw_title': 'View', + 'db_objects': views, + 'dbi': dbi + } only %} + {% endif %} +</div> diff --git a/srcs/phpmyadmin/templates/database/structure/show_create_row.twig b/srcs/phpmyadmin/templates/database/structure/show_create_row.twig new file mode 100644 index 0000000..db18cdd --- /dev/null +++ b/srcs/phpmyadmin/templates/database/structure/show_create_row.twig @@ -0,0 +1,19 @@ +<fieldset> + <legend>{{ title }}</legend> + <table class="show_create"> + <thead> + <tr> + <th>{{ raw_title }}</th> + <th>{{ 'Create %s'|trans|format(raw_title) }}</th> + </tr> + </thead> + <tbody> + {% for object in db_objects %} + <tr> + <td><strong>{{ object|mime_default_function }}</strong></td> + <td>{{ dbi.getTable(db, object).showCreate()|mime_default_function }}</td> + </tr> + {% endfor %} + </tbody> + </table> +</fieldset> diff --git a/srcs/phpmyadmin/templates/database/structure/structure_table_row.twig b/srcs/phpmyadmin/templates/database/structure/structure_table_row.twig new file mode 100644 index 0000000..b87ea48 --- /dev/null +++ b/srcs/phpmyadmin/templates/database/structure/structure_table_row.twig @@ -0,0 +1,223 @@ +<tr id="row_tbl_{{ curr }}"{{ table_is_view ? ' class="is_view"' }} data-filter-row="{{ current_table['TABLE_NAME']|upper }}"> + <td class="center print_ignore"> + <input type="checkbox" + name="selected_tbl[]" + class="{{ input_class }}" + value="{{ current_table['TABLE_NAME'] }}" + id="checkbox_tbl_{{ curr }}"> + </td> + <th> + <a href="sql.php{{ tbl_url_query|raw }}&pos=0" title="{{ browse_table_label_title }}"> + {{ browse_table_label_truename }} + </a> + {{ tracking_icon|raw }} + </th> + {% if server_slave_status %} + <td class="center"> + {{ ignored ? get_image('s_cancel', 'Not replicated'|trans) }} + {{ do ? get_image('s_success', 'Replicated'|trans) }} + </td> + {% endif %} + + {# Favorite table anchor #} + {% if num_favorite_tables > 0 %} + <td class="center print_ignore"> + {# Check if current table is already in favorite list #} + {% set fav_params = { + 'db': db, + 'ajax_request': true, + 'favorite_table': current_table['TABLE_NAME'], + ((already_favorite ? 'remove' : 'add') ~ '_favorite'): true + } %} + {% include 'database/structure/favorite_anchor.twig' with { + 'table_name_hash': table_name_hash, + 'db_table_name_hash': db_table_name_hash, + 'fav_params': fav_params, + 'already_favorite': already_favorite, + 'titles': titles + } only %} + </td> + {% endif %} + + <td class="center print_ignore"> + <a href="sql.php{{ tbl_url_query|raw }}&pos=0"> + {{ browse_table_title|raw }} + </a> + + </td> + <td class="center print_ignore"> + <a href="tbl_structure.php{{ tbl_url_query|raw }}"> + {{ titles['Structure']|raw }} + </a> + </td> + <td class="center print_ignore"> + <a href="tbl_select.php{{ tbl_url_query|raw }}"> + {{ search_table_title|raw }} + </a> + </td> + + {% if not db_is_system_schema %} + <td class="insert_table center print_ignore"> + <a href="tbl_change.php{{ tbl_url_query|raw }}">{{ titles['Insert']|raw }}</a> + </td> + {% if table_is_view %} + <td class="center print_ignore"> + <a href="view_create.php{{- get_common({ + 'db': db, + 'table': current_table['TABLE_NAME'] + }) }}">{{ titles['Edit']|raw }}</a> + </td> + {% else %} + <td class="center print_ignore"> + <a class="truncate_table_anchor ajax" href="sql.php" data-post="{{ tbl_url_query|raw }}&sql_query= + {{- empty_table_sql_query }}&message_to_show={{ empty_table_message_to_show }}"> + {{ empty_table_title|raw }} + </a> + </td> + {% endif %} + <td class="center print_ignore"> + <a class="ajax drop_table_anchor + {{- table_is_view or current_table['ENGINE'] == null ? ' view' }}" + href="sql.php" data-post="{{ tbl_url_query|raw }}&reload=1&purge=1&sql_query= + {{- drop_query|url_encode }}&message_to_show={{ drop_message|url_encode }}"> + {{ titles['Drop']|raw }} + </a> + </td> + {% endif %} + + {% if current_table['TABLE_ROWS'] is defined + and (current_table['ENGINE'] != null or table_is_view) %} + {# Get the row count #} + {% set row_count = format_number(current_table['TABLE_ROWS'], 0) %} + + {# Content to be appended into 'tbl_rows' cell. + If row count is approximate, display it as an anchor to get real count. #} + <td class="value tbl_rows" + data-table="{{ current_table['TABLE_NAME'] }}"> + {% if approx_rows %} + <a href="db_structure.php{{ get_common({ + 'ajax_request': true, + 'db': db, + 'table': current_table['TABLE_NAME'], + 'real_row_count': 'true' + }) }}" class="ajax real_row_count"> + <bdi> + ~{{ row_count }} + </bdi> + </a> + {% else %} + {{ row_count }} + {% endif %} + {{ show_superscript|raw }} + </td> + + {% if not (properties_num_columns > 1) %} + <td class="nowrap"> + {% if current_table['ENGINE'] is not empty %} + {{ current_table['ENGINE'] }} + {% elseif table_is_view %} + {% trans 'View' %} + {% endif %} + </td> + {% if collation|length > 0 %} + <td class="nowrap"> + {{ collation|raw }} + </td> + {% endif %} + {% endif %} + + {% if is_show_stats %} + <td class="value tbl_size"> + <a href="tbl_structure.php{{ tbl_url_query|raw }}#showusage"> + <span>{{ formatted_size }}</span> <span class="unit">{{ unit }}</span> + </a> + </td> + <td class="value tbl_overhead"> + {{ overhead|raw }} + </td> + {% endif %} + + {% if not (show_charset > 1) %} + {% if charset|length > 0 %} + <td class="nowrap"> + {{ charset|raw }} + </td> + {% endif %} + {% endif %} + + {% if show_comment %} + {% set comment = current_table['Comment'] %} + <td> + {% if comment|length > limit_chars %} + <abbr title="{{ comment }}"> + {{ comment|slice(0, limit_chars) }} + ... + </abbr> + {% else %} + {{ comment }} + {% endif %} + </td> + {% endif %} + + {% if show_creation %} + <td class="value tbl_creation"> + {{ create_time }} + </td> + {% endif %} + + {% if show_last_update %} + <td class="value tbl_last_update"> + {{ update_time }} + </td> + {% endif %} + + {% if show_last_check %} + <td class="value tbl_last_check"> + {{ check_time }} + </td> + {% endif %} + + {% elseif table_is_view %} + <td class="value tbl_rows">-</td> + <td class="nowrap"> + {% trans 'View' %} + </td> + <td class="nowrap">---</td> + {% if is_show_stats %} + <td class="value tbl_size">-</td> + <td class="value tbl_overhead">-</td> + {% endif %} + {% if show_charset %} + <td></td> + {% endif %} + {% if show_comment %} + <td></td> + {% endif %} + {% if show_creation %} + <td class="value tbl_creation">-</td> + {% endif %} + {% if show_last_update %} + <td class="value tbl_last_update">-</td> + {% endif %} + {% if show_last_check %} + <td class="value tbl_last_check">-</td> + {% endif %} + + {% else %} + + {% if db_is_system_schema %} + {% set action_colspan = 3 %} + {% else %} + {% set action_colspan = 6 %} + {% endif %} + {% if num_favorite_tables > 0 %} + {% set action_colspan = action_colspan + 1 %} + {% endif %} + + {% set colspan_for_structure = action_colspan + 3 %} + <td colspan="{{ colspan_for_structure - db_is_system_schema ? 6 : 9 }}" + class="center"> + {% trans 'in use' %} + </td> + {% endif %} +</tr> diff --git a/srcs/phpmyadmin/templates/database/structure/table_header.twig b/srcs/phpmyadmin/templates/database/structure/table_header.twig new file mode 100644 index 0000000..e479f5e --- /dev/null +++ b/srcs/phpmyadmin/templates/database/structure/table_header.twig @@ -0,0 +1,78 @@ +<form method="post" action="db_structure.php" name="tablesForm" id="tablesForm"> +{{ get_hidden_inputs(db) }} +<div class="responsivetable"> +<table id="structureTable" class="data"> + <thead> + <tr> + <th class="print_ignore"></th> + <th>{{ sortable_table_header('Table'|trans, 'table') }}</th> + {% if replication %} + <th>{% trans 'Replication' %}</th> + {% endif %} + + {% if db_is_system_schema %} + {% set action_colspan = 3 %} + {% else %} + {% set action_colspan = 6 %} + {% endif %} + {% if num_favorite_tables > 0 %} + {% set action_colspan = action_colspan + 1 %} + {% endif %} + <th colspan="{{ action_colspan }}" class="print_ignore"> + {% trans 'Action' %} + </th> + {# larger values are more interesting so default sort order is DESC #} + <th> + {{ sortable_table_header('Rows'|trans, 'records', 'DESC') }} + {{ show_hint('May be approximate. Click on the number to get the exact count. See [doc@faq3-11]FAQ 3.11[/doc].'|trans|sanitize) }} + </th> + {% if not (properties_num_columns > 1) %} + <th>{{ sortable_table_header('Type'|trans, 'type') }}</th> + <th>{{ sortable_table_header('Collation'|trans, 'collation') }}</th> + {% endif %} + + {% if is_show_stats %} + {# larger values are more interesting so default sort order is DESC #} + <th>{{ sortable_table_header('Size'|trans, 'size', 'DESC') }}</th> + {# larger values are more interesting so default sort order is DESC #} + <th>{{ sortable_table_header('Overhead'|trans, 'overhead', 'DESC') }}</th> + {% endif %} + + {% if show_charset %} + <th>{{ sortable_table_header('Charset'|trans, 'charset') }}</th> + {% endif %} + + {% if show_comment %} + <th>{{ sortable_table_header('Comment'|trans, 'comment') }}</th> + {% endif %} + + {% if show_creation %} + {# newer values are more interesting so default sort order is DESC #} + <th>{{ sortable_table_header('Creation'|trans, 'creation', 'DESC') }}</th> + {% endif %} + + {% if show_last_update %} + {# newer values are more interesting so default sort order is DESC #} + <th>{{ sortable_table_header('Last update'|trans, 'last_update', 'DESC') }}</th> + {% endif %} + + {% if show_last_check %} + {# newer values are more interesting so default sort order is DESC #} + <th>{{ sortable_table_header('Last check'|trans, 'last_check', 'DESC') }}</th> + {% endif %} + </tr> + </thead> + <tbody> + {% for structure_table_row in structure_table_rows %} + {% include 'database/structure/structure_table_row.twig' with structure_table_row only %} + {% endfor %} + </tbody> + {% if body_for_table_summary %} + {% include 'database/structure/body_for_table_summary.twig' with body_for_table_summary only %} + {% endif %} +</table> +</div> +{% if check_all_tables %} + {% include 'database/structure/check_all_tables.twig' with check_all_tables only %} +{% endif %} +</form> diff --git a/srcs/phpmyadmin/templates/database/structure/tracking_icon.twig b/srcs/phpmyadmin/templates/database/structure/tracking_icon.twig new file mode 100644 index 0000000..b09c9bb --- /dev/null +++ b/srcs/phpmyadmin/templates/database/structure/tracking_icon.twig @@ -0,0 +1,7 @@ +<a href="tbl_tracking.php{{ get_common({'table': table, 'db': db}) }}"> + {% if is_tracked -%} + {{ get_image('eye', 'Tracking is active.'|trans) }} + {%- else -%} + {{ get_image('eye_grey', 'Tracking is not active.'|trans) }} + {%- endif %} +</a> |
