diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-01-09 10:55:03 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-01-09 13:09:38 +0100 |
| commit | 04d6d5ca99ebfd1cebb8ce06618fb3811fc1a8aa (patch) | |
| tree | 5c691241355c943a3c68ddb06b8cf8c60aa11319 /srcs/phpmyadmin/templates/database | |
| parent | 7e0d85db834d6351ed85d01e5126ac31dc510b86 (diff) | |
| download | ft_server-04d6d5ca99ebfd1cebb8ce06618fb3811fc1a8aa.tar.gz ft_server-04d6d5ca99ebfd1cebb8ce06618fb3811fc1a8aa.tar.bz2 ft_server-04d6d5ca99ebfd1cebb8ce06618fb3811fc1a8aa.zip | |
phpmyadmin working
Diffstat (limited to 'srcs/phpmyadmin/templates/database')
27 files changed, 2871 insertions, 0 deletions
diff --git a/srcs/phpmyadmin/templates/database/central_columns/edit_table_header.twig b/srcs/phpmyadmin/templates/database/central_columns/edit_table_header.twig new file mode 100644 index 0000000..947d841 --- /dev/null +++ b/srcs/phpmyadmin/templates/database/central_columns/edit_table_header.twig @@ -0,0 +1,9 @@ +<table id="table_columns" class="noclick"> + <caption class="tblHeaders">{% trans 'Structure' %}</caption> + <thead> + <tr> + {% for header in headers %} + <th>{{ header }}</th> + {% endfor %} + </tr> + </thead> diff --git a/srcs/phpmyadmin/templates/database/central_columns/main.twig b/srcs/phpmyadmin/templates/database/central_columns/main.twig new file mode 100644 index 0000000..30b7276 --- /dev/null +++ b/srcs/phpmyadmin/templates/database/central_columns/main.twig @@ -0,0 +1,418 @@ +{# getHtmlForAddNewColumn #} +<div id="add_col_div" class="topmargin"> + <a href="#"> + <span>{{ (total_rows > 0) ? '+' : '-' }}</span>{% trans 'Add new column' %} + </a> + <form id="add_new" class="new_central_col{{ (total_rows != 0) ? ' hide' : ''}}" + method="post" action="db_central_columns.php"> + {{ get_hidden_inputs(db) }} + <input type="hidden" name="add_new_column" value="add_new_column"> + <div class="responsivetable"> + <table> + <thead> + <tr> + <th class=""></th> + <th class="hide"></th> + <th class="" title="" data-column="name"> + {% trans 'Name' %} + <div class="sorticon"></div> + </th> + <th class="" title="" data-column="type"> + {% trans 'Type' %} + <div class="sorticon"></div> + </th> + <th class="" title="" data-column="length"> + {% trans 'Length/Value' %} + <div class="sorticon"></div> + </th> + <th class="" title="" data-column="default"> + {% trans 'Default' %} + <div class="sorticon"></div> + </th> + <th class="" title="" data-column="collation"> + {% trans 'Collation' %} + <div class="sorticon"></div> + </th> + <th class="" title="" data-column="attribute"> + {% trans 'Attribute' %} + <div class="sorticon"></div> + </th> + <th class="" title="" data-column="isnull"> + {% trans 'Null' %} + <div class="sorticon"></div> + </th> + <th class="" title="" data-column="extra"> + {% trans 'A_I' %} + <div class="sorticon"></div> + </th> + </tr> + </thead> + <tbody> + <tr> + <td></td> + <td name="col_name" class="nowrap"> + {% include 'columns_definitions/column_name.twig' with { + 'column_number': 0, + 'ci': 0, + 'ci_offset': 0, + 'column_meta': {}, + 'cfg_relation': { + 'centralcolumnswork': false + }, + 'max_rows': max_rows, + } only %} + </td> + <td name="col_type" class="nowrap"> + {% include 'columns_definitions/column_type.twig' with { + 'column_number': 0, + 'ci': 1, + 'ci_offset': 0, + 'type_upper': '', + 'column_meta': {} + } only %} + </td> + <td class="nowrap" name="col_length"> + {% include 'columns_definitions/column_length.twig' with { + 'column_number': 0, + 'ci': 2, + 'ci_offset': 0, + 'length_values_input_size': 8, + 'length_to_display': '' + } only %} + </td> + <td class="nowrap" name="col_default"> + {% include 'columns_definitions/column_default.twig' with { + 'column_number': 0, + 'ci': 3, + 'ci_offset': 0, + 'type_upper': '', + 'column_meta': {}, + 'char_editing': char_editing, + } only %} + </td> + <td name="collation" class="nowrap"> + <select lang="en" dir="ltr" name="field_collation[0]" id="field_0_4"> + <option value=""></option> + {% for charset in charsets %} + <optgroup label="{{ charset.name }}" title="{{ charset.description }}"> + {% for collation in charset.collations %} + <option value="{{ collation.name }}" title="{{ collation.description }}"> + {{- collation.name -}} + </option> + {% endfor %} + </optgroup> + {% endfor %} + </select> + </td> + <td class="nowrap" name="col_attribute"> + {% include 'columns_definitions/column_attribute.twig' with { + 'column_number': 0, + 'ci': 5, + 'ci_offset': 0, + 'extracted_columnspec': {}, + 'column_meta': {}, + 'submit_attribute': false, + 'attribute_types': attribute_types, + } only %} + </td> + <td class="nowrap" name="col_isNull"> + {% include 'columns_definitions/column_null.twig' with { + 'column_number': 0, + 'ci': 6, + 'ci_offset': 0, + 'column_meta': {} + } only %} + </td> + <td class="nowrap" name="col_extra"> + {% include 'columns_definitions/column_extra.twig' with { + 'column_number': 0, + 'ci': 7, + 'ci_offset': 0, + 'column_meta': {} + } only %} + </td> + <td> + <input id="add_column_save" class="btn btn-primary" type="submit" value="Save"> + </td> + </tr> + </tbody> + </table> + </div> + </form> +</div> +{% if total_rows <= 0 %} + <fieldset> + {% trans 'The central list of columns for the current database is empty' %} + </fieldset> +{% else %} + <table style="display:inline-block;max-width:49%" class="navigation nospacing nopadding"> + <tr> + <td class="navigation_separator"></td> + {% if pos - max_rows >= 0 %} + <td> + <form action="db_central_columns.php" method="post"> + {{ get_hidden_inputs(db) }} + <input type="hidden" name="pos" value="{{ pos - max_rows }}"> + <input type="hidden" name="total_rows" value="{{ total_rows }}"> + <input class="btn btn-secondary ajax" type="submit" name="navig" value="<"> + </form> + </td> + {% endif %} + {% if tn_nbTotalPage > 1 %} + <td> + <form action="db_central_columns.php" method="post"> + {{ get_hidden_inputs(db) }} + <input type="hidden" name="total_rows" value="{{ total_rows }}"> + {{ tn_page_selector | raw }} + </form> + </td> + {% endif %} + {% if pos + max_rows < total_rows %} + <td> + <form action="db_central_columns.php" method="post"> + {{ get_hidden_inputs(db) }} + <input type="hidden" name="pos" value="{{ pos + max_rows }}"> + <input type="hidden" name="total_rows" value="{{ total_rows }}"> + <input class="btn btn-secondary ajax" type="submit" name="navig" value=">"> + </form> + </td> + {% endif %} + <td class="navigation_separator"></td> + <td> + <span>{% trans 'Filter rows' %}:</span> + <input type="text" class="filter_rows" placeholder="{% trans 'Search this table' %}"> + </td> + <td class="navigation_separator"></td> + </tr> + </table> +{% endif %} +{# getHtmlForAddColumn #} +<table class="central_columns_add_column" class="navigation nospacing nopadding"> + <tr> + <td class="navigation_separator largescreenonly"></td> + <td class="central_columns_navigation"> + {{ get_icon('centralColumns_add', 'Add column' | trans)|raw }} + <form id="add_column" action="db_central_columns.php" method="post"> + {{ get_hidden_inputs(db) | raw }} + <input type="hidden" name="add_column" value="add"> + <input type="hidden" name="pos" value="{{ pos }}"> + <input type="hidden" name="total_rows" value="{{ total_rows }}"> + {# getHtmlForTableDropdown #} + <select name="table-select" id="table-select"> + <option value="" disabled="disabled" selected="selected"> + {% trans 'Select a table' %} + </option> + {% for table in tables %} + <option value="{{ table|e }}">{{ table|e }}</option> + {% endfor %} + </select> + <select name="column-select" id="column-select"> + <option value="" selected="selected">{% trans 'Select a column.' %}</option> + </select> + <input class="btn btn-primary" type="submit" value="{% trans 'Add' %}"> + </form> + </td> + <td class="navigation_separator largescreenonly"></td> + </tr> +</table> +{% if total_rows > 0 %} + <form method="post" id="del_form" action="db_central_columns.php"> + {{ get_hidden_inputs(db) }} + <input id="del_col_name" type="hidden" name="col_name" value=""> + <input type="hidden" name="pos" value="{{ pos }}"> + <input type="hidden" name="delete_save" value="delete"> + </form> + <div id="tableslistcontainer"> + <form name="tableslistcontainer"> + <table id="table_columns" class="tablesorter" class="data"> + {% set class = 'column_heading' %} + {% set title = 'Click to sort.' | trans %} + <thead> + <tr> + <th class="{{ class }}"></th> + <th class="hide"></th> + <th class="column_action" colspan="2">{% trans 'Action' %}</th> + <th class="{{ class }}" title="{{ title }}" data-column="name"> + {% trans 'Name' %} + <div class="sorticon"></div> + </th> + <th class="{{ class }}" title="{{ title }}" data-column="type"> + {% trans 'Type' %} + <div class="sorticon"></div> + </th> + <th class="{{ class }}" title="{{ title }}" data-column="length"> + {% trans 'Length/Value' %} + <div class="sorticon"></div> + </th> + <th class="{{ class }}" title="{{ title }}" data-column="default"> + {% trans 'Default' %} + <div class="sorticon"></div> + </th> + <th class="{{ class }}" title="{{ title }}" data-column="collation"> + {% trans 'Collation' %} + <div class="sorticon"></div> + </th> + <th class="{{ class }}" title="{{ title }}" data-column="attribute"> + {% trans 'Attribute' %} + <div class="sorticon"></div> + </th> + <th class="{{ class }}" title="{{ title }}" data-column="isnull"> + {% trans 'Null' %} + <div class="sorticon"></div> + </th> + <th class="{{ class }}" title="{{ title }}" data-column="extra"> + {% trans 'A_I' %} + <div class="sorticon"></div> + </th> + </tr> + </thead> + <tbody> + {% set row_num = 0 %} + {% for row in rows_list %} + {# getHtmlForTableRow #} + <tr data-rownum="{{ row_num }}" id="{{ 'f_' ~ row_num }}"> + {{ get_hidden_inputs(db) }} + <input type="hidden" name="edit_save" value="save"> + <td class="nowrap"> + <input type="checkbox" class="checkall" name="selected_fld[]" + value="{{ row['col_name'] }}" id="{{ 'checkbox_row_' ~ row_num }}"> + </td> + <td id="{{ 'edit_' ~ row_num }}" class="edit center"> + <a href="#"> {{ get_icon('b_edit', 'Edit' | trans) | raw }}</a> + </td> + <td class="del_row" data-rownum = "{{ row_num }}"> + <a hrf="#">{{ get_icon('b_drop', 'Delete' | trans) }}</a> + <input type="submit" data-rownum = "{{ row_num }}" class="btn btn-secondary edit_cancel_form" value="Cancel"> + </td> + <td id="{{ 'save_' ~ row_num }}" class="hide"> + <input type="submit" data-rownum="{{ row_num }}" class="btn btn-primary edit_save_form" value="Save"> + </td> + <td name="col_name" class="nowrap"> + <span>{{ row['col_name'] }}</span> + <input name="orig_col_name" type="hidden" value="{{ row['col_name'] }}"> + {% include 'columns_definitions/column_name.twig' with { + 'column_number': row_num, + 'ci': 0, + 'ci_offset': 0, + 'column_meta': { + 'Field': row['col_name'] + }, + 'cfg_relation': { + 'centralcolumnswork': false + }, + 'max_rows': max_rows + } only %} + </td> + <td name = "col_type" class="nowrap"> + <span>{{ row['col_type'] }}</span> + {% include 'columns_definitions/column_type.twig' with { + 'column_number': row_num, + 'ci': 1, + 'ci_offset': 0, + 'type_upper': types_upper[row_num], + 'column_meta': {} + } only %} + </td> + <td class="nowrap" name="col_length"> + <span>{{ (row['col_length']?(row['col_length']):'') }}</span> + {% include 'columns_definitions/column_length.twig' with { + 'column_number': row_num, + 'ci': 2, + 'ci_offset': 0, + 'length_values_input_size': 8, + 'length_to_display': row['col_length'] + } only %} + </td> + <td class="nowrap" name="col_default"> + {% if row['col_default'] is defined %} + <span>{{ row['col_default'] }}</span> + {% else %} + <span>None</span> + {% endif %} + {% include 'columns_definitions/column_default.twig' with { + 'column_number': row_num, + 'ci': 3, + 'ci_offset': 0, + 'type_upper': types_upper[row_num], + 'column_meta': rows_meta[row_num], + 'char_editing': char_editing, + } only %} + </td> + <td name="collation" class="nowrap"> + <span>{{ row['col_collation'] }}</span> + <select lang="en" dir="ltr" name="field_collation[{{ row_num }}]" id="field_{{ row_num }}_4"> + <option value=""></option> + {% for charset in charsets %} + <optgroup label="{{ charset.name }}" title="{{ charset.description }}"> + {% for collation in charset.collations %} + <option value="{{ collation.name }}" title="{{ collation.description }}" + {{- collation.name == row['col_collation'] ? ' selected' }}> + {{- collation.name -}} + </option> + {% endfor %} + </optgroup> + {% endfor %} + </select> + </td> + <td class="nowrap" name="col_attribute"> + <span>{{ row['col_attribute']?(row['col_attribute']):"" }}</span> + {% include 'columns_definitions/column_attribute.twig' with { + 'column_number': row_num, + 'ci': 5, + 'ci_offset': 0, + 'extracted_columnspec': {}, + 'column_meta': row['col_attribute'], + 'submit_attribute': false, + 'attribute_types': attribute_types, + } only %} + </td> + <td class="nowrap" name="col_isNull"> + <span>{{ row['col_isNull'] ? 'Yes' | trans : 'No' | trans }}</span> + {% include 'columns_definitions/column_null.twig' with { + 'column_number': row_num, + 'ci': 6, + 'ci_offset': 0, + 'column_meta': { + 'Null': row['col_isNull'] + } + } only %} + </td> + <td class="nowrap" name="col_extra"> + <span>{{ row['col_extra'] }}</span> + {% include 'columns_definitions/column_extra.twig' with { + 'column_number': row_num, + 'ci': 7, + 'ci_offset': 0, + 'column_meta': { + 'Extra': row['col_extra'] + } + } only %} + </td> + </tr> + {% set row_num = row_num + 1 %} + {% endfor %} + </tbody> + </table> + {# getTableFooter #} + {% include 'select_all.twig' with { + 'pma_theme_image': pmaThemeImage, + 'text_dir' : text_dir, + 'form_name' : 'tableslistcontainer', + } only %} + {{ get_button_or_image( + 'edit_central_columns', + 'mult_submit change_central_columns', + 'Edit' | trans, + 'b_edit', + 'edit central columns' + ) | raw }} + {{ get_button_or_image( + 'delete_central_columns', + 'mult_submit', + 'Delete' | trans, + 'b_drop', + 'remove_from_central_columns' + ) | raw }} + </form> + </div> +{% endif %} diff --git a/srcs/phpmyadmin/templates/database/create_table.twig b/srcs/phpmyadmin/templates/database/create_table.twig new file mode 100644 index 0000000..e57d93a --- /dev/null +++ b/srcs/phpmyadmin/templates/database/create_table.twig @@ -0,0 +1,23 @@ +<form id="create_table_form_minimal" method="post" action="tbl_create.php" class="lock-page"> + <fieldset> + <legend> + {% if show_icons('ActionLinksMode') -%} + {{ get_image('b_table_add') }} + {%- endif %} + {% trans "Create table" %} + </legend> + {{ get_hidden_inputs(db) }} + <div class="formelement"> + {% trans "Name" %}: + <input type="text" name="table" maxlength="64" size="30" required="required"> + </div> + <div class="formelement"> + {% trans "Number of columns" %}: + <input type="number" min="1" name="num_fields" value="4" required="required"> + </div> + <div class="clearfloat"></div> + </fieldset> + <fieldset class="tblFooters"> + <input class="btn btn-primary" type="submit" value="{% trans "Go" %}"> + </fieldset> +</form> diff --git a/srcs/phpmyadmin/templates/database/data_dictionary/index.twig b/srcs/phpmyadmin/templates/database/data_dictionary/index.twig new file mode 100644 index 0000000..2f5dc5a --- /dev/null +++ b/srcs/phpmyadmin/templates/database/data_dictionary/index.twig @@ -0,0 +1,65 @@ +<h1>{{ database }}</h1> +{% if comment is not empty %} + <p>{% trans 'Database comment:' %} <em>{{ comment }}</em></p> +{% endif %} + +<div> + {% for table in tables %} + <div> + <h2>{{ table.name }}</h2> + {% if table.comment is not empty %} + <p>{% trans 'Table comments:' %} <em>{{ table.comment }}</em></p> + {% endif %} + + <table class="print"> + <tr> + <th>{% trans 'Column' %}</th> + <th>{% trans 'Type' %}</th> + <th>{% trans 'Null' %}</th> + <th>{% trans 'Default' %}</th> + {% if table.has_relation %} + <th>{% trans 'Links to' %}</th> + {% endif %} + <th>{% trans 'Comments' %}</th> + {% if table.has_mime %} + <th>{% trans 'Media (MIME) type' %}</th> + {% endif %} + </tr> + {% for column in table.columns %} + <tr> + <td class="nowrap"> + {{ column.name }} + {% if column.has_primary_key %} + <em>({% trans 'Primary' %})</em> + {% endif %} + </td> + <td lang="en" dir="ltr"{{ 'set' != column.type and 'enum' != column.type ? ' class="nowrap"' }}> + {{ column.print_type }} + </td> + <td>{{ column.is_nullable ? 'Yes'|trans : 'No'|trans }}</td> + <td class="nowrap"> + {% if column.default is null and column.is_nullable %} + <em>NULL</em> + {% else %} + {{ column.default }} + {% endif %} + </td> + {% if table.has_relation %} + <td>{{ column.relation }}</td> + {% endif %} + <td>{{ column.comment }}</td> + {% if table.has_mime %} + <td>{{ column.mime }}</td> + {% endif %} + </tr> + {% endfor %} + </table> + + {{ table.indexes_table|raw }} + </div> + {% endfor %} +</div> + +<p class="print_ignore"> + <input type="button" class="btn btn-secondary button" id="print" value="{% trans 'Print' %}"> +</p> diff --git a/srcs/phpmyadmin/templates/database/designer/database_tables.twig b/srcs/phpmyadmin/templates/database/designer/database_tables.twig new file mode 100644 index 0000000..5453bb5 --- /dev/null +++ b/srcs/phpmyadmin/templates/database/designer/database_tables.twig @@ -0,0 +1,121 @@ +{% for designerTable in tables %} + {% set i = loop.index0 %} + {% set t_n_url = designerTable.getDbTableString()|escape('url') %} + {% set db = designerTable.getDatabaseName() %} + {% set db_url = db|escape('url') %} + {% set t_n = designerTable.getDbTableString() %} + {% set table_name = designerTable.getTableName()|escape('html') %} + <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 }}" + db_url="{{ designerTable.getDatabaseName()|escape('url') }}" + table_name_url="{{ designerTable.getTableName()|escape('url') }}" + cellpadding="0" + cellspacing="0" + class="designer_tab" + style="position:absolute; left: + {{- tab_pos[t_n] is defined ? tab_pos[t_n]['X'] : random(range(20, 700)) }}px; top: + {{- tab_pos[t_n] is defined ? tab_pos[t_n]['Y'] : random(range(20, 550)) }}px; display: + {{- tab_pos[t_n] is defined or display_page == -1 ? 'block' : 'none' }}; z-index: 1;"> <!--"--> + <thead> + <tr class="header"> + {% if has_query %} + <td class="select_all"> + <input class="select_all_1" + type="checkbox" + style="margin: 0;" + value="select_all_{{ t_n_url }}" + id="select_all_{{ i }}" + title="{% trans 'Select all' %}" + table_name="{{ table_name }}" + db_name="{{ db }}"> + </td> + {% endif %} + <td class="small_tab" + title="{% trans 'Show/hide columns' %}" + id="id_hide_tbody_{{ t_n_url }}" + table_name="{{ t_n_url }}">{{ 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" + db="{{ designerTable.getDatabaseName() }}" + db_url="{{ designerTable.getDatabaseName()|escape('url') }}" + table_name="{{ designerTable.getTableName() }}" + table_name_url="{{ designerTable.getTableName()|escape('url') }}"> + <img src="{{ theme.getImgPath('designer/exec_small.png') }}" + title="{% trans 'See table structure' %}"> + </td> + <td id="id_zag_{{ t_n_url }}" + class="tab_zag nowrap tab_zag_noquery" + table_name="{{ t_n_url }}" + query_set="{{ has_query ? 1 : 0 }}"> + <span class="owner">{{ designerTable.getDatabaseName() }}</span> + {{ designerTable.getTableName() }} + </td> + {% if has_query %} + <td class="tab_zag tab_zag_query" + id="id_zag_{{ t_n_url }}_2" + table_name="{{ t_n_url }}"> + </td> + {% endif %} + </tr> + </thead> + <tbody id="id_tbody_{{ t_n_url }}" + {{- tab_pos[t_n] is defined and tab_pos[t_n]['V'] is empty ? ' style="display: none"' }}> + {% set display_field = designerTable.getDisplayField() %} + {% for j in 0..tab_column[t_n]['COLUMN_ID']|length - 1 %} + {% set col_name = tab_column[t_n]['COLUMN_NAME'][j] %} + {% set tmp_column = t_n ~ '.' ~ tab_column[t_n]['COLUMN_NAME'][j] %} + {% set click_field_param = [ + designerTable.getTableName()|escape('url'), + tab_column[t_n]['COLUMN_NAME'][j]|url_encode + ] %} + {% if not designerTable.supportsForeignkeys() %} + {% set click_field_param = click_field_param|merge([tables_pk_or_unique_keys[tmp_column] is defined ? 1 : 0]) %} + {% else %} + {# if foreign keys are supported, it's not necessary that the + index is a primary key #} + {% set click_field_param = click_field_param|merge([tables_all_keys[tmp_column] is defined ? 1 : 0]) %} + {% endif %} + {% set click_field_param = click_field_param|merge([db]) %} + <tr id="id_tr_{{ designerTable.getTableName()|escape('url') }}.{{ tab_column[t_n]['COLUMN_NAME'][j] }}" class="tab_field + {{- display_field == tab_column[t_n]['COLUMN_NAME'][j] ? '_3' }}" click_field_param=" + {{- click_field_param|join(',') }}"> + {% 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 }}" + type="checkbox" + id="select_{{ t_n_url }}._{{ tab_column[t_n]['COLUMN_NAME'][j]|url_encode }}" + style="margin: 0;" + title="{{ 'Select "%s"'|trans|format(col_name) }}" + id_check_all="select_all_{{ i }}" + db_name="{{ db }}" + table_name="{{ table_name }}" + col_name="{{ col_name }}"> + </td> + {% endif %} + <td width="10px" colspan="3" id="{{ t_n_url }}. + {{- tab_column[t_n]['COLUMN_NAME'][j]|url_encode }}"> + <div class="nowrap"> + {% set type = columns_type[t_n ~ '.' ~ tab_column[t_n]['COLUMN_NAME'][j]] %} + <img src="{{ theme.getImgPath(type) }}.png" alt="*"> + {{ tab_column[t_n]['COLUMN_NAME'][j] }} : {{ tab_column[t_n]['TYPE'][j] }} + </div> + </td> + {% if has_query %} + <td class="small_tab_pref small_tab_pref_click_opt" + {# Escaped 2 times to be able to use it in innerHtml #} + option_col_name_modal="<strong>{{ 'Add an option for column "%s".'|trans|format(col_name)|escape('html')|escape('html') }}</strong>" + db_name="{{ db }}" + table_name="{{ table_name }}" + col_name="{{ col_name }}" + db_table_name_url="{{ t_n_url }}"> + <img src="{{ theme.getImgPath('designer/exec_small.png') }}" title="{% trans 'Options' %}" /> + </td> + {% endif %} + </tr> + {% endfor %} + </tbody> + </table> +{% endfor %} diff --git a/srcs/phpmyadmin/templates/database/designer/edit_delete_pages.twig b/srcs/phpmyadmin/templates/database/designer/edit_delete_pages.twig new file mode 100644 index 0000000..75d1a1a --- /dev/null +++ b/srcs/phpmyadmin/templates/database/designer/edit_delete_pages.twig @@ -0,0 +1,13 @@ +<form action="db_designer.php" method="post" name="edit_delete_pages" id="edit_delete_pages" class="ajax"> + {{ get_hidden_inputs(db) }} + <fieldset id="page_edit_delete_options"> + <input type="hidden" name="operation" value="{{ operation }}"> + <label for="selected_page"> + {{ operation == 'editPage' ? 'Page to open'|trans : 'Page to delete'|trans }}: + </label> + {% include 'database/designer/page_selector.twig' with { + 'pdfwork': pdfwork, + 'pages': pages + } only %} + </fieldset> +</form> diff --git a/srcs/phpmyadmin/templates/database/designer/main.twig b/srcs/phpmyadmin/templates/database/designer/main.twig new file mode 100644 index 0000000..f971dc5 --- /dev/null +++ b/srcs/phpmyadmin/templates/database/designer/main.twig @@ -0,0 +1,1105 @@ +{# Invisible characters will make javascript crash #} +{% apply spaceless %} +<script type="text/javascript"> +var designerConfig = {{ designer_config|raw }}; +</script> +{% endapply %} + +{# side menu #} +{% if not has_query %} + <div id="name-panel"> + <span id="page_name"> + {{ selected_page == null ? 'Untitled'|trans : selected_page }} + </span> + <span id="saved_state"> + {{ selected_page == null ? '*' : '' }} + </span> + </div> +{% endif %} +<div class="designer_header side-menu" id="side_menu"> + <a class="M_butt" id="key_Show_left_menu" href="#"> + <img title="{% trans 'Show/Hide tables list' %}" + alt="v" + src="{{ theme.getImgPath('designer/downarrow2_m.png') }}" + data-down="{{ theme.getImgPath('designer/downarrow2_m.png') }}" + data-up="{{ theme.getImgPath('designer/uparrow2_m.png') }}"> + <span class="hide hidable"> + {% trans 'Show/Hide tables list' %} + </span> + </a> + <a href="#" id="toggleFullscreen" class="M_butt"> + <img title="{% trans 'View in fullscreen' %}" + src="{{ theme.getImgPath('designer/viewInFullscreen.png') }}" + data-enter="{{ theme.getImgPath('designer/viewInFullscreen.png') }}" + data-exit="{{ theme.getImgPath('designer/exitFullscreen.png') }}"> + <span class="hide hidable" + data-exit="{% trans 'Exit fullscreen' %}" + data-enter="{% trans 'View in fullscreen' %}"> + {% trans 'View in fullscreen' %} + </span> + </a> + <a href="#" id="addOtherDbTables" class="M_butt"> + <img title="{% trans 'Add tables from other databases' %}" + src="{{ theme.getImgPath('designer/other_table.png') }}"> + <span class="hide hidable"> + {% trans 'Add tables from other databases' %} + </span> + </a> + {% if not has_query %} + <a id="newPage" href="#" class="M_butt"> + <img title="{% trans 'New page' %}" + alt="" + src="{{ theme.getImgPath('designer/page_add.png') }}"> + <span class="hide hidable"> + {% trans 'New page' %} + </span> + </a> + <a href="#" id="editPage" class="M_butt ajax"> + <img title="{% trans 'Open page' %}" + src="{{ theme.getImgPath('designer/page_edit.png') }}"> + <span class="hide hidable"> + {% trans 'Open page' %} + </span> + </a> + <a href="#" id="savePos" class="M_butt"> + <img title="{% trans 'Save page' %}" + src="{{ theme.getImgPath('designer/save.png') }}"> + <span class="hide hidable"> + {% trans 'Save page' %} + </span> + </a> + <a href="#" id="SaveAs" class="M_butt ajax"> + <img title="{% trans 'Save page as' %}" + src="{{ theme.getImgPath('designer/save_as.png') }}"> + <span class="hide hidable"> + {% trans 'Save page as' %} + </span> + </a> + <a href="#" id="delPages" class="M_butt ajax"> + <img title="{% trans 'Delete pages' %}" + src="{{ theme.getImgPath('designer/page_delete.png') }}"> + <span class="hide hidable"> + {% trans 'Delete pages' %} + </span> + </a> + <a href="#" id="StartTableNew" class="M_butt"> + <img title="{% trans 'Create table' %}" + src="{{ theme.getImgPath('designer/table.png') }}"> + <span class="hide hidable"> + {% trans 'Create table' %} + </span> + </a> + <a href="#" class="M_butt" id="rel_button"> + <img title="{% trans 'Create relationship' %}" + src="{{ theme.getImgPath('designer/relation.png') }}"> + <span class="hide hidable"> + {% trans 'Create relationship' %} + </span> + </a> + <a href="#" class="M_butt" id="display_field_button"> + <img title="{% trans 'Choose column to display' %}" + src="{{ theme.getImgPath('designer/display_field.png') }}"> + <span class="hide hidable"> + {% trans 'Choose column to display' %} + </span> + </a> + <a href="#" id="reloadPage" class="M_butt"> + <img title="{% trans 'Reload' %}" + src="{{ theme.getImgPath('designer/reload.png') }}"> + <span class="hide hidable"> + {% trans 'Reload' %} + </span> + </a> + <a href="{{ get_docu_link('faq', 'faq6-31') }}" + target="documentation" + class="M_butt"> + <img title="{% trans 'Help' %}" + src="{{ theme.getImgPath('designer/help.png') }}"> + <span class="hide hidable"> + {% trans 'Help' %} + </span> + </a> + {% endif %} + <a href="#" class="{{ params_array['angular_direct'] }}" id="angular_direct_button"> + <img title="{% trans 'Angular links' %} / {% trans 'Direct links' %}" + src="{{ theme.getImgPath('designer/ang_direct.png') }}"> + <span class="hide hidable"> + {% trans 'Angular links' %} / {% trans 'Direct links' %} + </span> + </a> + <a href="#" class="{{ params_array['snap_to_grid'] }}" id="grid_button"> + <img title="{% trans 'Snap to grid' %}" src="{{ theme.getImgPath('designer/grid.png') }}"> + <span class="hide hidable"> + {% trans 'Snap to grid' %} + </span> + </a> + <a href="#" class="{{ params_array['small_big_all'] }}" id="key_SB_all"> + <img title="{% trans 'Small/Big All' %}" + alt="v" + src="{{ theme.getImgPath('designer/downarrow1.png') }}" + data-down="{{ theme.getImgPath('designer/downarrow1.png') }}" + data-right="{{ theme.getImgPath('designer/rightarrow1.png') }}"> + <span class="hide hidable"> + {% trans 'Small/Big All' %} + </span> + </a> + <a href="#" id="SmallTabInvert" class="M_butt"> + <img title="{% trans 'Toggle small/big' %}" + src="{{ theme.getImgPath('designer/bottom.png') }}"> + <span class="hide hidable"> + {% trans 'Toggle small/big' %} + </span> + </a> + <a href="#" id="relLineInvert" class="{{ params_array['relation_lines'] }}" > + <img title="{% trans 'Toggle relationship lines' %}" + src="{{ theme.getImgPath('designer/toggle_lines.png') }}"> + <span class="hide hidable"> + {% trans 'Toggle relationship lines' %} + </span> + </a> + {% if not visual_builder %} + <a href="#" id="exportPages" class="M_butt" > + <img title="{% trans 'Export schema' %}" + src="{{ theme.getImgPath('designer/export.png') }}"> + <span class="hide hidable"> + {% trans 'Export schema' %} + </span> + </a> + {% else %} + <a id="build_query_button" + class="M_butt" + href="#" + class="M_butt"> + <img title="{% trans 'Build Query' %}" + src="{{ theme.getImgPath('designer/query_builder.png') }}"> + <span class="hide hidable"> + {% trans 'Build Query' %} + </span> + </a> + {% endif %} + <a href="#" class="{{ params_array['side_menu'] }}" id="key_Left_Right"> + <img title="{% trans 'Move Menu' %}" alt=">" + data-right="{{ theme.getImgPath('designer/2leftarrow_m.png') }}" + src="{{ theme.getImgPath('designer/2rightarrow_m.png') }}"> + <span class="hide hidable"> + {% trans 'Move Menu' %} + </span> + </a> + <a href="#" class="{{ params_array['pin_text'] }}" id="pin_Text"> + <img title="{% trans 'Pin text' %}" + alt=">" + data-right="{{ theme.getImgPath('designer/anchor.png') }}" + src="{{ theme.getImgPath('designer/anchor.png') }}"> + <span class="hide hidable"> + {% trans 'Pin text' %} + </span> + </a> +</div> +<div id="canvas_outer"> + <form action="" id="container-form" method="post" name="form1"> + <div id="osn_tab"> + <canvas class="designer" id="canvas" width="100" height="100"></canvas> + </div> + <div id="layer_menu" class="hide"> + <div class="center"> + <a href="#" class="M_butt" target="_self" > + <img title="{% trans 'Hide/Show all' %}" + alt="v" + id="key_HS_all" + src="{{ theme.getImgPath('designer/downarrow1.png') }}" + data-down="{{ theme.getImgPath('designer/downarrow1.png') }}" + data-right="{{ theme.getImgPath('designer/rightarrow1.png') }}"> + </a> + <a href="#" class="M_butt" target="_self" > + <img alt="v" + id="key_HS" + title="{% trans 'Hide/Show tables with no relationship' %}" + src="{{ theme.getImgPath('designer/downarrow2.png') }}" + data-down="{{ theme.getImgPath('designer/downarrow2.png') }}" + data-right="{{ theme.getImgPath('designer/rightarrow2.png') }}"> + </a> + </div> + <div id="id_scroll_tab" class="scroll_tab"> + <table width="100%" style="padding-left: 3px;"></table> + </div> + {# end id_scroll_tab #} + <div class="center"> + {% trans 'Number of tables:' %} <span id="tables_counter">0</span> + </div> + <div id="layer_menu_sizer"> + <div class="floatleft"> + <img class="icon" + data-right="{{ theme.getImgPath('designer/resizeright.png') }}" + src="{{ theme.getImgPath('designer/resize.png') }}"> + </div> + </div> + </div> + {# end layer_menu #} + {% include 'database/designer/database_tables.twig' with { + 'db': db, + 'get_db': get_db, + 'has_query': has_query, + 'tab_pos': tab_pos, + 'display_page': display_page, + 'tab_column': tab_column, + 'tables_all_keys': tables_all_keys, + 'tables_pk_or_unique_keys': tables_pk_or_unique_keys, + 'columns_type': columns_type, + 'tables': designerTables, + 'theme': theme, + } only %} + </form> +</div> +<div id="designer_hint"></div> +{# create relation pane #} +<table id="layer_new_relation" class="hide" width="5%" cellpadding="0" cellspacing="0"> + <tbody> + <tr> + <td class="frams1" width="10px"> + </td> + <td class="frams5" width="99%" > + </td> + <td class="frams2" width="10px"> + <div class="bor"> + </div> + </td> + </tr> + <tr> + <td class="frams8"> + </td> + <td class="input_tab"> + <table width="168" class="center" cellpadding="2" cellspacing="0"> + <thead> + <tr> + <td colspan="2" class="center nowrap"> + <strong> + {% trans 'Create relationship' %} + </strong> + </td> + </tr> + </thead> + <tbody id="foreign_relation"> + <tr> + <td colspan="2" class="center nowrap"> + <strong> + FOREIGN KEY + </strong> + </td> + </tr> + <tr> + <td width="58" class="nowrap"> + on delete + </td> + <td width="102"> + <select name="on_delete" id="on_delete"> + <option value="nix" selected="selected"> + -- + </option> + <option value="CASCADE"> + CASCADE + </option> + <option value="SET NULL"> + SET NULL + </option> + <option value="NO ACTION"> + NO ACTION + </option> + <option value="RESTRICT"> + RESTRICT + </option> + </select> + </td> + </tr> + <tr> + <td class="nowrap"> + on update + </td> + <td> + <select name="on_update" id="on_update"> + <option value="nix" selected="selected"> + -- + </option> + <option value="CASCADE"> + CASCADE + </option> + <option value="SET NULL"> + SET NULL + </option> + <option value="NO ACTION"> + NO ACTION + </option> + <option value="RESTRICT"> + RESTRICT + </option> + </select> + </td> + </tr> + </tbody> + <tbody> + <tr> + <td colspan="2" class="center nowrap"> + <input type="button" id="ok_new_rel_panel" class="btn btn-secondary butt" + name="Button" value="{% trans 'OK' %}"> + <input type="button" id="cancel_new_rel_panel" + class="btn btn-secondary butt" name="Button" value="{% trans 'Cancel' %}"> + </td> + </tr> + </tbody> + </table> + </td> + <td class="frams6"> + </td> + </tr> + <tr> + <td class="frams4"> + <div class="bor"> + </div> + </td> + <td class="frams7"> + </td> + <td class="frams3"> + </td> + </tr> + </tbody> +</table> +{# delete relation pane #} +<table id="layer_upd_relation" class="hide" width="5%" cellpadding="0" cellspacing="0"> + <tbody> + <tr> + <td class="frams1" width="10px"> + </td> + <td class="frams5" width="99%"> + </td> + <td class="frams2" width="10px"> + <div class="bor"> + </div> + </td> + </tr> + <tr> + <td class="frams8"> + </td> + <td class="input_tab"> + <table width="100%" class="center" cellpadding="2" cellspacing="0"> + <tr> + <td colspan="3" class="center nowrap"> + <strong> + {% trans 'Delete relationship' %} + </strong> + </td> + </tr> + <tr> + <td colspan="3" class="center nowrap"> + <input id="del_button" name="Button" type="button" + class="btn btn-secondary butt" value="{% trans 'Delete' %}"> + <input id="cancel_button" type="button" class="btn btn-secondary butt" + name="Button" value="{% trans 'Cancel' %}"> + </td> + </tr> + </table> + </td> + <td class="frams6"> + </td> + </tr> + <tr> + <td class="frams4"> + <div class="bor"> + </div> + </td> + <td class="frams7"> + </td> + <td class="frams3"> + </td> + </tr> + </tbody> +</table> +{% if has_query %} + {# options pane #} + <table id="designer_optionse" class="hide" width="5%" cellpadding="0" cellspacing="0"> + <tbody> + <tr> + <td class="frams1" width="10px"> + </td> + <td class="frams5" width="99%" > + </td> + <td class="frams2" width="10px"> + <div class="bor"> + </div> + </td> + </tr> + <tr> + <td class="frams8"> + </td> + <td class="input_tab"> + <table width="168" class="center" cellpadding="2" cellspacing="0"> + <thead> + <tr> + <td colspan="2" rowspan="2" id="option_col_name" class="center nowrap"> + </td> + </tr> + </thead> + <tbody id="where"> + <tr> + <td class="center nowrap"> + <b> + WHERE + </b> + </td> + </tr> + <tr> + <td width="58" class="nowrap"> + {% trans 'Relationship operator' %} + </td> + <td width="102"> + <select name="rel_opt" id="rel_opt"> + <option value="--" selected="selected"> + -- + </option> + <option value="="> + = + </option> + <option value=">"> + > + </option> + <option value="<"> + < + </option> + <option value=">="> + >= + </option> + <option value="<="> + <= + </option> + <option value="NOT"> + NOT + </option> + <option value="IN"> + IN + </option> + <option value="EXCEPT"> + {% trans 'Except' %} + </option> + <option value="NOT IN"> + NOT IN + </option> + </select> + </td> + </tr> + <tr> + <td class="nowrap"> + {% trans 'Value' %} + <br> + {% trans 'subquery' %} + </td> + <td> + <textarea id="Query" cols="18"></textarea> + </td> + </tr> + <tr> + <td class="center nowrap"> + <b> + {% trans 'Rename to' %} + </b> + </td> + </tr> + <tr> + <td width="58" class="nowrap"> + {% trans 'New name' %} + </td> + <td width="102"> + <input type="text" id="new_name"> + </td> + </tr> + <tr> + <td class="center nowrap"> + <b> + {% trans 'Aggregate' %} + </b> + </td> + </tr> + <tr> + <td width="58" class="nowrap"> + {% trans 'Operator' %} + </td> + <td width="102"> + <select name="operator" id="operator"> + <option value="---" selected="selected"> + --- + </option> + <option value="sum" > + SUM + </option> + <option value="min"> + MIN + </option> + <option value="max"> + MAX + </option> + <option value="avg"> + AVG + </option> + <option value="count"> + COUNT + </option> + </select> + </td> + </tr> + <tr> + <td width="58" class="center nowrap"> + <b> + GROUP BY + </b> + </td> + <td> + <input type="checkbox" value="groupby" id="groupby"> + </td> + </tr> + <tr> + <td width="58" class="center nowrap"> + <b> + ORDER BY + </b> + </td> + <td> + <select name="orderby" id="orderby"> + <option value="---" selected="selected"> + --- + </option> + <option value="ASC" > + ASC + </option> + <option value="DESC"> + DESC + </option> + </select> + </td> + </tr> + <tr> + <td class="center nowrap"> + <b> + HAVING + </b> + </td> + </tr> + <tr> + <td width="58" class="nowrap"> + {% trans 'Operator' %} + </td> + <td width="102"> + <select name="h_operator" id="h_operator"> + <option value="---" selected="selected"> + --- + </option> + <option value="None" > + {% trans 'None' %} + </option> + <option value="sum" > + SUM + </option> + <option value="min"> + MIN + </option> + <option value="max"> + MAX + </option> + <option value="avg"> + AVG + </option> + <option value="count"> + COUNT + </option> + </select> + </td> + </tr> + <tr> + <td width="58" class="nowrap"> + {% trans 'Relationship operator' %} + </td> + <td width="102"> + <select name="h_rel_opt" id="h_rel_opt"> + <option value="--" selected="selected"> + -- + </option> + <option value="="> + = + </option> + <option value=">"> + > + </option> + <option value="<"> + < + </option> + <option value=">="> + >= + </option> + <option value="<="> + <= + </option> + <option value="NOT"> + NOT + </option> + <option value="IN"> + IN + </option> + <option value="EXCEPT"> + {% trans 'Except' %} + </option> + <option value="NOT IN"> + NOT IN + </option> + </select> + </td> + </tr> + <tr> + <td width="58" class="nowrap"> + {% trans 'Value' %} + <br> + {% trans 'subquery' %} + </td> + <td width="102"> + <textarea id="having" cols="18"></textarea> + </td> + </tr> + </tbody> + <tbody> + <tr> + <td colspan="2" class="center nowrap"> + <input type="hidden" id="ok_add_object_db_and_table_name_url" /> + <input type="hidden" id="ok_add_object_db_name" /> + <input type="hidden" id="ok_add_object_table_name" /> + <input type="hidden" id="ok_add_object_col_name" /> + <input type="button" id="ok_add_object" class="btn btn-secondary butt" + name="Button" value="{% trans 'OK' %}"> + <input type="button" id="cancel_close_option" class="btn btn-secondary butt" + name="Button" value="{% trans 'Cancel' %}"> + </td> + </tr> + </tbody> + </table> + </td> + <td class="frams6"> + </td> + </tr> + <tr> + <td class="frams4"> + <div class="bor"> + </div> + </td> + <td class="frams7"> + </td> + <td class="frams3"> + </td> + </tr> + </tbody> + </table> + {# rename to pane #} + <table id="query_rename_to" class="hide" width="5%" cellpadding="0" cellspacing="0"> + <tbody> + <tr> + <td class="frams1" width="10px"> + </td> + <td class="frams5" width="99%" > + </td> + <td class="frams2" width="10px"> + <div class="bor"> + </div> + </td> + </tr> + <tr> + <td class="frams8"> + </td> + <td class="input_tab"> + <table width="168" class="center" cellpadding="2" cellspacing="0"> + <thead> + <tr> + <td colspan="2" class="center nowrap"> + <strong> + {% trans 'Rename to' %} + </strong> + </td> + </tr> + </thead> + <tbody id="rename_to"> + <tr> + <td width="58" class="nowrap"> + {% trans 'New name' %} + </td> + <td width="102"> + <input type="text" id="e_rename"> + </td> + </tr> + </tbody> + <tbody> + <tr> + <td colspan="2" class="center nowrap"> + <input type="button" id="ok_edit_rename" class="btn btn-secondary butt" + name="Button" value="{% trans 'OK' %}"> + <input id="query_rename_to_button" type="button" + class="btn btn-secondary butt" + name="Button" + value="{% trans 'Cancel' %}"> + </td> + </tr> + </tbody> + </table> + </td> + <td class="frams6"> + </td> + </tr> + <tr> + <td class="frams4"> + <div class="bor"> + </div> + </td> + <td class="frams7"> + </td> + <td class="frams3"> + </td> + </tr> + </tbody> + </table> + {# having query panel #} + <table id="query_having" class="hide" width="5%" cellpadding="0" cellspacing="0"> + <tbody> + <tr> + <td class="frams1" width="10px"> + </td> + <td class="frams5" width="99%" > + </td> + <td class="frams2" width="10px"> + <div class="bor"> + </div> + </td> + </tr> + <tr> + <td class="frams8"> + </td> + <td class="input_tab"> + <table width="168" class="center" cellpadding="2" cellspacing="0"> + <thead> + <tr> + <td colspan="2" class="center nowrap"> + <strong> + HAVING + </strong> + </td> + </tr> + </thead> + <tbody id="rename_to"> + <tr> + <td width="58" class="nowrap"> + {% trans 'Operator' %} + </td> + <td width="102"> + <select name="hoperator" id="hoperator"> + <option value="---" selected="selected"> + --- + </option> + <option value="None" > + None + </option> + <option value="sum" > + SUM + </option> + <option value="min"> + MIN + </option> + <option value="max"> + MAX + </option> + <option value="avg"> + AVG + </option> + <option value="count"> + COUNT + </option> + </select> + </td> + </tr> + <tr> + <tr> + <td width="58" class="nowrap"> + {% trans 'Operator' %} + </td> + <td width="102"> + <select name="hrel_opt" id="hrel_opt"> + <option value="--" selected="selected"> + -- + </option> + <option value="="> + = + </option> + <option value=">"> + > + </option> + <option value="<"> + < + </option> + <option value=">="> + >= + </option> + <option value="<="> + <= + </option> + <option value="NOT"> + NOT + </option> + <option value="IN"> + IN + </option> + <option value="EXCEPT"> + {% trans 'Except' %} + </option> + <option value="NOT IN"> + NOT IN + </option> + </select> + </td> + </tr> + <tr> + <td class="nowrap"> + {% trans 'Value' %} + <br> + {% trans 'subquery' %} + </td> + <td> + <textarea id="hQuery" cols="18"> + </textarea> + </td> + </tr> + </tbody> + <tbody> + <tr> + <td colspan="2" class="center nowrap"> + <input type="button" id="ok_edit_having" class="btn btn-secondary butt" + name="Button" value="{% trans 'OK' %}"> + <input id="query_having_button" type="button" + class="btn btn-secondary butt" + name="Button" + value="{% trans 'Cancel' %}"> + </td> + </tr> + </tbody> + </table> + </td> + <td class="frams6"> + </td> + </tr> + <tr> + <td class="frams4"> + <div class="bor"> + </div> + </td> + <td class="frams7"> + </td> + <td class="frams3"> + </td> + </tr> + </tbody> + </table> + {# aggregate query pane #} + <table id="query_Aggregate" class="hide" width="5%" cellpadding="0" cellspacing="0"> + <tbody> + <tr> + <td class="frams1" width="10px"> + </td> + <td class="frams5" width="99%" > + </td> + <td class="frams2" width="10px"> + <div class="bor"> + </div> + </td> + </tr> + <tr> + <td class="frams8"> + </td> + <td class="input_tab"> + <table width="168" class="center" cellpadding="2" cellspacing="0"> + <thead> + <tr> + <td colspan="2" class="center nowrap"> + <strong> + {% trans 'Aggregate' %} + </strong> + </td> + </tr> + </thead> + <tbody> + <tr> + <td width="58" class="nowrap"> + {% trans 'Operator' %} + </td> + <td width="102"> + <select name="operator" id="e_operator"> + <option value="---" selected="selected"> + --- + </option> + <option value="sum" > + SUM + </option> + <option value="min"> + MIN + </option> + <option value="max"> + MAX + </option> + <option value="avg"> + AVG + </option> + <option value="count"> + COUNT + </option> + </select> + </td> + </tr> + </tbody> + <tbody> + <tr> + <td colspan="2" class="center nowrap"> + <input type="button" id="ok_edit_Aggr" class="btn btn-secondary butt" + name="Button" value="{% trans 'OK' %}"> + <input id="query_Aggregate_Button" type="button" + class="btn btn-secondary butt" + name="Button" + value="{% trans 'Cancel' %}"> + </td> + </tr> + </tbody> + </table> + </td> + <td class="frams6"> + </td> + </tr> + <tr> + <td class="frams4"> + <div class="bor"> + </div> + </td> + <td class="frams7"> + </td> + <td class="frams3"> + </td> + </tr> + </tbody> + </table> + {# where query pane #} + <table id="query_where" class="hide" width="5%" cellpadding="0" cellspacing="0"> + <tbody> + <tr> + <td class="frams1" width="10px"> + </td> + <td class="frams5" width="99%" > + </td> + <td class="frams2" width="10px"> + <div class="bor"> + </div> + </td> + </tr> + <tr> + <td class="frams8"> + </td> + <td class="input_tab"> + <table width="168" class="center" cellpadding="2" cellspacing="0"> + <thead> + <tr> + <td colspan="2" class="center nowrap"> + <strong> + WHERE + </strong> + </td> + </tr> + </thead> + <tbody id="rename_to"> + <tr> + <td width="58" class="nowrap"> + {% trans 'Operator' %} + </td> + <td width="102"> + <select name="erel_opt" id="erel_opt"> + <option value="--" selected="selected"> + -- + </option> + <option value="=" > + = + </option> + <option value=">"> + > + </option> + <option value="<"> + < + </option> + <option value=">="> + >= + </option> + <option value="<="> + <= + </option> + <option value="NOT"> + NOT + </option> + <option value="IN"> + IN + </option> + <option value="EXCEPT"> + {% trans 'Except' %} + </option> + <option value="NOT IN"> + NOT IN + </option> + </select> + </td> + </tr> + <tr> + <td class="nowrap"> + {% trans 'Value' %} + <br> + {% trans 'subquery' %} + </td> + <td> + <textarea id="eQuery" cols="18"> + </textarea> + </td> + </tr> + </tbody> + <tbody> + <tr> + <td colspan="2" class="center nowrap"> + <input type="button" id="ok_edit_where" class="btn btn-secondary butt" + name="Button" value="{% trans 'OK' %}"> + <input id="query_where_button" type="button" class="btn btn-secondary butt" name="Button" + value="{% trans 'Cancel' %}"> + </td> + </tr> + </tbody> + </table> + </td> + <td class="frams6"> + </td> + </tr> + <tr> + <td class="frams4"> + <div class="bor"> + </div> + </td> + <td class="frams7"> + </td> + <td class="frams3"> + </td> + </tr> + </tbody> + </table> + {# query details #} + <div class="panel"> + <div class="clearfloat"></div> + <div id="ab"></div> + <div class="clearfloat"></div> + </div> + <a class="trigger" href="#">{% trans 'Active options' %}</a> + <div id="box"> + <form method="post" action="db_qbe.php" id="vqb_form"> + <textarea cols="80" name="sql_query" id="textSqlquery" rows="15"></textarea> + <input type="hidden" name="submit_sql" value="true"> + {{ get_hidden_inputs(get_db) }} + </form> + </div> +{% endif %} +<div id="PMA_disable_floating_menubar"></div> diff --git a/srcs/phpmyadmin/templates/database/designer/page_save_as.twig b/srcs/phpmyadmin/templates/database/designer/page_save_as.twig new file mode 100644 index 0000000..bbcf34b --- /dev/null +++ b/srcs/phpmyadmin/templates/database/designer/page_save_as.twig @@ -0,0 +1,37 @@ +<form action="db_designer.php" method="post" name="save_as_pages" id="save_as_pages" class="ajax"> + {{ get_hidden_inputs(db) }} + <fieldset id="page_save_as_options"> + <table> + <tbody> + <tr> + <td> + <input type="hidden" name="operation" value="savePage"> + {% include 'database/designer/page_selector.twig' with { + 'pdfwork': pdfwork, + 'pages': pages + } only %} + </td> + </tr> + <tr> + <td> + {{ get_radio_fields( + 'save_page', + { + 'same': 'Save to selected page'|trans, + 'new': 'Create a page and save to it'|trans + }, + 'same', + true + ) }} + </td> + </tr> + <tr> + <td> + <label for="selected_value">{% trans 'New page name' %}</label> + <input type="text" name="selected_value" id="selected_value"> + </td> + </tr> + </tbody> + </table> + </fieldset> +</form> diff --git a/srcs/phpmyadmin/templates/database/designer/page_selector.twig b/srcs/phpmyadmin/templates/database/designer/page_selector.twig new file mode 100644 index 0000000..01c0650 --- /dev/null +++ b/srcs/phpmyadmin/templates/database/designer/page_selector.twig @@ -0,0 +1,10 @@ +<select name="selected_page" id="selected_page"> + <option value="0">-- {% trans 'Select page' %} --</option> + {% if pdfwork %} + {% for nr, desc in pages %} + <option value="{{ nr }}"> + {{ desc }} + </option> + {% endfor %} + {% endif %} +</select> diff --git a/srcs/phpmyadmin/templates/database/designer/schema_export.twig b/srcs/phpmyadmin/templates/database/designer/schema_export.twig new file mode 100644 index 0000000..71f15f2 --- /dev/null +++ b/srcs/phpmyadmin/templates/database/designer/schema_export.twig @@ -0,0 +1,9 @@ +<form method="post" action="schema_export.php" class="disableAjax" id="id_export_pages"> + <fieldset> + {{ get_hidden_inputs(db) }} + <label>{% trans 'Select Export Relational Type' %}</label> + {{ get_choice('Schema', 'export_type', export_list, 'format') }} + <input type="hidden" name="page_number" value="{{ page }}"> + {{ get_options('Schema', export_list) }} + </fieldset> +</form> diff --git a/srcs/phpmyadmin/templates/database/multi_table_query/form.twig b/srcs/phpmyadmin/templates/database/multi_table_query/form.twig new file mode 100644 index 0000000..068ceda --- /dev/null +++ b/srcs/phpmyadmin/templates/database/multi_table_query/form.twig @@ -0,0 +1,184 @@ +{% include 'secondary_tabs.twig' with { + 'url_params': { + 'db': db + }, + 'sub_tabs': [ + { + 'link': 'db_multi_table_query.php', + 'text': 'Multi-table query'|trans + }, + { + 'link': 'db_qbe.php', + 'text': 'Query by example'|trans + } + ] +} only %} +{% include 'div_for_slider_effect.twig' with { + 'id': 'query_div', + 'message': 'Query window'|trans, + 'initial_sliders_state': 'open', +} only %} +<form action="" id="query_form"> + <input type="hidden" id="db_name" value="{{ db }}"> + <fieldset> + {% for table in tables %} + <div style="display:none" id="{{ table.hash }}"> + <option value="*">*</option> + {% for column in table.columns %} + <option value="{{ column }}">{{ column }}</option> + {% endfor %} + </div> + {% endfor %} + + {% for id in 0..default_no_of_columns %} + {% if id == 0 %}<div style="display:none" id="new_column_layout">{% endif %} + <fieldset style="display:inline" class="column_details"> + <select style="display:inline" class="tableNameSelect"> + <option value="">{% trans 'select table' %}</option> + {% for table in tables|keys %} + <option value="{{ table }}">{{ table }}</option> + {% endfor %} + </select> + <span>.</span> + <select style="display:inline" class="columnNameSelect"> + <option value="">{% trans 'select column' %}</option> + </select> + <br> + <input type="checkbox" checked="checked" class="show_col"> + <span>{% trans 'Show' %}</span> + <br> + <input type="text" placeholder="{% trans 'Table alias' %}" class="table_alias"> + <input type="text" placeholder="{% trans 'Column alias' %}" class="col_alias"> + <br> + <input type="checkbox" + title="{% trans 'Use this column in criteria' %}" + class="criteria_col"> + {% include 'div_for_slider_effect.twig' with { + 'id': 'criteria_div' ~ id, + 'initial_sliders_state': 'closed', + 'message': 'criteria'|trans + } %} + <div> + <table> + + <tr class="sort_order" style="background:none"> + <td>{% trans 'Sort' %}</td> + <td><input type="radio" name="sort[{{ id }}]">{% trans 'Ascending' %}</td> + <td><input type="radio" name="sort[{{ id }}]">{% trans 'Descending' %}</td> + </tr> + + <tr class="logical_operator" style="background:none;display:none"> + <td>{% trans 'Add as' %}</td> + <td> + <input type="radio" + name="logical_op[{{ id }}]" + value="AND" + class="logical_op" + checked="checked"> + AND + </td> + <td> + <input type="radio" + name="logical_op[{{ id }}]" + value="OR" + class="logical_op"> + OR + </td> + </tr> + + <tr style="background:none"> + <td>Op </td> + <td> + <select class="criteria_op"> + <option value="=">=</option> + <option value=">">></option> + <option value=">=">>=</option> + <option value="<"><</option> + <option value="<="><=</option> + <option value="!=">!=</option> + <option value="LIKE">LIKE</option> + <option value="LIKE %...%">LIKE %...%</option> + <option value="NOT LIKE">NOT LIKE</option> + <option value="IN (...)">IN (...)</option> + <option value="NOT IN (...)">NOT IN (...)</option> + <option value="BETWEEN">BETWEEN</option> + <option value="NOT BETWEEN">NOT BETWEEN</option> + <option value="IS NULL">IS NULL</option> + <option value="IS NOT NULL">IS NOT NULL</option> + <option value="REGEXP">REGEXP</option> + <option value="REGEXP ^...$">REGEXP ^...$</option> + <option value="NOT REGEXP">NOT REGEXP</option> + </select> + </td> + <td> + <select class="criteria_rhs"> + <option value="text">{% trans 'Text' %}</option> + <option value="anotherColumn">{% trans 'Another column' %}</option> + </select> + </td> + </tr> + + <tr class="rhs_table" style="display:none;background:none"> + <td></td> + <td> + <select class="tableNameSelect"> + <option value="">{% trans 'select table' %}</option> + {% for table in tables|keys %} + <option value="{{ table }}">{{ table }}</option> + {% endfor %} + </select><span>.</span> + </td> + <td> + <select style="display:inline" class="columnNameSelect"> + <option value="">{% trans 'select column' %}</option> + </select> + </td> + </tr> + + <tr style="background:none" class="rhs_text"> + <td></td> + <td colspan="2"> + <input type="text" + style="width:91%" + class="rhs_text_val" + placeholder="{% trans 'Enter criteria as free text' %}"> + </td> + </tr> + + </table> + </div> + </div> + <a href="#" + title="{% trans 'Remove this column' %}" + style="float:right;color:red" + class="removeColumn"> + X + </a> + </fieldset> + {% if id == 0 %}</div>{% endif %} + {% endfor %} + + <fieldset style="display:inline"> + <input class="btn btn-secondary" type="button" value="{% trans '+ Add column' %}" id="add_column_button"> + </fieldset> + + <fieldset> + {% apply spaceless %} + <textarea id="MultiSqlquery" + cols="80" + rows="4" + style="float:left" + name="sql_query" + dir="ltr"> + </textarea> + {% endapply %} + </fieldset> + </fieldset> + + <fieldset class="tblFooters"> + <input class="btn btn-secondary" type="button" id="update_query_button" value="{% trans 'Update query' %}"> + <input class="btn btn-primary" type="button" id="submit_query" value="{% trans 'Submit query' %}"> + </fieldset> +</form> +</div>{# Slider div #} +<div id="sql_results"></div> diff --git a/srcs/phpmyadmin/templates/database/qbe/column_select_cell.twig b/srcs/phpmyadmin/templates/database/qbe/column_select_cell.twig new file mode 100644 index 0000000..071249f --- /dev/null +++ b/srcs/phpmyadmin/templates/database/qbe/column_select_cell.twig @@ -0,0 +1,11 @@ +<td class="center"> + <select name="criteriaColumn[{{ column_number }}]" size="1"> + <option value=""> </option> + {% for column in column_names %} + <option value="{{ column }}" + {%- if column is same as(selected) %} selected="selected"{% endif %}> + {{ column|e|replace({' ': ' '}) }} + </option> + {% endfor %} + </select> +</td> diff --git a/srcs/phpmyadmin/templates/database/qbe/footer_options.twig b/srcs/phpmyadmin/templates/database/qbe/footer_options.twig new file mode 100644 index 0000000..7f43f8d --- /dev/null +++ b/srcs/phpmyadmin/templates/database/qbe/footer_options.twig @@ -0,0 +1,16 @@ +<div class="floatleft"> + {% if type == 'row' %} + {% trans 'Add/Delete criteria rows' %}: + {% else %} + {% trans 'Add/Delete columns' %}: + {% endif %} + <select size="1" name="{{ type == 'row' ? 'criteriaRowAdd' : 'criteriaColumnAdd' }}"> + <option value="-3">-3</option> + <option value="-2">-2</option> + <option value="-1">-1</option> + <option value="0" selected="selected">0</option> + <option value="1">1</option> + <option value="2">2</option> + <option value="3">3</option> + </select> +</div> diff --git a/srcs/phpmyadmin/templates/database/qbe/sort_order_select_cell.twig b/srcs/phpmyadmin/templates/database/qbe/sort_order_select_cell.twig new file mode 100644 index 0000000..7a63d77 --- /dev/null +++ b/srcs/phpmyadmin/templates/database/qbe/sort_order_select_cell.twig @@ -0,0 +1,10 @@ +<td class="center"> + <select name="criteriaSortOrder[{{ column_number }}]"> + <option value="1000"> </option> + {% for i in 1..total_column_count %} + <option value="{{ i }}"{{ i == sort_order ? ' selected="selected"' }}> + {{ i }} + </option> + {% endfor %} + </select> +</td> diff --git a/srcs/phpmyadmin/templates/database/qbe/sort_select_cell.twig b/srcs/phpmyadmin/templates/database/qbe/sort_select_cell.twig new file mode 100644 index 0000000..4f0989e --- /dev/null +++ b/srcs/phpmyadmin/templates/database/qbe/sort_select_cell.twig @@ -0,0 +1,9 @@ +<td class="center"> + <select style="width:{{ real_width }}" name="criteriaSort[{{ column_number }}]" size="1"> + <option value=""> </option> + <option value="ASC" + {{- selected == 'ASC' ? ' selected="selected"' }}>{% trans 'Ascending' %}</option> + <option value="DESC" + {{- selected == 'DESC' ? ' selected="selected"' }}>{% trans 'Descending' %}</option> + </select> +</td> diff --git a/srcs/phpmyadmin/templates/database/search/main.twig b/srcs/phpmyadmin/templates/database/search/main.twig new file mode 100644 index 0000000..45e5e71 --- /dev/null +++ b/srcs/phpmyadmin/templates/database/search/main.twig @@ -0,0 +1,84 @@ +<a id="db_search"></a> +<form id="db_search_form" method="post" action="db_search.php" name="db_search" class="ajax lock-page"> + {{ get_hidden_inputs(db) }} + <fieldset> + <legend>{% trans 'Search in database' %}</legend> + <p> + <label for="criteriaSearchString" class="displayblock"> + {% trans 'Words or values to search for (wildcard: "%"):' %} + </label> + <input id="criteriaSearchString" name="criteriaSearchString" class="all85" type="text" value=" + {{- criteria_search_string }}"> + </p> + + <fieldset> + <legend>{% trans 'Find:' %}</legend> + {# 4th parameter set to true to add line breaks #} + {# 5th parameter set to false to avoid htmlspecialchars() escaping + in the label since we have some HTML in some labels #} + {{ get_radio_fields( + 'criteriaSearchType', + choices, + criteria_search_type, + true, + false + ) }} + </fieldset> + + <fieldset> + <legend>{% trans 'Inside tables:' %}</legend> + <p> + <a href="#" onclick="Functions.setSelectOptions('db_search', 'criteriaTables[]', true); return false;"> + {% trans 'Select all' %} + </a> / + <a href="#" onclick="Functions.setSelectOptions('db_search', 'criteriaTables[]', false); return false;"> + {% trans 'Unselect all' %} + </a> + </p> + <select name="criteriaTables[]" multiple> + {% for each_table in tables_names_only %} + <option value="{{ each_table }}" + {% if criteria_tables|length > 0 %} + {{- each_table in criteria_tables ? ' selected' }} + {% else %} + {{- ' selected' }} + {% endif %} + > + {{ each_table }} + </option> + {% endfor %} + </select> + </fieldset> + + <p> + {# Inputbox for column name entry #} + <label for="criteriaColumnName" class="displayblock"> + {% trans 'Inside column:' %} + </label> + <input id="criteriaColumnName" type="text" name="criteriaColumnName" class="all85" value=" + {{- criteria_column_name is not empty ? criteria_column_name }}"> + </p> + </fieldset> + <fieldset class="tblFooters"> + <input id="buttonGo" class="btn btn-primary" type="submit" name="submit_search" value="{% trans 'Go' %}"> + </fieldset> +</form> +<div id="togglesearchformdiv"> + <a id="togglesearchformlink"></a> +</div> +<div id="searchresults"></div> +<div id="togglesearchresultsdiv"><a id="togglesearchresultlink"></a></div> +<br class="clearfloat"> +{# These two table-image and table-link elements display the table name in browse search results #} +<div id="table-info"> + <a id="table-link" class="item"></a> +</div> +{# Div for browsing results #} +<div id="browse-results"> + {# This browse-results div is used to load the browse and delete results in the db search #} +</div> +<div id="sqlqueryform" class="clearfloat"> + {# This sqlqueryform div is used to load the delete form in the db search #} +</div> +{# Toggle query box link #} +<a id="togglequerybox"></a> diff --git a/srcs/phpmyadmin/templates/database/search/results.twig b/srcs/phpmyadmin/templates/database/search/results.twig new file mode 100644 index 0000000..3d7a780 --- /dev/null +++ b/srcs/phpmyadmin/templates/database/search/results.twig @@ -0,0 +1,62 @@ +<table class="data"> + <caption class="tblHeaders"> + {{ 'Search results for "<em>%s</em>" %s:'|format( + criteria_search_string, + search_type_description + )|raw }} + </caption> + {% for row in rows %} + <tr class="noclick"> + <td> + {% set result_message %} + {% trans %} + %1$s match in <strong>%2$s</strong> + {% plural row.result_count %} + %1$s matches in <strong>%2$s</strong> + {% endtrans %} + {% endset %} + {{ result_message|format(row.result_count, row.table)|raw }} + </td> + {% if row.result_count > 0 %} + {% set url_params = { + 'db': db, + 'table': row.table, + 'goto': 'db_sql.php', + 'pos': 0, + 'is_js_confirmed': 0 + } %} + <td> + <a name="browse_search" + class="ajax browse_results" + href="sql.php{{ get_common(url_params) }}" + data-browse-sql="{{ row.new_search_sqls.select_columns }}" + data-table-name="{{ row.table }}"> + {% trans 'Browse' %} + </a> + </td> + <td> + <a name="delete_search" + class="ajax delete_results" + href="sql.php{{ get_common(url_params) }}" + data-delete-sql="{{ row.new_search_sqls.delete }}" + data-table-name="{{ row.table }}"> + {% trans 'Delete' %} + </a> + </td> + {% else %} + <td></td> + <td></td> + {% endif %} + </tr> + {% endfor %} +</table> + +{% if criteria_tables|length > 1 %} + <p> + {% trans %} + <strong>Total:</strong> <em>{{ count }}</em> match + {% plural result_total %} + <strong>Total:</strong> <em>{{ count }}</em> matches + {% endtrans %} + </p> +{% endif %} 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> diff --git a/srcs/phpmyadmin/templates/database/tracking/tables.twig b/srcs/phpmyadmin/templates/database/tracking/tables.twig new file mode 100644 index 0000000..7f95947 --- /dev/null +++ b/srcs/phpmyadmin/templates/database/tracking/tables.twig @@ -0,0 +1,161 @@ +{# Tracked tables exists#} +{% if head_version_exists %} + <div id="tracked_tables"> + <h3>{% trans 'Tracked tables' %}</h3> + + <form method="post" action="db_tracking.php" name="trackedForm" + id="trackedForm" class="ajax"> + {{ get_hidden_inputs(db) }} + <table id="versions" class="data"> + <thead> + <tr> + <th></th> + <th>{% trans 'Table' %}</th> + <th>{% trans 'Last version' %}</th> + <th>{% trans 'Created' %}</th> + <th>{% trans 'Updated' %}</th> + <th>{% trans 'Status' %}</th> + <th>{% trans 'Action' %}</th> + <th>{% trans 'Show' %}</th> + </tr> + </thead> + <tbody> + {% for version in versions %} + <tr> + <td class="center"> + <input type="checkbox" name="selected_tbl[]" + class="checkall" id="selected_tbl_{{ version.table_name }}" + value="{{ version.table_name }}"> + </td> + <th> + <label for="selected_tbl_{{ version.table_name }}"> + {{ version.table_name }} + </label> + </th> + <td class="right"> + {{ version.version }} + </td> + <td> + {{ version.date_created }} + </td> + <td> + {{ version.date_updated }} + </td> + <td> + {{ version.status_button|raw }} + </td> + <td> + <a class="delete_tracking_anchor ajax" href="db_tracking.php" data-post=" + {{- get_common({ + 'db': db, + 'goto': 'tbl_tracking.php', + 'back': 'db_tracking.php', + 'table': version.table_name, + 'delete_tracking': true + }, '') }}"> + {{ get_icon('b_drop', 'Delete tracking'|trans) }} + </a> + </td> + <td> + <a href="tbl_tracking.php" data-post=" + {{- get_common({ + 'db': db, + 'goto': 'tbl_tracking.php', + 'back': 'db_tracking.php', + 'table': version.table_name + }, '') }}"> + {{ get_icon('b_versions', 'Versions'|trans) }} + </a> + <a href="tbl_tracking.php" data-post=" + {{- get_common({ + 'db': db, + 'goto': 'tbl_tracking.php', + 'back': 'db_tracking.php', + 'table': version.table_name, + 'report': true, + 'version': version.version + }, '') }}"> + {{ get_icon('b_report', 'Tracking report'|trans) }} + </a> + <a href="tbl_tracking.php" data-post=" + {{- get_common({ + 'db': db, + 'goto': 'tbl_tracking.php', + 'back': 'db_tracking.php', + 'table': version.table_name, + 'snapshot': true, + 'version': version.version + }, '') }}"> + {{ get_icon('b_props', 'Structure snapshot'|trans) }} + </a> + </td> + </tr> + {% endfor %} + </tbody> + </table> + {% include 'select_all.twig' with { + 'pma_theme_image': pma_theme_image, + 'text_dir': text_dir, + 'form_name': 'trackedForm' + } only %} + {{ get_button_or_image( + 'submit_mult', + 'mult_submit', + 'Delete tracking'|trans, + 'b_drop', + 'delete_tracking' + ) }} + </form> + </div> +{% endif %} +{% if untracked_tables_exists %} + <h3>{% trans 'Untracked tables' %}</h3> + <form method="post" action="db_tracking.php" name="untrackedForm" + id="untrackedForm" class="ajax"> + {{ get_hidden_inputs(db) }} + <table id="noversions" class="data"> + <thead> + <tr> + <th></th> + <th>{% trans 'Table' %}</th> + <th>{% trans 'Action' %}</th> + </tr> + </thead> + <tbody> + {% for table_name in untracked_tables %} + {% if get_tracker_version(db, table_name) == -1 %} + <tr> + <td class="center"> + <input type="checkbox" name="selected_tbl[]" + class="checkall" id="selected_tbl_{{ table_name }}" + value="{{ table_name }}"> + </td> + <th> + <label for="selected_tbl_{{ table_name }}"> + {{ table_name }} + </label> + </th> + <td> + <a href="tbl_tracking.php{{ url_query|raw }}&table={{ table_name }}"> + {{ get_icon('eye', 'Track table'|trans) }} + </a> + </td> + </tr> + {% endif %} + {% endfor %} + </tbody> + </table> + {% include 'select_all.twig' with { + 'pma_theme_image': pma_theme_image, + 'text_dir': text_dir, + 'form_name': 'untrackedForm' + } only %} + {{ get_button_or_image( + 'submit_mult', + 'mult_submit', + 'Track table'|trans, + 'eye', + 'track' + ) }} + </form> +{% endif %} |
