diff options
Diffstat (limited to 'templates/sql')
-rw-r--r-- | templates/sql/bookmark.twig | 2 | ||||
-rw-r--r-- | templates/sql/query.twig | 176 | ||||
-rw-r--r-- | templates/sql/relational_column_dropdown.twig | 2 |
3 files changed, 178 insertions, 2 deletions
diff --git a/templates/sql/bookmark.twig b/templates/sql/bookmark.twig index 71abc3d1fb..5b0679cfea 100644 --- a/templates/sql/bookmark.twig +++ b/templates/sql/bookmark.twig @@ -1,4 +1,4 @@ -<form action="sql.php" method="post" class="bookmarkQueryForm print_ignore" +<form action="{{ url('/sql') }}" method="post" class="bookmarkQueryForm print_ignore" onsubmit="return ! Functions.emptyCheckTheField(this, 'bkm_fields[bkm_label]');"> {{ get_hidden_inputs() }} <input type="hidden" name="db" value="{{ db }}"> diff --git a/templates/sql/query.twig b/templates/sql/query.twig new file mode 100644 index 0000000000..ff19c381b4 --- /dev/null +++ b/templates/sql/query.twig @@ -0,0 +1,176 @@ +<form method="post" action="{{ url('/import') }}" class="ajax lock-page" id="sqlqueryform" name="sqlform" + {{- is_upload ? ' enctype="multipart/form-data"' }}> + {{ get_hidden_inputs(db, table) }} + <input type="hidden" name="is_js_confirmed" value="0"> + <input type="hidden" name="pos" value="0"> + <input type="hidden" name="goto" value="{{ goto }}"> + <input type="hidden" name="message_to_show" value="{% trans 'Your SQL query has been executed successfully.' %}"> + <input type="hidden" name="prev_sql_query" value="{{ query }}"> + + {% if display_tab == 'full' or display_tab == 'sql' %} + <a id="querybox"></a> + <div id="queryboxcontainer"> + <fieldset id="queryboxf"> + <legend>{{ legend|raw }}</legend> + <div id="queryfieldscontainer"> + <div id="{{ columns_list is not empty ? 'sqlquerycontainer' : 'sqlquerycontainerfull' }}"> + <textarea tabindex="100" name="sql_query" id="sqlquery" cols="{{ textarea_cols }}" rows="{{ textarea_rows * 2 }}" + {{- textarea_auto_select ? ' onclick="Functions.selectContent(this, sqlBoxLocked, true);"' }}> + {{- query -}} + </textarea> + <div id="querymessage"></div> + + {% if columns_list is not empty %} + <input type="button" value="SELECT *" id="selectall" class="btn btn-secondary button sqlbutton"> + <input type="button" value="SELECT" id="select" class="btn btn-secondary button sqlbutton"> + <input type="button" value="INSERT" id="insert" class="btn btn-secondary button sqlbutton"> + <input type="button" value="UPDATE" id="update" class="btn btn-secondary button sqlbutton"> + <input type="button" value="DELETE" id="delete" class="btn btn-secondary button sqlbutton"> + {% endif %} + <input type="button" value="{% trans 'Clear' %}" id="clear" class="btn btn-secondary button sqlbutton"> + {% if codemirror_enable %} + <input type="button" value="{% trans 'Format' %}" id="format" class="btn btn-secondary button sqlbutton"> + {% endif %} + <input type="button" value="{% trans 'Get auto-saved query' %}" id="saved" class="btn btn-secondary button sqlbutton"> + + <div> + <input type="checkbox" name="parameterized" id="parameterized"> + <label for="parameterized">{% trans 'Bind parameters' %}</label> + {{ show_docu('faq', 'faq6-40') }} + <div id="parametersDiv"></div> + </div> + </div> + + {% if columns_list is not empty %} + <div id="tablefieldscontainer"> + <label>{% trans 'Columns' %}</label> + <select id="tablefields" name="dummy" size="{{ textarea_rows - 2 }}" ondblclick="Functions.insertValueQuery()" multiple> + {% for field in columns_list %} + <option value="{{ backquote(field['Field']) }}" + {{- field['Field'] is not null and field['Comment'] is not null and field['Field']|length > 0 ? ' title="' ~ field['Comment'] ~ '"' }}> + {{ field['Field'] }} + </option> + {% endfor %} + </select> + + <div id="tablefieldinsertbuttoncontainer"> + {% if show_icons('ActionLinksMode') %} + <input type="button" class="btn btn-secondary button" name="insert" value=" + {{- '<<' }}" onclick="Functions.insertValueQuery()" title="{% trans 'Insert' %}"> + {% else %} + <input type="button" class="btn btn-secondary button" name="insert" value=" + {%- trans 'Insert' %}" onclick="Functions.insertValueQuery()"> + {% endif %} + </div> + </div> + {% endif %} + + <div class="clearfloat"></div> + </div> + + {% if has_bookmark %} + <div id="bookmarkoptions"> + <div class="formelement"> + <label for="bkm_label">{% trans 'Bookmark this SQL query:' %}</label> + <input type="text" name="bkm_label" id="bkm_label" tabindex="110" value=""> + </div> + + <div class="formelement"> + <input type="checkbox" name="bkm_all_users" tabindex="111" id="id_bkm_all_users" value="true"> + <label for="id_bkm_all_users">{% trans 'Let every user access this bookmark' %}</label> + </div> + + <div class="formelement"> + <input type="checkbox" name="bkm_replace" tabindex="112" id="id_bkm_replace" value="true"> + <label for="id_bkm_replace">{% trans 'Replace existing bookmark of same name' %}</label> + </div> + </div> + {% endif %} + + <div class="clearfloat"></div> + </fieldset> + </div> + + <fieldset id="queryboxfooter" class="tblFooters"> + <div class="formelement"></div> + + <div class="formelement"> + [ + <label for="id_sql_delimiter">{% trans 'Delimiter' %}</label> + <input type="text" name="sql_delimiter" tabindex="131" size="3" value="{{ delimiter }}" id="id_sql_delimiter"> + ] + </div> + + <div class="formelement"> + <input type="checkbox" name="show_query" value="1" id="checkbox_show_query" tabindex="132"> + <label for="checkbox_show_query">{% trans 'Show this query here again' %}</label> + </div> + + <div class="formelement"> + <input type="checkbox" name="retain_query_box" value="1" id="retain_query_box" tabindex="133" + {{- retain_query_box ? ' checked' }}> + <label for="retain_query_box">{% trans 'Retain query box' %}</label> + </div> + + <div class="formelement"> + <input type="checkbox" name="rollback_query" value="1" id="rollback_query" tabindex="134"> + <label for="rollback_query">{% trans 'Rollback when finished' %}</label> + </div> + + <div class="formelement"> + {{ get_fk_checkbox() }} + </div> + + <input class="btn btn-primary" type="submit" id="button_submit_query" name="SQL" tabindex="200" value="{% trans 'Go' %}"> + + <div class="clearfloat"></div> + </fieldset> + {% endif %} + + {% if display_tab == 'full' and bookmarks is not empty %} + <fieldset id="fieldsetBookmarkOptions"> + <legend>{% trans 'Bookmarked SQL query' %}</legend> + <div class="formelement"> + <select name="id_bookmark" id="id_bookmark"> + <option value=""> </option> + {% for bookmark in bookmarks %} + <option value="{{ bookmark.id }}" data-varcount="{{ bookmark.variable_count }}"> + {{ bookmark.label }} + {% if bookmark.is_shared %} + ({% trans 'shared' %}) + {% endif %} + </option> + {% endfor %} + </select> + </div> + + <div class="formelement"> + <input type="radio" name="action_bookmark" value="0" id="radio_bookmark_exe" checked> + <label for="radio_bookmark_exe">{% trans 'Submit' %}</label> + <input type="radio" name="action_bookmark" value="1" id="radio_bookmark_view"> + <label for="radio_bookmark_view">{% trans 'View only' %}</label> + <input type="radio" name="action_bookmark" value="2" id="radio_bookmark_del"> + <label for="radio_bookmark_del">{% trans 'Delete' %}</label> + </div> + + <div class="clearfloat"></div> + + <div class="formelement hide"> + {% trans 'Variables' %} + {{ show_docu('faq', 'faqbookmark') }} + <div id="bookmark_variables"></div> + </div> + </fieldset> + + <fieldset id="fieldsetBookmarkOptionsFooter" class="tblFooters"> + <input class="btn btn-primary" type="submit" name="SQL" id="button_submit_bookmark" value="{% trans 'Go' %}"> + <div class="clearfloat"></div> + </fieldset> + {% endif %} + + {% if can_convert_kanji %} + {% include 'encoding/kanji_encoding_form.twig' %} + {% endif %} +</form> + +<div id="sqlqueryresultsouter"></div> diff --git a/templates/sql/relational_column_dropdown.twig b/templates/sql/relational_column_dropdown.twig index 6a2aaffc21..e48c5294a2 100644 --- a/templates/sql/relational_column_dropdown.twig +++ b/templates/sql/relational_column_dropdown.twig @@ -1,4 +1,4 @@ <span class="curr_value">{{ current_value }}</span> -<a href="browse_foreigners.php" data-post="{{ get_common(params, '') }}"> +<a href="{{ url('/browse-foreigners') }}" data-post="{{ get_common(params, '') }}"> {% trans 'Browse foreign values' %} </a> |