From 5a30b258aff1e0cdbd0f61cb7757a9a5ef1e6558 Mon Sep 17 00:00:00 2001 From: George Gelashvili and Sarah McAlear Date: Tue, 28 Feb 2017 11:35:49 -0500 Subject: [PATCH 4/7] Change quotes in sqleditor to make it valid js independent of flask --- .../sqleditor/templates/sqleditor/js/sqleditor.js | 128 ++++++++++----------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js index 911465b5..28796ea1 100644 --- a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js +++ b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js @@ -176,7 +176,7 @@ define( // Create panels for 'Data Output', 'Explain', 'Messages' and 'History' var data_output = new pgAdmin.Browser.Panel({ name: 'data_output', - title: '{{ _('Data Output') }}', + title: "{{ _('Data Output') }}", width: '100%', height:'100%', isCloseable: false, @@ -186,7 +186,7 @@ define( var explain = new pgAdmin.Browser.Panel({ name: 'explain', - title: '{{ _('Explain') }}', + title: "{{ _('Explain') }}", width: '100%', height:'100%', isCloseable: false, @@ -196,7 +196,7 @@ define( var messages = new pgAdmin.Browser.Panel({ name: 'messages', - title: '{{ _('Messages') }}', + title: "{{ _('Messages') }}", width: '100%', height:'100%', isCloseable: false, @@ -206,7 +206,7 @@ define( var history = new pgAdmin.Browser.Panel({ name: 'history', - title: '{{ _('History') }}', + title: "{{ _('History') }}", width: '100%', height:'100%', isCloseable: false, @@ -238,11 +238,11 @@ define( var data_store = self.handler.data_store; if(data_store && (_.size(data_store.added) || _.size(data_store.updated))) { - msg = '{{ _('The data has been modified, but not saved. Are you sure you wish to discard the changes?') }}'; + msg = "{{ _('The data has been modified, but not saved. Are you sure you wish to discard the changes?') }}"; notify = true; } } else if(self.handler.is_query_tool && self.handler.is_query_changed) { - msg = '{{ _('The query has been modified, but not saved. Are you sure you wish to discard the changes?') }}'; + msg = "{{ _('The query has been modified, but not saved. Are you sure you wish to discard the changes?') }}"; notify = true; } if(notify) {return self.user_confirmation(p, msg);} @@ -391,7 +391,7 @@ define( /* To prompt user for unsaved changes */ user_confirmation: function(panel, msg) { // If there is anything to save then prompt user - alertify.confirm('{{ _('Unsaved changes') }}', msg, + alertify.confirm("{{ _('Unsaved changes') }}", msg, function() { // Do nothing as user do not want to save, just continue window.onbeforeunload = null; @@ -1293,8 +1293,8 @@ define( */ if (self.handler.is_query_changed) { alertify.confirm( - '{{ _('Unsaved changes') }}', - '{{ _('Are you sure you wish to discard the current changes?') }}', + "{{ _('Unsaved changes') }}", + "{{ _('Are you sure you wish to discard the current changes?') }}", function() { // Do nothing as user do not want to save, just continue self.query_tool_obj.setValue(''); @@ -1316,8 +1316,8 @@ define( // ask for confirmation only if anything to clear if(!self.history_collection.length) { return; } - alertify.confirm('{{ _('Clear history') }}', - '{{ _('Are you sure you wish to clear the history?') }}', + alertify.confirm("{{ _('Clear history') }}", + "{{ _('Are you sure you wish to clear the history?') }}", function() { // Remove any existing grid first if (self.history_grid) { @@ -1608,8 +1608,8 @@ define( _.size(self.data_store.updated) || _.size(self.data_store.deleted)) ) { - alertify.confirm('{{ _('Unsaved changes') }}', - '{{ _('The data has been modified, but not saved. Are you sure you wish to discard the changes?') }}', + alertify.confirm("{{ _('Unsaved changes') }}", + "{{ _('The data has been modified, but not saved. Are you sure you wish to discard the changes?') }}", function(){ // Do nothing as user do not want to save, just continue self._run_query(); @@ -1633,14 +1633,14 @@ define( self.trigger( 'pgadmin-sqleditor:loading-icon:show', - '{{ _('Initializing query execution.') }}' + "{{ _('Initializing query execution.') }}" ); $("#btn-flash").prop('disabled', true); self.trigger( 'pgadmin-sqleditor:loading-icon:message', - '{{ _('Waiting for the query execution to complete...') }}' + "{{ _('Waiting for the query execution to complete...') }}" ); $.ajax({ @@ -1693,7 +1693,7 @@ define( self.trigger('pgadmin-sqleditor:loading-icon:hide'); if (e.readyState == 0) { self.update_msg_history(false, - '{{ _('Not connected to the server or the connection to the server has been closed.') }}' + "{{ _('Not connected to the server or the connection to the server has been closed.') }}" ); return; } @@ -1757,7 +1757,7 @@ define( else { // Show message in message and history tab in case of query tool self.total_time = self.get_query_run_time(self.query_start_time, self.query_end_time); - var msg = S('{{ _('Query returned successfully in %s.') }}').sprintf(self.total_time).value(); + var msg = S("{{ _('Query returned successfully in %s.') }}").sprintf(self.total_time).value(); res.result += "\n\n" + msg; self.update_msg_history(true, res.result, false); // Display the notifier if the timeout is set to >= 0 @@ -1793,7 +1793,7 @@ define( if (res.data.status === 'Success') { self.trigger( 'pgadmin-sqleditor:loading-icon:message', - '{{ _('Loading data from the database server and rendering...') }}' + "{{ _('Loading data from the database server and rendering...') }}" ); self.get_columns(res.data); } @@ -1829,7 +1829,7 @@ define( if (e.readyState == 0) { self.update_msg_history(false, - '{{ _('Not connected to the server or the connection to the server has been closed.') }}' + "{{ _('Not connected to the server or the connection to the server has been closed.') }}" ); return; } @@ -1897,15 +1897,15 @@ define( self.trigger( 'pgadmin-sqleditor:loading-icon:message', - '{{ _('Loading data from the database server and rendering...') }}', + "{{ _('Loading data from the database server and rendering...') }}", self ); // Show message in message and history tab in case of query tool self.total_time = self.get_query_run_time(self.query_start_time, self.query_end_time); self.update_msg_history(true, "", false); - var msg1 = S('{{ _('Total query runtime: %s.') }}').sprintf(self.total_time).value(); - var msg2 = S('{{ _('%s rows retrieved.') }}').sprintf(self.rows_affected).value(); + var msg1 = S("{{ _('Total query runtime: %s.') }}").sprintf(self.total_time).value(); + var msg2 = S("{{ _('%s rows retrieved.') }}").sprintf(self.rows_affected).value(); // Display the notifier if the timeout is set to >= 0 if (self.info_notifier_timeout >= 0) { @@ -1983,7 +1983,7 @@ define( self.trigger( 'pgadmin-sqleditor:loading-icon:message', - '{{ _('Retrieving information about the columns returned...') }}' + "{{ _('Retrieving information about the columns returned...') }}" ); // Make ajax call to fetch the pg types to map numeric data type @@ -2209,17 +2209,17 @@ define( } else { $("#btn-save").prop('disabled', true); } - alertify.success('{{ _('Row(s) deleted') }}'); + alertify.success("{{ _('Row(s) deleted') }}"); } else { // There are other data to needs to be updated on server if(is_updated) { - alertify.alert('{{ _('Operation failed') }}', - '{{ _('There are unsaved changes in grid, Please save them first to avoid inconsistency in data') }}' + alertify.alert("{{ _('Operation failed') }}", + "{{ _('There are unsaved changes in grid, Please save them first to avoid inconsistency in data') }}" ); return; } - alertify.confirm('{{ _('Delete Row(s)') }}', - '{{ _('Are you sure you wish to delete selected row(s)?') }}', + alertify.confirm("{{ _('Delete Row(s)') }}", + "{{ _('Are you sure you wish to delete selected row(s)?') }}", function() { $("#btn-delete-row").prop('disabled', true); $("#btn-copy-row").prop('disabled', true); @@ -2281,7 +2281,7 @@ define( self.trigger( 'pgadmin-sqleditor:loading-icon:show', - '{{ _('Saving the updated data...') }}' + "{{ _('Saving the updated data...') }}" ); // Add the columns to the data so the server can remap the data @@ -2337,7 +2337,7 @@ define( // Something went wrong while saving data on the db server $("#btn-flash").prop('disabled', false); $('.sql-editor-message').text(res.data.result); - var err_msg = S('{{ _('%s.') }}').sprintf(res.data.result).value(); + var err_msg = S("{{ _('%s.') }}").sprintf(res.data.result).value(); alertify.notify(err_msg, 'error', 20); // To highlight the row at fault @@ -2368,7 +2368,7 @@ define( error: function(e) { if (e.readyState == 0) { self.update_msg_history(false, - '{{ _('Not connected to the server or the connection to the server has been closed.') }}' + "{{ _('Not connected to the server or the connection to the server has been closed.') }}" ); return; } @@ -2438,8 +2438,8 @@ define( * confirm with the user for unsaved changes. */ if (self.is_query_changed) { - alertify.confirm('{{ _('Unsaved changes') }}', - '{{ _('Are you sure you wish to discard the current changes?') }}', + alertify.confirm("{{ _('Unsaved changes') }}", + "{{ _('Are you sure you wish to discard the current changes?') }}", function() { // User do not want to save, just continue self._open_select_file_manager(); @@ -2473,7 +2473,7 @@ define( self.trigger( 'pgadmin-sqleditor:loading-icon:show', - '{{ _('Loading the file...') }}' + "{{ _('Loading the file...') }}" ); // set cursor to progress before file load var $busy_icon_div = $('.sql-editor-busy-fetching'); @@ -2521,7 +2521,7 @@ define( } self.trigger( 'pgadmin-sqleditor:loading-icon:show', - '{{ _('Saving the queries in the file...') }}' + "{{ _('Saving the queries in the file...') }}" ); // Make ajax call to save the data to file @@ -2532,7 +2532,7 @@ define( data: JSON.stringify(data), success: function(res) { if (res.data.status) { - alertify.success('{{ _('File saved successfully.') }}'); + alertify.success("{{ _('File saved successfully.') }}"); self.gridView.current_file = e; self.setTitle(self.gridView.current_file.replace(/^.*[\\\/]/g, '')); // disable save button on file save @@ -2639,7 +2639,7 @@ define( self.trigger( 'pgadmin-sqleditor:loading-icon:show', - '{{ _('Loading the existing filter options...') }}' + "{{ _('Loading the existing filter options...') }}" ); $.ajax({ url: "{{ url_for('sqleditor.index') }}" + "filter/get/" + self.transId, @@ -2669,7 +2669,7 @@ define( var msg; if (e.readyState == 0) { msg = - '{{ _('Not connected to the server or the connection to the server has been closed.') }}' + "{{ _('Not connected to the server or the connection to the server has been closed.') }}" } else { msg = e.responseText; if (e.responseJSON != undefined && @@ -2709,7 +2709,7 @@ define( self.trigger( 'pgadmin-sqleditor:loading-icon:show', - '{{ _('Applying the new filter...') }}' + "{{ _('Applying the new filter...') }}" ); // Make ajax call to include the filter by selection @@ -2738,7 +2738,7 @@ define( function() { if (e.readyState == 0) { alertify.alert('Filter By Selection Error', - '{{ _('Not connected to the server or the connection to the server has been closed.') }}' + "{{ _('Not connected to the server or the connection to the server has been closed.') }}" ); return; } @@ -2779,7 +2779,7 @@ define( self.trigger( 'pgadmin-sqleditor:loading-icon:show', - '{{ _('Applying the new filter...') }}' + "{{ _('Applying the new filter...') }}" ); // Make ajax call to exclude the filter by selection. @@ -2809,7 +2809,7 @@ define( function() { if (e.readyState == 0) { alertify.alert('Filter Exclude Selection Error', - '{{ _('Not connected to the server or the connection to the server has been closed.') }}' + "{{ _('Not connected to the server or the connection to the server has been closed.') }}" ); return; } @@ -2832,7 +2832,7 @@ define( self.trigger( 'pgadmin-sqleditor:loading-icon:show', - '{{ _('Removing the filter...') }}' + "{{ _('Removing the filter...') }}" ); // Make ajax call to exclude the filter by selection. @@ -2859,7 +2859,7 @@ define( function() { if (e.readyState == 0) { alertify.alert('Remove Filter Error', - '{{ _('Not connected to the server or the connection to the server has been closed.') }}' + "{{ _('Not connected to the server or the connection to the server has been closed.') }}" ); return; } @@ -2883,7 +2883,7 @@ define( self.trigger( 'pgadmin-sqleditor:loading-icon:show', - '{{ _('Applying the filter...') }}' + "{{ _('Applying the filter...') }}" ); // Make ajax call to include the filter by selection @@ -2914,7 +2914,7 @@ define( function() { if (e.readyState == 0) { alertify.alert('Apply Filter Error', - '{{ _('Not connected to the server or the connection to the server has been closed.') }}' + "{{ _('Not connected to the server or the connection to the server has been closed.') }}" ); return; } @@ -3038,7 +3038,7 @@ define( self.trigger( 'pgadmin-sqleditor:loading-icon:show', - '{{ _('Setting the limit on the result...') }}' + "{{ _('Setting the limit on the result...') }}" ); // Make ajax call to change the limit $.ajax({ @@ -3065,7 +3065,7 @@ define( function() { if (e.readyState == 0) { alertify.alert('Change limit Error', - '{{ _('Not connected to the server or the connection to the server has been closed.') }}' + "{{ _('Not connected to the server or the connection to the server has been closed.') }}" ); return; } @@ -3112,7 +3112,7 @@ define( self.trigger( 'pgadmin-sqleditor:loading-icon:show', - '{{ _('Initializing the query execution!') }}' + "{{ _('Initializing the query execution!') }}" ); $("#btn-flash").prop('disabled', true); @@ -3146,7 +3146,7 @@ define( if (res.data.status) { self.trigger( 'pgadmin-sqleditor:loading-icon:message', - '{{ _('Waiting for the query execution to complete...') }}' + "{{ _('Waiting for the query execution to complete...') }}" ); self.can_edit = res.data.can_edit; @@ -3173,7 +3173,7 @@ define( if (e.readyState == 0) { self.update_msg_history(false, - '{{ _('Not connected to the server or the connection to the server has been closed.') }}' + "{{ _('Not connected to the server or the connection to the server has been closed.') }}" ); return; } @@ -3271,7 +3271,7 @@ define( if (e.readyState == 0) { alertify.alert('Cancel Query Error', - '{{ _('Not connected to the server or the connection to the server has been closed.') }}' + "{{ _('Not connected to the server or the connection to the server has been closed.') }}" ); return; } @@ -3316,7 +3316,7 @@ define( error: function(e) { if (e.readyState == 0) { alertify.alert('Get Object Name Error', - '{{ _('Not connected to the server or the connection to the server has been closed.') }}' + "{{ _('Not connected to the server or the connection to the server has been closed.') }}" ); return; } @@ -3369,7 +3369,7 @@ define( error: function(e) { if (e.readyState == 0) { alertify.alert('Auto Rollback Error', - '{{ _('Not connected to the server or the connection to the server has been closed.') }}' + "{{ _('Not connected to the server or the connection to the server has been closed.') }}" ); return; } @@ -3408,7 +3408,7 @@ define( error: function(e) { if (e.readyState == 0) { alertify.alert('Auto Commit Error', - '{{ _('Not connected to the server or the connection to the server has been closed.') }}' + "{{ _('Not connected to the server or the connection to the server has been closed.') }}" ); return; } @@ -3473,13 +3473,13 @@ define( success: function(res) { if(res.success == undefined || !res.success) { alertify.alert('Explain options error', - '{{ _('Error occurred while setting verbose option in explain') }}' + "{{ _('Error occurred while setting verbose option in explain') }}" ); } }, error: function(e) { alertify.alert('Explain options error', - '{{ _('Error occurred while setting verbose option in explain') }}' + "{{ _('Error occurred while setting verbose option in explain') }}" ); return; } @@ -3511,13 +3511,13 @@ define( success: function(res) { if(res.success == undefined || !res.success) { alertify.alert('Explain options error', - '{{ _('Error occurred while setting costs option in explain') }}' + "{{ _('Error occurred while setting costs option in explain') }}" ); } }, error: function(e) { alertify.alert('Explain options error', - '{{ _('Error occurred while setting costs option in explain') }}' + "{{ _('Error occurred while setting costs option in explain') }}" ); } }); @@ -3548,13 +3548,13 @@ define( success: function(res) { if(res.success == undefined || !res.success) { alertify.alert('Explain options error', - '{{ _('Error occurred while setting buffers option in explain') }}' + "{{ _('Error occurred while setting buffers option in explain') }}" ); } }, error: function(e) { alertify.alert('Explain options error', - '{{ _('Error occurred while setting buffers option in explain') }}' + "{{ _('Error occurred while setting buffers option in explain') }}" ); } }); @@ -3584,13 +3584,13 @@ define( success: function(res) { if(res.success == undefined || !res.success) { alertify.alert('Explain options error', - '{{ _('Error occurred while setting timing option in explain') }}' + "{{ _('Error occurred while setting timing option in explain') }}" ); } }, error: function(e) { alertify.alert('Explain options error', - '{{ _('Error occurred while setting timing option in explain') }}' + "{{ _('Error occurred while setting timing option in explain') }}" ); } }); @@ -3668,7 +3668,7 @@ define( error: function(e) { updateUI(); alertify.alert('Get Preferences error', - '{{ _('Error occurred while getting query tool options ') }}' + "{{ _('Error occurred while getting query tool options ') }}" ); } }); -- 2.12.0