--- /dev/null
+/* Copyright (C) 2024 The Meme Factory, Inc. http://www.karlpinc.com/
+
+ This file is part of PGWUI_SQL.
+
+ This program is free software: you can redistribute it and/or
+ modify it under the terms of the GNU Affero General Public License
+ as published by the Free Software Foundation, either version 3 of
+ the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/>.
+
+ Javascript for the sql edit window.
+
+ Karl O. Pinc <kop@karlpinc.com>
+*/
+
+function show_search_path() {
+ fetch('${request.route_path("pgwui_sql_db_search_path")|n}')
+ .then((response) => {
+ if (!response.ok) {
+ window.alert('Problem obtaining the search_path');
+ }
+ return response.text();
+ })
+ .then((search_path) => {
+ const sp_elemt = document.getElementById('search_path_id');
+ sp_elemt.value = search_path;
+ })
+ .catch((error) => {
+ window.alert('Problem showing the search_path: ' + error);
+ })
+};
+function toggle_sql_used(elem) {
+ sql_text = document.getElementById('sql_id');
+ if (elem.checked) {
+ sql_text.style.backgroundColor = '#ececec';
+ } else {
+ sql_text.style.backgroundColor = '';
+ }
+};
<%block name="top_hr">
</%block>
-<script>
- function show_search_path() {
- fetch('${request.route_path("pgwui_sql_db_search_path")|n}')
- .then((response) => {
- if (!response.ok) {
- window.alert('Problem obtaining the search_path');
- }
- return response.text();
- })
- .then((search_path) => {
- const sp_elemt = document.getElementById('search_path_id');
- sp_elemt.value = search_path;
- })
- .catch((error) => {
- window.alert('Problem showing the search_path: ' + error);
- })
- };
- function toggle_sql_used(elem) {
- sql_text = document.getElementById('sql_id');
- if (elem.checked) {
- sql_text.style.backgroundColor = '#ececec';
- } else {
- sql_text.style.backgroundColor = '';
- }
- };
-</script>
-
<%def name="sql_row(tab_index)">
<tr>
<%self.lib:td_label for_id="search_path_id">
% else:
<p>Not logged in. Close this window and re-open it after logging in.</p>
% endif
+
+<script defer
+ src="${request.static_url('pgwui_sql:static/sql_edit.js')}">
+</script>