diff options
author | Leonardo Strozzi <laps15@inf.ufpr.br> | 2018-06-02 07:30:16 +0300 |
---|---|---|
committer | Leonardo Strozzi <laps15@inf.ufpr.br> | 2018-06-03 06:34:12 +0300 |
commit | be673f908dd320fe530cb5c6b3fae879a8824398 (patch) | |
tree | e8b33f3343168afe16e6cdcf75c51a3f8e0f99fa /templates | |
parent | 4e88bf0fae49d653340cd4b64f62442da6547b6d (diff) |
Refactor db central columns templates
Signed-off-by: Leonardo Strozzi <laps15@inf.ufpr.br>
Diffstat (limited to 'templates')
-rw-r--r-- | templates/database/central_columns/add_column.twig | 20 | ||||
-rw-r--r-- | templates/database/central_columns/main.twig | 410 | ||||
-rw-r--r-- | templates/database/central_columns/table_header.twig | 41 | ||||
-rw-r--r-- | templates/database/central_columns/table_navigation.twig | 42 | ||||
-rw-r--r-- | templates/database/central_columns/table_row.twig | 60 |
5 files changed, 410 insertions, 163 deletions
diff --git a/templates/database/central_columns/add_column.twig b/templates/database/central_columns/add_column.twig deleted file mode 100644 index 1a3a0672e0..0000000000 --- a/templates/database/central_columns/add_column.twig +++ /dev/null @@ -1,20 +0,0 @@ -<table class="central_columns_add_column" class="navigation nospacing nopadding"> - <tr> - <td class="navigation_separator largescreenonly"></td> - <td class="central_columns_navigation"> - {{ Util_getIcon('centralColumns_add', 'Add column'|trans)|raw }} - <form id="add_column" action="db_central_columns.php" method="post"> - {{ Url_getHiddenInputs(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 }}"/> - {{ table_drop_down|raw }} - <select name="column-select" id="column-select"> - <option value="" selected="selected">{% trans 'Select a column.' %}</option> - </select> - <input type="submit" value="{% trans 'Add' %}"></input> - </form> - </td> - <td class="navigation_separator largescreenonly"></td> - </tr> -</table> diff --git a/templates/database/central_columns/main.twig b/templates/database/central_columns/main.twig new file mode 100644 index 0000000000..646f3d95ec --- /dev/null +++ b/templates/database/central_columns/main.twig @@ -0,0 +1,410 @@ +{# 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"> + {{ Url_getHiddenInputs(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 'Lenght/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"> + {{ Charsets_getCollationDropdownBox( + dbi, + disableIs, + 'field_collation[0]', + 'field_0_4', + null, + false + ) | raw }} + </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" 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"> + {{ Url_getHiddenInputs(db) }} + <input type="hidden" name="pos" value="{{ pos - max_rows }}" /> + <input type="hidden" name="total_rows" value="{{ total_rows }}"/> + <input type="submit" name="navig" class="ajax" value="<" /> + </form> + </td> + {% endif %} + {% if tn_nbTotalPage > 1 %} + <td> + <form action="db_central_columns.php" method="post"> + {{ Url_getHiddenInputs(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"> + {{ Url_getHiddenInputs(db) }} + <input type="hidden" name="pos" value="{{ pos + max_rows }}"/> + <input type="hidden" name="total_rows" value="{{ total_rows }}"/> + <input type="submit" name="navig" class="ajax" value=">" /> + </form> + </td> + {% endif %} + </form> + </td> + <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"> + {{ Util_getIcon('centralColumns_add', 'Add column' | trans)|raw }} + <form id="add_column" action="db_central_columns.php" method="post"> + {{ Url_getHiddenInputs(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 type="submit" value="{% trans 'Add' %}"></input> + </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"> + {{ Url_getHiddenInputs(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 'Lenght/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 }}"> + {{ Url_getHiddenInputs(db) }} + <input type="hidden" name="edit_save" value="save"> + <td class="nowrap"> + <input type="checkbox" class="checkall" name="selected_fld[]" + value="{{ row['col_name'] | raw }}" id="{{ 'checkbox_row_' ~ row_num }}"/> + </td> + <td id="{{ 'edit_' ~ row_num }}" class="edit center"> + <a href="#"> {{ Util_getIcon('b_edit', 'Edit' | trans) | raw }}</a> + </td> + <td class="del_row" data-rownum = "{{ row_num }}"> + <a hrf="#">{{ Util_getIcon('b_drop', 'Delete' | trans) }}</a> + <input type="submit" data-rownum = "{{ row_num }}" class="edit_cancel_form" value="Cancel"> + </td> + <td id="{{ 'save_' ~ row_num }}" class="hide"> + <input type="submit" data-rownum="{{ row_num }}" class="edit_save_form" value="Save"> + </td> + <td name="col_name" class="nowrap"> + <span>{{ row['col_name'] | raw }}</span> + <input name="orig_col_name" type="hidden" value="{{ row['col_name'] | raw }}"> + {% 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'] | raw }}</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'] | raw):'') }}</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'] | raw }}</span> + {{ Charsets_getCollationDropdownBox( + dbi, + disableIs, + 'field_collation[' ~ row_num ~ ']', + 'field_' ~ row_num ~ '_4', row['col_collation'], + false + ) | raw }} + </td> + <td class="nowrap" name="col_attribute"> + <span>{{ row['col_attribute']?(row['col_attribute'] | raw):"" }}</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'] | raw }}</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 %} + {{ Util_getButtonOrImage( + 'edit_central_columns', + 'mult_submit change_central_columns', + 'Edit' | trans, + 'b_edit', + 'edit central columns' + ) | raw }} + {{ Util_getButtonOrImage( + 'delete_central_columns', + 'mult_submit', + 'Delete' | trans, + 'b_drop', + 'remove_from_central_columns' + ) | raw }} + </form> + </div> +{% endif %} diff --git a/templates/database/central_columns/table_header.twig b/templates/database/central_columns/table_header.twig deleted file mode 100644 index f393d7229a..0000000000 --- a/templates/database/central_columns/table_header.twig +++ /dev/null @@ -1,41 +0,0 @@ -<thead> - <tr> - <th class="{{ class }}"></th> - <th class="hide"></th> - {% if actionCount > 0 %} - <th class="column_action" colspan="{{actionCount}}">{% trans 'Action' %}</th> - {% endif %} - <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 'Lenght/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> diff --git a/templates/database/central_columns/table_navigation.twig b/templates/database/central_columns/table_navigation.twig deleted file mode 100644 index 3897cf085b..0000000000 --- a/templates/database/central_columns/table_navigation.twig +++ /dev/null @@ -1,42 +0,0 @@ -<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"> - {{ Url_getHiddenInputs(db) }} - <input type="hidden" name="pos" value="{{ pos - max_rows }}" /> - <input type="hidden" name="total_rows" value="{{ total_rows }}"/> - <input type="submit" name="navig" class="ajax" value="<" /> - </form> - </td> - {% endif %} - {% if nb_total_page > 1 %} - <td> - <form action="db_central_columns.php" method="post"> - {{ Url_getHiddenInputs(db) }} - <input type="hidden" name="total_rows" value="{{ total_rows }}"/> - {{ page_selector|raw }} - </form> - </td> - {% endif %} - {% if pos + max_rows < total_rows %} - <td> - <form action="db_central_columns.php" method="post"> - {{ Url_getHiddenInputs(db) }} - <input type="hidden" name="pos" value="{{ pos + max_rows }}"/> - <input type="hidden" name="total_rows" value="{{ total_rows }}"/> - <input type="submit" name="navig" class="ajax" value=">" /> - </form> - </td> - {% endif %} - </form> - </td> - <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> diff --git a/templates/database/central_columns/table_row.twig b/templates/database/central_columns/table_row.twig deleted file mode 100644 index 0514d2c935..0000000000 --- a/templates/database/central_columns/table_row.twig +++ /dev/null @@ -1,60 +0,0 @@ -<tr data-rownum="{{ row_num }}" id="{{ 'f_' ~ row_num }}"> - {{ Url_getHiddenInputs(db) }} - <input type="hidden" name="edit_save" value="save"> - <td class="nowrap"> - <input type="checkbox" class="checkall" name="selected_fld[]" - value="{{ row['col_name']|raw }}" id="{{ 'checkbox_row_' ~ row_num }}"/> - </td> - <td id="{{ 'edit_' ~ row_num }}" class="edit center"> - <a href="#"> {{ Util_getIcon('b_edit', 'Edit'|trans) |raw }}</a> - </td> - <td class="del_row" data-rownum = "{{ row_num }}"> - <a hrf="#">{{ Util_getIcon('b_drop', 'Delete'|trans) }}</a> - <input type="submit" data-rownum = "{{ row_num }}" class="edit_cancel_form" value="Cancel"> - </td> - <td id="{{ 'save_' ~ row_num }}" class="hide"> - <input type="submit" data-rownum="{{ row_num }}" class="edit_save_form" value="Save"> - </td> - <td name="col_name" class="nowrap"> - <span>{{ row['col_name'] |raw }}</span> - <input name="orig_col_name" type="hidden" value="{{ row['col_name'] |raw }}"> - {{ column_name |raw }} - </td> - <td name = "col_type" class="nowrap"> - <span>{{ row['col_type'] |raw }}</span> - {{ column_type |raw }} - </td> - <td class="nowrap" name="col_length"> - <span>{{ (row['col_length']?(row['col_length'] | raw):'') }}</span> - {{ column_length |raw }} - </td> - <td class="nowrap" name="col_default"> - {% if row['col_default'] is defined %} - <span>{{ row['col_default'] }}</span> - {% else %} - <span>None</span> - {% endif %} - {{ column_default |raw }} - </td> - <td name="collation" class="nowrap"> - <span>{{ row['col_collation'] |raw }}</span> - {{ Charsets_getCollationDropdownBox( - dbi, - disableIs, - 'field_collation[' ~ row_num ~ ']', - 'field_' ~ row_num ~ '_4', row['col_collation'], false - ) |raw }} - </td> - <td class="nowrap" name="col_attribute"> - <span>{{ row['col_attribute']?(row['col_attribute'] |raw):"" }}</span> - {{ column_attribute |raw }} - </td> - <td class="nowrap" name="col_isNull"> - <span>{{ row['col_isNull'] ? 'Yes' |trans : 'No' |trans }}</span> - {{ column_null |raw }} - </td> - <td class="nowrap" name="col_extra"> - <span>{{ row['col_extra'] |raw }}</span> - {{ column_extra |raw }} - </td> -</tr> |