Using the client-side translation using the client-side 'gettext'

implementation.

This is the first step towards 'Avoid creating the javascript modules
using Jinja templates'.
This commit is contained in:
Ashesh Vashi
2017-06-07 15:53:02 +05:30
parent 7e9f82bc17
commit ae80976689
77 changed files with 2603 additions and 2624 deletions

View File

@@ -1,15 +1,13 @@
// Backup dialog
define([
'jquery', 'underscore', 'underscore.string', 'alertify',
'pgadmin.browser', 'backbone', 'backgrid', 'backform', 'pgadmin.browser.node'
],
'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'alertify',
'pgadmin.browser', 'backbone', 'backgrid', 'backform', 'pgadmin.browser.node'
], function(gettext, $, _, S, alertify, pgBrowser, Backbone, Backgrid, Backform, pgNode) {
// This defines Backup dialog
function($, _, S, alertify, pgBrowser, Backbone, Backgrid, Backform, pgNode) {
// if module is already initialized, refer to that.
if (pgBrowser.Backup) {
return pgBrowser.Backup;
}
// if module is already initialized, refer to that.
if (pgBrowser.Backup) {
return pgBrowser.Backup;
}
/*
=====================
@@ -59,33 +57,33 @@ TODO LIST FOR BACKUP:
type: undefined /* global, server */
},
schema: [{
id: 'file', label: '{{ _('Filename') }}',
id: 'file', label: gettext('Filename'),
type: 'text', disabled: false, control: Backform.FileControl,
dialog_type: 'create_file', supp_types: ['*', 'sql', 'backup']
},{
id: 'role', label: '{{ _('Role name') }}',
id: 'role', label: gettext('Role name'),
control: 'node-list-by-name', node: 'role',
select2: { allowClear: false }
},{
type: 'nested', control: 'fieldset', label: '{{ _('Miscellaneous') }}',
type: 'nested', control: 'fieldset', label: gettext('Miscellaneous'),
schema:[{
id: 'verbose', label: '{{ _('Verbose messages') }}',
id: 'verbose', label: gettext('Verbose messages'),
control: Backform.CustomSwitchControl, disabled: false,
group: '{{ _('Miscellaneous') }}'
group: gettext('Miscellaneous')
},{
id: 'dqoute', label: '{{ _('Force double quote on identifiers') }}',
id: 'dqoute', label: gettext('Force double quote on identifiers'),
control: Backform.CustomSwitchControl, disabled: false,
group: '{{ _('Miscellaneous') }}'
group: gettext('Miscellaneous')
}]
},{
id: 'server_note', label: '{{ _('Note') }}',
text: '{{ _('The backup format will be PLAIN') }}',
id: 'server_note', label: gettext('Note'),
text: gettext('The backup format will be PLAIN'),
type: 'note', visible: function(m){
return m.get('type') === 'server';
}
},{
id: 'globals_note', label: '{{ _('Note') }}',
text: '{{ _('Only objects global to the entire database will be backed up in PLAIN format') }}',
id: 'globals_note', label: gettext('Note'),
text: gettext('Only objects global to the entire database will be backed up in PLAIN format'),
type: 'note', visible: function(m){
return m.get('type') === 'globals';
}
@@ -112,69 +110,69 @@ TODO LIST FOR BACKUP:
database: undefined
},
schema: [{
id: 'file', label: '{{ _('Filename') }}',
id: 'file', label: gettext('Filename'),
type: 'text', disabled: false, control: Backform.FileControl,
dialog_type: 'create_file', supp_types: ['*', 'sql', 'backup']
},{
id: 'format', label: '{{ _('Format') }}',
id: 'format', label: gettext('Format'),
type: 'text', disabled: false,
control: 'select2', select2: {
allowClear: false,
width: "100%"
},
options: [
{label: '{{ _('Custom') }}', value: "custom"},
{label: '{{ _('Tar') }}', value: "tar"},
{label: '{{ _('Plain') }}', value: "plain"},
{label: '{{ _('Directory') }}', value: "directory"}
{label: gettext('Custom'), value: "custom"},
{label: gettext('Tar'), value: "tar"},
{label: gettext('Plain'), value: "plain"},
{label: gettext('Directory'), value: "directory"}
]
},{
id: 'ratio', label: '{{ _('Compression ratio') }}',
id: 'ratio', label: gettext('Compression ratio'),
type: 'int', min: 0, max:9, disabled: false
},{
id: 'encoding', label: '{{ _('Encoding') }}',
id: 'encoding', label: gettext('Encoding'),
type: 'text', disabled: false, node: 'database',
control: 'node-ajax-options', url: 'get_encodings'
},{
id: 'no_of_jobs', label: '{{ _('Number of jobs') }}',
id: 'no_of_jobs', label: gettext('Number of jobs'),
type: 'int', deps: ['format'], disabled: function(m) {
return !(m.get('format') === "Directory");
}
},{
id: 'role', label: '{{ _('Role name') }}',
id: 'role', label: gettext('Role name'),
control: 'node-list-by-name', node: 'role',
select2: { allowClear: false }
},{
type: 'nested', control: 'fieldset', label: '{{ _('Sections') }}',
group: '{{ _('Dump options') }}',
type: 'nested', control: 'fieldset', label: gettext('Sections'),
group: gettext('Dump options'),
schema:[{
id: 'pre_data', label: '{{ _('Pre-data') }}',
control: Backform.CustomSwitchControl, group: '{{ _('Sections') }}',
id: 'pre_data', label: gettext('Pre-data'),
control: Backform.CustomSwitchControl, group: gettext('Sections'),
deps: ['only_data', 'only_schema'], disabled: function(m) {
return m.get('only_data')
|| m.get('only_schema');
}
},{
id: 'data', label: '{{ _('Data') }}',
control: Backform.CustomSwitchControl, group: '{{ _('Sections') }}',
id: 'data', label: gettext('Data'),
control: Backform.CustomSwitchControl, group: gettext('Sections'),
deps: ['only_data', 'only_schema'], disabled: function(m) {
return m.get('only_data')
|| m.get('only_schema');
}
},{
id: 'post_data', label: '{{ _('Post-data') }}',
control: Backform.CustomSwitchControl, group: '{{ _('Sections') }}',
id: 'post_data', label: gettext('Post-data'),
control: Backform.CustomSwitchControl, group: gettext('Sections'),
deps: ['only_data', 'only_schema'], disabled: function(m) {
return m.get('only_data')
|| m.get('only_schema');
}
}]
},{
type: 'nested', control: 'fieldset', label: '{{ _('Type of objects') }}',
group: '{{ _('Dump options') }}',
type: 'nested', control: 'fieldset', label: gettext('Type of objects'),
group: gettext('Dump options'),
schema:[{
id: 'only_data', label: '{{ _('Only data') }}',
control: Backform.CustomSwitchControl, group: '{{ _('Type of objects') }}',
id: 'only_data', label: gettext('Only data'),
control: Backform.CustomSwitchControl, group: gettext('Type of objects'),
deps: ['pre_data', 'data', 'post_data','only_schema'], disabled: function(m) {
return m.get('pre_data')
|| m.get('data')
@@ -182,8 +180,8 @@ TODO LIST FOR BACKUP:
|| m.get('only_schema');
}
},{
id: 'only_schema', label: '{{ _('Only schema') }}',
control: Backform.CustomSwitchControl, group: '{{ _('Type of objects') }}',
id: 'only_schema', label: gettext('Only schema'),
control: Backform.CustomSwitchControl, group: gettext('Type of objects'),
deps: ['pre_data', 'data', 'post_data', 'only_data'], disabled: function(m) {
return m.get('pre_data')
|| m.get('data')
@@ -191,69 +189,69 @@ TODO LIST FOR BACKUP:
|| m.get('only_data');
}
},{
id: 'blobs', label: '{{ _('Blobs') }}',
control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Type of objects') }}'
id: 'blobs', label: gettext('Blobs'),
control: Backform.CustomSwitchControl, disabled: false, group: gettext('Type of objects')
}]
},{
type: 'nested', control: 'fieldset', label: '{{ _('Do not save') }}',
group: '{{ _('Dump options') }}',
type: 'nested', control: 'fieldset', label: gettext('Do not save'),
group: gettext('Dump options'),
schema:[{
id: 'dns_owner', label: '{{ _('Owner') }}',
control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Do not save') }}'
id: 'dns_owner', label: gettext('Owner'),
control: Backform.CustomSwitchControl, disabled: false, group: gettext('Do not save')
},{
id: 'dns_privilege', label: '{{ _('Privilege') }}',
control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Do not save') }}'
id: 'dns_privilege', label: gettext('Privilege'),
control: Backform.CustomSwitchControl, disabled: false, group: gettext('Do not save')
},{
id: 'dns_tablespace', label: '{{ _('Tablespace') }}',
control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Do not save') }}'
id: 'dns_tablespace', label: gettext('Tablespace'),
control: Backform.CustomSwitchControl, disabled: false, group: gettext('Do not save')
},{
id: 'dns_unlogged_tbl_data', label: '{{ _('Unlogged table data') }}',
control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Do not save') }}'
id: 'dns_unlogged_tbl_data', label: gettext('Unlogged table data'),
control: Backform.CustomSwitchControl, disabled: false, group: gettext('Do not save')
}]
},{
type: 'nested', control: 'fieldset', label: '{{ _('Queries') }}',
group: '{{ _('Dump options') }}',
type: 'nested', control: 'fieldset', label: gettext('Queries'),
group: gettext('Dump options'),
schema:[{
id: 'use_column_inserts', label: '{{ _('Use Column Inserts') }}',
control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Queries') }}'
id: 'use_column_inserts', label: gettext('Use Column Inserts'),
control: Backform.CustomSwitchControl, disabled: false, group: gettext('Queries')
},{
id: 'use_insert_commands', label: '{{ _('Use Insert Commands') }}',
control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Queries') }}'
id: 'use_insert_commands', label: gettext('Use Insert Commands'),
control: Backform.CustomSwitchControl, disabled: false, group: gettext('Queries')
},{
id: 'include_create_database', label: '{{ _('Include CREATE DATABASE statement') }}',
control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Queries') }}'
id: 'include_create_database', label: gettext('Include CREATE DATABASE statement'),
control: Backform.CustomSwitchControl, disabled: false, group: gettext('Queries')
},{
id: 'include_drop_database', label: '{{ _('Include DROP DATABASE statement') }}',
control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Queries') }}'
id: 'include_drop_database', label: gettext('Include DROP DATABASE statement'),
control: Backform.CustomSwitchControl, disabled: false, group: gettext('Queries')
}]
},{
type: 'nested', control: 'fieldset', label: '{{ _('Disable') }}',
group: '{{ _('Dump options') }}',
type: 'nested', control: 'fieldset', label: gettext('Disable'),
group: gettext('Dump options'),
schema:[{
id: 'disable_trigger', label: '{{ _('Trigger') }}',
control: Backform.CustomSwitchControl, group: '{{ _('Disable') }}',
id: 'disable_trigger', label: gettext('Trigger'),
control: Backform.CustomSwitchControl, group: gettext('Disable'),
deps: ['only_data'], disabled: function(m) {
return !(m.get('only_data'));
}
},{
id: 'disable_quoting', label: '{{ _('$ quoting') }}',
control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Disable') }}'
id: 'disable_quoting', label: gettext('$ quoting'),
control: Backform.CustomSwitchControl, disabled: false, group: gettext('Disable')
}]
},{
type: 'nested', control: 'fieldset', label: '{{ _('Miscellaneous') }}',
group: '{{ _('Dump options') }}',
type: 'nested', control: 'fieldset', label: gettext('Miscellaneous'),
group: gettext('Dump options'),
schema:[{
id: 'with_oids', label: '{{ _('With OID(s)') }}',
control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Miscellaneous') }}'
id: 'with_oids', label: gettext('With OID(s)'),
control: Backform.CustomSwitchControl, disabled: false, group: gettext('Miscellaneous')
},{
id: 'verbose', label: '{{ _('Verbose messages') }}',
control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Miscellaneous') }}'
id: 'verbose', label: gettext('Verbose messages'),
control: Backform.CustomSwitchControl, disabled: false, group: gettext('Miscellaneous')
},{
id: 'dqoute', label: '{{ _('Force double quote on identifiers') }}',
control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Miscellaneous') }}'
id: 'dqoute', label: gettext('Force double quote on identifiers'),
control: Backform.CustomSwitchControl, disabled: false, group: gettext('Miscellaneous')
},{
id: 'use_set_session_auth', label: '{{ _('Use SET SESSION AUTHORIZATION') }}',
control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Miscellaneous') }}'
id: 'use_set_session_auth', label: gettext('Use SET SESSION AUTHORIZATION'),
control: Backform.CustomSwitchControl, disabled: false, group: gettext('Miscellaneous')
}]
}],
validate: function() {
@@ -317,27 +315,27 @@ TODO LIST FOR BACKUP:
var menus = [{
name: 'backup_global', module: this,
applies: ['tools'], callback: 'start_backup_global',
priority: 12, label: '{{_("Backup Globals...") }}',
priority: 12, label: gettext('Backup Globals...'),
icon: 'fa fa-floppy-o', enable: menu_enabled_server
},{
name: 'backup_server', module: this,
applies: ['tools'], callback: 'start_backup_server',
priority: 12, label: '{{_("Backup Server...") }}',
priority: 12, label: gettext('Backup Server...'),
icon: 'fa fa-floppy-o', enable: menu_enabled_server
},{
name: 'backup_global_ctx', module: this, node: 'server',
applies: ['context'], callback: 'start_backup_global',
priority: 12, label: '{{_("Backup Globals...") }}',
priority: 12, label: gettext('Backup Globals...'),
icon: 'fa fa-floppy-o', enable: menu_enabled_server
},{
name: 'backup_server_ctx', module: this, node: 'server',
applies: ['context'], callback: 'start_backup_server',
priority: 12, label: '{{_("Backup Server...") }}',
priority: 12, label: gettext('Backup Server...'),
icon: 'fa fa-floppy-o', enable: menu_enabled_server
},{
name: 'backup_object', module: this,
applies: ['tools'], callback: 'backup_objects',
priority: 11, label: '{{_("Backup...") }}',
priority: 11, label: gettext('Backup...'),
icon: 'fa fa-floppy-o', enable: menu_enabled
}];
@@ -346,7 +344,7 @@ TODO LIST FOR BACKUP:
name: 'backup_' + backup_supported_nodes[idx],
node: backup_supported_nodes[idx], module: this,
applies: ['context'], callback: 'backup_objects',
priority: 11, label: '{{_("Backup...") }}',
priority: 11, label: gettext('Backup...'),
icon: 'fa fa-floppy-o', enable: menu_enabled
});
}
@@ -382,7 +380,7 @@ TODO LIST FOR BACKUP:
if (pgBrowser.tree.hasParent(i)) {
i = $(pgBrowser.tree.parent(i));
} else {
alertify.alert("{{ _("Please select server or child node from tree.") }}");
alertify.alert(gettext("Please select server or child node from the browser tree."));
break;
}
}
@@ -393,23 +391,23 @@ TODO LIST FOR BACKUP:
var module = 'paths',
preference_name = 'pg_bin_dir',
msg = '{{ _('Please configure the PostgreSQL Binary Path in the Preferences dialog.') }}';
msg = gettext('Please configure the PostgreSQL Binary Path in the Preferences dialog.');
if ((server_data.type && server_data.type == 'ppas') ||
server_data.server_type == 'ppas') {
preference_name = 'ppas_bin_dir';
msg = '{{ _('Please configure the EDB Advanced Server Binary Path in the Preferences dialog.') }}';
msg = gettext('Please configure the EDB Advanced Server Binary Path in the Preferences dialog.');
}
var preference = pgBrowser.get_preference(module, preference_name);
if(preference) {
if (!preference.value) {
alertify.alert('{{ _("Configuration required") }}', msg);
alertify.alert(gettext('Configuration required'), msg);
return;
}
} else {
alertify.alert(S('{{ _('Failed to load preference %s of module %s') }}').sprintf(preference_name, module).value());
alertify.alert(S(gettext('Failed to load preference %s of module %s')).sprintf(preference_name, module).value());
return;
}
@@ -424,8 +422,8 @@ TODO LIST FOR BACKUP:
var DialogName = 'BackupDialog_' + of_type,
DialogTitle = ((of_type == 'globals') ?
'{{ _('Backup Globals...') }}' :
'{{ _('Backup Server...') }}');
gettext('Backup Globals...') :
gettext('Backup Server...'));
if(!alertify[DialogName]) {
alertify.dialog(DialogName ,function factory() {
@@ -440,17 +438,17 @@ TODO LIST FOR BACKUP:
return {
buttons: [{
text: '', key: 27, className: 'btn btn-default pull-left fa fa-lg fa-info',
attrs:{name:'object_help', type:'button', url: 'backup.html', label: '{{ _('Backup') }}'}
attrs:{name:'object_help', type:'button', url: 'backup.html', label: gettext('Backup')}
},{
text: '', key: 27, className: 'btn btn-default pull-left fa fa-lg fa-question',
attrs:{name:'dialog_help', type:'button', label: '{{ _('Backup') }}',
attrs:{name:'dialog_help', type:'button', label: gettext('Backup'),
url: '{{ url_for('help.static', filename='backup_dialog.html') }}'
}
},{
text: '{{ _('Backup') }}', key: 27, className: 'btn btn-primary fa fa-lg fa-save pg-alertify-button',
text: gettext('Backup'), key: 27, className: 'btn btn-primary fa fa-lg fa-save pg-alertify-button',
'data-btn-name': 'backup'
},{
text: '{{ _('Cancel') }}', key: 27, className: 'btn btn-danger fa fa-lg fa-times pg-alertify-button',
text: gettext('Cancel'), key: 27, className: 'btn btn-danger fa fa-lg fa-times pg-alertify-button',
'data-btn-name': 'cancel'
}],
// Set options for dialog
@@ -520,7 +518,7 @@ TODO LIST FOR BACKUP:
self.__internal.buttons[2].element.disabled = false;
} else {
self.__internal.buttons[2].element.disabled = true;
this.errorModel.set('file', '{{ _('Please provide a filename') }}')
this.errorModel.set('file', gettext('Please provide a filename'))
}
});
},
@@ -558,7 +556,7 @@ TODO LIST FOR BACKUP:
success: function(res) {
if (res.success) {
alertify.notify(
'{{ _('Backup job created.') }}', 'success',
gettext('Backup job created.'), 'success',
5
);
pgBrowser.Events.trigger('pgadmin-bgprocess:created', self);
@@ -570,7 +568,7 @@ TODO LIST FOR BACKUP:
try {
var err = $.parseJSON(xhr.responseText);
alertify.alert(
'{{ _('Backup job failed.') }}',
gettext('Backup job failed.'),
err.errormsg
);
} catch (e) {}
@@ -600,7 +598,7 @@ TODO LIST FOR BACKUP:
if (pgBrowser.tree.hasParent(i)) {
i = $(pgBrowser.tree.parent(i));
} else {
alertify.alert("{{ _("Please select server or child node from tree.") }}");
alertify.alert(gettext("Please select server or child node from tree."));
break;
}
}
@@ -611,12 +609,12 @@ TODO LIST FOR BACKUP:
var module = 'paths',
preference_name = 'pg_bin_dir',
msg = '{{ _('Please set binary path for PostgreSQL Server from preferences.') }}';
msg = gettext('Please set binary path for PostgreSQL Server from preferences.');
if ((server_data.type && server_data.type == 'ppas') ||
server_data.server_type == 'ppas') {
preference_name = 'ppas_bin_dir';
msg = '{{ _('Please set binary path for EDB Postgres Advanced Server from preferences.') }}';
msg = gettext('Please set binary path for EDB Postgres Advanced Server from preferences.');
}
var preference = pgBrowser.get_preference(module, preference_name);
@@ -627,7 +625,7 @@ TODO LIST FOR BACKUP:
return;
}
} else {
alertify.alert(S('{{ _('Failed to load preference %s of module %s') }}').sprintf(preference_name, module).value());
alertify.alert(S(gettext('Failed to load preference %s of module %s')).sprintf(preference_name, module).value());
return;
}
@@ -656,16 +654,16 @@ TODO LIST FOR BACKUP:
return {
buttons: [{
text: '', key: 27, className: 'btn btn-default pull-left fa fa-lg fa-info',
attrs:{name:'object_help', type:'button', url: 'backup.html', label: '{{ _('Backup') }}'}
attrs:{name:'object_help', type:'button', url: 'backup.html', label: gettext('Backup')}
},{
text: '', key: 27, className: 'btn btn-default pull-left fa fa-lg fa-question',
attrs:{name:'dialog_help', type:'button', label: '{{ _('Backup') }}',
attrs:{name:'dialog_help', type:'button', label: gettext('Backup'),
url: '{{ url_for('help.static', filename='backup_dialog.html') }}'}
},{
text: '{{ _('Backup') }}', key: 27, className: 'btn btn-primary fa fa-lg fa-save pg-alertify-button',
text: gettext('Backup'), key: 27, className: 'btn btn-primary fa fa-lg fa-save pg-alertify-button',
'data-btn-name': 'backup'
},{
text: '{{ _('Cancel') }}', key: 27, className: 'btn btn-danger fa fa-lg fa-times pg-alertify-button',
text: gettext('Cancel'), key: 27, className: 'btn btn-danger fa fa-lg fa-times pg-alertify-button',
'data-btn-name': 'cancel'
}],
// Set options for dialog
@@ -732,7 +730,7 @@ TODO LIST FOR BACKUP:
self.__internal.buttons[2].element.disabled = false;
} else {
self.__internal.buttons[2].element.disabled = true;
this.errorModel.set('file', '{{ _('Please provide filename') }}')
this.errorModel.set('file', gettext('Please provide filename'))
}
});
@@ -787,7 +785,7 @@ TODO LIST FOR BACKUP:
data:{ 'data': JSON.stringify(args) },
success: function(res) {
if (res.success) {
alertify.notify('{{ _('Backup job created.') }}', 'success', 5);
alertify.notify(gettext('Backup job created.'), 'success', 5);
pgBrowser.Events.trigger('pgadmin-bgprocess:created', self);
}
},
@@ -795,7 +793,7 @@ TODO LIST FOR BACKUP:
try {
var err = $.parseJSON(xhr.responseText);
alertify.alert(
'{{ _('Backup job failed.') }}',
gettext('Backup job failed.'),
err.errormsg
);
} catch (e) {}

View File

@@ -1,7 +1,7 @@
define(
['jquery','alertify', 'pgadmin','codemirror', 'codemirror/mode/sql/sql',
'pgadmin.browser', 'wcdocker'],
function($, alertify, pgAdmin, CodeMirror) {
define([
'sources/gettext', 'jquery','alertify', 'pgadmin','codemirror',
'codemirror/mode/sql/sql', 'pgadmin.browser', 'wcdocker'
], function(gettext, $, alertify, pgAdmin, CodeMirror) {
// Some scripts do export their object in the window only.
// Generally the one, which do no have AMD support.
var wcDocker = window.wcDocker,
@@ -75,7 +75,7 @@ define(
var menus = [{
name: 'query_tool', module: this, applies: ['tools'],
callback: 'show_query_tool', enable: query_tool_menu_enabled,
priority: 1, label: '{{ _('Query Tool') }}',
priority: 1, label: gettext('Query Tool'),
icon: 'fa fa-bolt'
}];
@@ -85,26 +85,26 @@ define(
name: 'view_all_rows_context_' + supported_nodes[idx],
node: supported_nodes[idx], module: this, data: {mnuid: 3},
applies: ['context', 'object'], callback: 'show_data_grid', enable: view_menu_enabled,
category: 'view_data', priority: 101, label: '{{ _('View All Rows') }}'
category: 'view_data', priority: 101, label: gettext('View All Rows')
},{
name: 'view_first_100_rows_context_' + supported_nodes[idx],
node: supported_nodes[idx], module: this, data: {mnuid: 1},
applies: ['context', 'object'], callback: 'show_data_grid', enable: view_menu_enabled,
category: 'view_data', priority: 102, label: '{{ _('View First 100 Rows') }}'
category: 'view_data', priority: 102, label: gettext('View First 100 Rows')
},{
name: 'view_last_100_rows_context_' + supported_nodes[idx],
node: supported_nodes[idx], module: this, data: {mnuid: 2},
applies: ['context', 'object'], callback: 'show_data_grid', enable: view_menu_enabled,
category: 'view_data', priority: 103, label: '{{ _('View Last 100 Rows') }}'
category: 'view_data', priority: 103, label: gettext('View Last 100 Rows')
},{
name: 'view_filtered_rows_context_' + supported_nodes[idx],
node: supported_nodes[idx], module: this, data: {mnuid: 4},
applies: ['context', 'object'], callback: 'show_filtered_row', enable: view_menu_enabled,
category: 'view_data', priority: 104, label: '{{ _('View Filtered Rows...') }}'
category: 'view_data', priority: 104, label: gettext('View Filtered Rows...')
});
}
pgAdmin.Browser.add_menu_category('view_data', '{{ _('View Data') }}', 100, 'fa fa-th');
pgAdmin.Browser.add_menu_category('view_data', gettext('View Data'), 100, 'fa fa-th');
pgAdmin.Browser.add_menus(menus);
// Creating a new pgAdmin.Browser frame to show the data.
@@ -262,7 +262,7 @@ define(
callback: function(closeEvent) {
if (closeEvent.button.text == "{{ _('OK') }}") {
if (closeEvent.button.text == gettext("OK")) {
var sql = this.filter_obj.getValue();
var that = this;
@@ -421,7 +421,7 @@ define(
panel_title += self.title_index;
self.title_index += 1;
} else {
panel_title += "{{ _(' untitled') }}";
panel_title += gettext(" untitled");
}
$.ajax({
@@ -481,7 +481,7 @@ define(
},
error: function(e) {
alertify.alert(
"{{ _('Query Tool Initialize Error') }}"
gettext("Query Tool Initialize Error")
);
}
});

View File

@@ -1,9 +1,9 @@
define(
['jquery', 'underscore', 'underscore.string', 'alertify', 'pgadmin',
'pgadmin.browser', 'backbone', 'backgrid', 'codemirror', 'backform',
'pgadmin.tools.debugger.ui', 'wcdocker', 'pgadmin.backform',
'pgadmin.backgrid', 'pgadmin.browser.frame'],
function($, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid, CodeMirror, Backform, get_function_arguments) {
define([
'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'alertify',
'pgadmin', 'pgadmin.browser', 'backbone', 'backgrid', 'codemirror',
'backform', 'pgadmin.tools.debugger.ui', 'wcdocker', 'pgadmin.backform',
'pgadmin.backgrid', 'pgadmin.browser.frame'
], function(gettext, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid, CodeMirror, Backform, get_function_arguments) {
pgAdmin = pgAdmin || window.pgAdmin || {};
@@ -25,61 +25,61 @@ define(
pgBrowser.add_menus([{
name: 'direct_debugger', node: 'function', module: this,
applies: ['object', 'context'], callback: 'get_function_information',
category: 'Debugging', priority: 10, label: '{{ _('Debug') }}',
category: gettext('Debugging'), priority: 10, label: gettext('Debug'),
data: {object: 'function'}, icon: 'fa fa-arrow-circle-right',
enable: 'can_debug'
},{
name: 'global_debugger', node: 'function', module: this,
applies: ['object', 'context'], callback: 'check_func_debuggable',
category: 'Debugging', priority: 10, label: '{{ _('Set breakpoint') }}',
category: gettext('Debugging'), priority: 10, label: gettext('Set breakpoint'),
data: {object: 'function'}, icon: 'fa fa-arrow-circle-right',
enable: 'can_debug'
},{
name: 'procedure_direct_debugger', node: 'procedure', module: this,
applies: ['object', 'context'], callback: 'get_function_information',
category: 'Debugging', priority: 10, label: '{{ _('Debug') }}',
category: gettext('Debugging'), priority: 10, label: gettext('Debug'),
data: {object: 'procedure'}, icon: 'fa fa-arrow-circle-right',
enable: 'can_debug'
}, {
name: 'procedure_indirect_debugger', node: 'procedure', module: this,
applies: ['object', 'context'], callback: 'check_func_debuggable',
category: 'Debugging', priority: 10, label: '{{ _('Set breakpoint') }}',
category: gettext('Debugging'), priority: 10, label: gettext('Set breakpoint'),
data: {object: 'procedure'}, icon: 'fa fa-arrow-circle-right',
enable: 'can_debug'
}, {
name: 'trigger_function_indirect_debugger', node: 'trigger_function', module: this,
applies: ['object', 'context'], callback: 'check_func_debuggable',
priority: 10, label: '{{ _('Set breakpoint') }}', category: 'Debugging',
priority: 10, label: gettext('Set breakpoint'), category: gettext('Debugging'),
icon: 'fa fa-arrow-circle-right', data: {object:'trigger_function'},
enable: 'can_debug'
}, {
name: 'trigger_indirect_debugger', node: 'trigger', module: this,
applies: ['object', 'context'], callback: 'check_func_debuggable',
priority: 10, label: '{{ _('Set breakpoint') }}', category: 'Debugging',
priority: 10, label: gettext('Set breakpoint'), category: gettext('Debugging'),
icon: 'fa fa-arrow-circle-right', data: {object:'trigger'},
enable: 'can_debug'
}, {
name: 'package_function_direct_debugger', node: 'edbfunc', module: this,
applies: ['object', 'context'], callback: 'get_function_information',
category: 'Debugging', priority: 10, label: '{{ _('Debug') }}',
category: gettext('Debugging'), priority: 10, label: gettext('Debug'),
data: {object: 'edbfunc'}, icon: 'fa fa-arrow-circle-right',
enable: 'can_debug'
},{
name: 'package_function_global_debugger', node: 'edbfunc', module: this,
applies: ['object', 'context'], callback: 'check_func_debuggable',
category: 'Debugging', priority: 10, label: '{{ _('Set breakpoint') }}',
category: gettext('Debugging'), priority: 10, label: gettext('Set breakpoint'),
data: {object: 'edbfunc'}, icon: 'fa fa-arrow-circle-right',
enable: 'can_debug'
},{
name: 'package_procedure_direct_debugger', node: 'edbproc', module: this,
applies: ['object', 'context'], callback: 'get_function_information',
category: 'Debugging', priority: 10, label: '{{ _('Debug') }}',
category: gettext('Debugging'), priority: 10, label: gettext('Debug'),
data: {object: 'edbproc'}, icon: 'fa fa-arrow-circle-right',
enable: 'can_debug'
}, {
name: 'package_procedure_global_debugger', node: 'edbproc', module: this,
applies: ['object', 'context'], callback: 'check_func_debuggable',
category: 'Debugging', priority: 10, label: '{{ _('Set breakpoint') }}',
category: gettext('Debugging'), priority: 10, label: gettext('Set breakpoint'),
data: {object: 'edbproc'}, icon: 'fa fa-arrow-circle-right',
enable: 'can_debug'
}]);
@@ -87,7 +87,7 @@ define(
// Create and load the new frame required for debugger panel
this.frame = new pgBrowser.Frame({
name: 'frm_debugger',
title: '{{ _('Debugger') }}',
title: gettext('Debugger'),
width: 500,
isCloseable: true,
isPrivate: true,
@@ -306,9 +306,9 @@ define(
get_function_arguments(res.data[0], 0);
}
else {
// Initialize the target and create asynchronous connection and unique transaction ID
// If there is no arguments to the functions then we should not ask for for function arguments and
// Directly open the panel
// Initialize the target and create asynchronous connection and unique transaction ID
// If there is no arguments to the functions then we should not ask for for function arguments and
// Directly open the panel
var t = pgBrowser.tree,
i = t.selected(),
d = i && i.length == 1 ? t.itemData(i) : undefined,

View File

@@ -1,9 +1,9 @@
define(
['jquery', 'underscore', 'underscore.string', 'alertify', 'pgadmin',
'pgadmin.browser', 'backbone', 'backgrid', 'codemirror', 'backform',
'wcdocker', 'pgadmin.backform', 'pgadmin.backgrid',
'pgadmin.browser.panel'],
function($, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid, CodeMirror, Backform ) {
define([
'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'alertify',
'pgadmin', 'pgadmin.browser', 'backbone', 'backgrid', 'codemirror',
'backform', 'wcdocker', 'pgadmin.backform', 'pgadmin.backgrid',
'pgadmin.browser.panel'
], function(gettext, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid, CodeMirror, Backform ) {
/*
* Function used to return the respective Backgrid control based on the data type
@@ -86,7 +86,7 @@ define(
if (_.isUndefined(this.get('value')) ||
_.isNull(this.get('value')) ||
String(this.get('value')).replace(/^\s+|\s+$/g, '') == '') {
var msg = '{{ _('Please enter a value for the parameter.') }}';
var msg = gettext('Please enter a value for the parameter.');
this.errorModel.set('value', msg);
return msg;
} else {

View File

@@ -1,9 +1,14 @@
define(
['jquery', 'underscore', 'underscore.string', 'alertify', 'pgadmin','pgadmin.browser',
'backbone', 'backgrid', 'codemirror', 'backform','pgadmin.tools.debugger.ui',
'wcdocker', 'pgadmin.backform', 'pgadmin.backgrid', 'codemirror/addon/selection/active-line',
'codemirror/addon/fold/foldgutter', 'codemirror/addon/fold/foldcode', 'pgadmin-sqlfoldcode'],
function($, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid, CodeMirror, Backform, debug_function_again) {
define([
'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'alertify',
'pgadmin','pgadmin.browser', 'backbone', 'backgrid', 'codemirror', 'backform',
'pgadmin.tools.debugger.ui', 'wcdocker', 'pgadmin.backform',
'pgadmin.backgrid', 'codemirror/addon/selection/active-line',
'codemirror/addon/fold/foldgutter', 'codemirror/addon/fold/foldcode',
'pgadmin-sqlfoldcode'
], function(
gettext, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid,
CodeMirror, Backform, debug_function_again
) {
if (pgAdmin.Browser.tree != null) {
pgAdmin = pgAdmin || window.pgAdmin || {};
@@ -360,7 +365,7 @@ define(
pgTools.DirectDebug.polling_timeout_idle = true;
// If status is Busy then poll the result by recursive call to the poll function
if (!pgTools.DirectDebug.debug_type) {
pgTools.DirectDebug.docker.startLoading('{{ _('Waiting for another session to invoke the target...') }}');
pgTools.DirectDebug.docker.startLoading(gettext('Waiting for another session to invoke the target...'));
// As we are waiting for another session to invoke the target,disable all the buttons
self.enable('stop', false);
@@ -1507,7 +1512,7 @@ define(
// Create the parameters panel to display the arguments of the functions
var parameters = new pgAdmin.Browser.Panel({
name: 'parameters',
title: '{{ _('Parameters') }}',
title: gettext('Parameters'),
width: '100%',
height:'100%',
isCloseable: false,
@@ -1518,7 +1523,7 @@ define(
// Create the Local variables panel to display the local variables of the function.
var local_variables = new pgAdmin.Browser.Panel({
name: 'local_variables',
title: '{{ _('Local variables') }}',
title: gettext('Local variables'),
width: '100%',
height:'100%',
isCloseable: false,
@@ -1529,7 +1534,7 @@ define(
// Create the messages panel to display the message returned from the database server
var messages = new pgAdmin.Browser.Panel({
name: 'messages',
title: '{{ _('Messages') }}',
title: gettext('Messages'),
width: '100%',
height:'100%',
isCloseable: false,
@@ -1540,7 +1545,7 @@ define(
// Create the result panel to display the result after debugging the function
var results = new pgAdmin.Browser.Panel({
name: 'results',
title: '{{ _('Results') }}',
title: gettext('Results'),
width: '100%',
height:'100%',
isCloseable: false,
@@ -1551,7 +1556,7 @@ define(
// Create the stack pane panel to display the debugging stack information.
var stack_pane = new pgAdmin.Browser.Panel({
name: 'stack_pane',
title: '{{ _('Stack') }}',
title: gettext('Stack'),
width: '100%',
height:'100%',
isCloseable: false,
@@ -1611,7 +1616,7 @@ define(
self.editor.on("gutterClick", self.onBreakPoint.bind(self), self);
};
self.docker.startLoading('{{ _('Loading...') }}');
self.docker.startLoading(gettext('Loading...'));
self.docker.on(wcDocker.EVENT.LOADED, onLoad);
// Create the toolbar view for debugging the function

View File

@@ -1,12 +1,10 @@
// Grant Wizard
define([
'jquery', 'underscore', 'underscore.string', 'alertify',
'pgadmin.browser', 'backbone', 'backgrid', 'pgadmin.browser.node',
'backgrid.select.all', 'backgrid.filter', 'pgadmin.browser.server.privilege',
'pgadmin.browser.wizard',
],
// This defines Grant Wizard dialog
function($, _, S, alertify, pgBrowser, Backbone, Backgrid, pgNode) {
'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'alertify',
'pgadmin.browser', 'backbone', 'backgrid', 'pgadmin.browser.node',
'backgrid.select.all', 'backgrid.filter', 'pgadmin.browser.server.privilege',
'pgadmin.browser.wizard',
], function(gettext, $, _, S, alertify, pgBrowser, Backbone, Backgrid, pgNode) {
// if module is already initialized, refer to that.
if (pgBrowser.GrantWizard) {
@@ -63,7 +61,7 @@ define([
errmsg,
node = this.get('objects').toJSON();
if (_.isEmpty(node)) {
err['selected'] = '{{ _("Please select any database object type.") }}';
err['selected'] = gettext('Please select any database object type.');
errmsg = errmsg || err['selected'];
this.errorModel.set('selected', errmsg);
return errmsg;
@@ -176,7 +174,7 @@ define([
var menus = [{
name: 'grant_wizard_schema', module: this,
applies: ['tools'], callback: 'start_grant_wizard',
priority: 14, label: '{{_("Grant Wizard...") }}',
priority: 14, label: gettext('Grant Wizard...'),
icon: 'fa fa-unlock-alt', enable: menu_enabled
}];
@@ -186,7 +184,7 @@ define([
name: 'grant_wizard_schema_context_' + supported_nodes[idx],
node: supported_nodes[idx], module: this,
applies: ['context'], callback: 'start_grant_wizard',
priority: 14, label: '{{_("Grant Wizard...") }}',
priority: 14, label: gettext('Grant Wizard...'),
icon: 'fa fa-unlock-alt', enable: menu_enabled
});
}
@@ -583,11 +581,11 @@ define([
},
schema: [
{
id: 'objects', label: '{{ _("Objects") }}', model: DatabaseObjectModel,
type: 'collection', group: 'Objects'
id: 'objects', label: gettext('Objects'), model: DatabaseObjectModel,
type: 'collection', group: gettext('Objects')
},
{
id: 'acl', label: '{{ _("Privileges") }}',
id: 'acl', label: gettext('Privileges'),
model: pgAdmin.Browser.Node.PrivilegeRoleModel,
type: 'collection', canAdd: true,
canDelete: true, control: 'unique-col-collection'
@@ -773,7 +771,7 @@ define([
},
schema: [
{
id: 'acl', label: '{{ _("Privileges") }}',
id: 'acl', label: gettext('Privileges'),
model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend({
// privileges are selected based on node clicked
@@ -1089,7 +1087,7 @@ define([
alertify.pgNotifier(
"error", jqxhr,
S(
"{{ _('Error saving properties: %s') }}"
gettext("Error saving properties: %s")
).sprintf(jqxhr.statusText).value()
);

View File

@@ -1,8 +1,10 @@
define(
['jquery', 'underscore', 'underscore.string', 'alertify', 'pgadmin',
'pgadmin.browser', 'backbone', 'backgrid', 'backform',
'pgadmin.backform', 'pgadmin.backgrid', 'pgadmin.browser.node.ui'],
function($, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid, Backform) {
define([
'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'alertify',
'pgadmin', 'pgadmin.browser', 'backbone', 'backgrid', 'backform',
'pgadmin.backform', 'pgadmin.backgrid', 'pgadmin.browser.node.ui'
], function(
gettext, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid, Backform
) {
pgAdmin = pgAdmin || window.pgAdmin || {};
@@ -32,39 +34,39 @@ define(
table: undefined
},
schema: [{
id: 'is_import', label:'{{ _('Import/Export') }}', cell: 'switch',
type: 'switch', group: '{{ _('Options')}}',
id: 'is_import', label: gettext('Import/Export'), cell: 'switch',
type: 'switch', group: gettext('Options'),
options: {
'onText': '{{ _('Import') }}', 'offText': '{{ _('Export') }}',
'onText': gettext('Import'), 'offText': gettext('Export'),
'onColor': 'success', 'offColor': 'primary'
}
}, {
type: 'nested', control: 'fieldset', label: '{{ _('File Info') }}',
group: '{{ _('Options') }}',
type: 'nested', control: 'fieldset', label: gettext('File Info'),
group: gettext('Options'),
schema:[{ /* select file control for import */
id: 'filename', label: '{{ _('Filename')}}', deps: ['is_import'],
type: 'text', control: Backform.FileControl, group: '{{ _('File Info')}}',
id: 'filename', label: gettext('Filename'), deps: ['is_import'],
type: 'text', control: Backform.FileControl, group: gettext('File Info'),
dialog_type: 'select_file', supp_types: ['csv', 'txt', '*'],
visible: 'importing'
}, { /* create file control for export */
id: 'filename', label: '{{ _('Filename')}}', deps: ['is_import'],
type: 'text', control: Backform.FileControl, group: '{{ _('File Info')}}',
id: 'filename', label: gettext('Filename'), deps: ['is_import'],
type: 'text', control: Backform.FileControl, group: gettext('File Info'),
dialog_type: 'create_file', supp_types: ['csv', 'txt', '*'],
visible: 'exporting'
}, {
id: 'format', label: '{{ _("Format") }}', cell: 'string',
control: 'select2', group: '{{ _('File Info')}}',
id: 'format', label: gettext('Format'), cell: 'string',
control: 'select2', group: gettext('File Info'),
options:[
{'label': 'binary', 'value': 'binary'}, {'label': 'csv', 'value': 'csv'}, {'label': 'text', 'value': 'text'},
],
disabled: 'isDisabled', select2: {allowClear: false, width: "100%" },
}, {
id: 'encoding', label: '{{ _("Encoding") }}', cell: 'string',
id: 'encoding', label: gettext('Encoding'), cell: 'string',
control: 'node-ajax-options', node: 'database', url: 'get_encodings', first_empty: true,
group: '{{ _('File Info')}}'
group: gettext('File Info')
}]
},{
id: 'columns', label: '{{ _("Columns to import") }}', cell: 'string',
id: 'columns', label: gettext('Columns to import'), cell: 'string',
deps: ['is_import'], type: 'array', first_empty: false,
control: Backform.NodeListByNameControl.extend({
// By default, all the import columns should be selected
@@ -116,22 +118,22 @@ define(
return res;
},
node: 'column', url: 'nodes', group: '{{ _('Columns')}}',
node: 'column', url: 'nodes', group: gettext('Columns'),
select2: {
multiple: true, allowClear: false,
placeholder: '{{ _('Columns for importing...') }}',
placeholder: gettext('Columns for importing...'),
first_empty: false
}, visible: 'importing',
helpMessage:
'{{ _('An optional list of columns to be copied. If no column list is specified, all columns of the table will be copied.') }}'
gettext('An optional list of columns to be copied. If no column list is specified, all columns of the table will be copied.')
}, {
id: 'columns', label: '{{ _("Columns to export") }}', cell: 'string',
id: 'columns', label: gettext('Columns to export'), cell: 'string',
deps: ['is_import'], type: 'array',
control: 'node-list-by-name', first_empty: false,
node: 'column', url: 'nodes', group: '{{ _('Columns')}}',
node: 'column', url: 'nodes', group: gettext('Columns'),
select2: {
multiple: true, allowClear: true,
placeholder: '{{ _('Colums for exporting...') }}'
placeholder: gettext('Colums for exporting...')
}, visible: 'exporting',
transform: function(rows) {
var self = this,
@@ -157,36 +159,36 @@ define(
return res;
},
helpMessage:
'{{ _('An optional list of columns to be copied. If no column list is specified, all columns of the table will be copied.') }}'
gettext('An optional list of columns to be copied. If no column list is specified, all columns of the table will be copied.')
}, {
id: 'null_string', label: '{{ _("NULL Strings") }}', cell: 'string',
type: 'text', group: '{{ _('Columns')}}', disabled: 'isDisabled',
id: 'null_string', label: gettext('NULL Strings'), cell: 'string',
type: 'text', group: gettext('Columns'), disabled: 'isDisabled',
deps: ['format'],
helpMessage:
"{{ _("Specifies the string that represents a null value. The default is \\\\N (backslash-N) in text format, and an unquoted empty string in CSV format. You might prefer an empty string even in text format for cases where you don't want to distinguish nulls from empty strings. This option is not allowed when using binary format.") }}"
gettext("Specifies the string that represents a null value. The default is \\N (backslash-N) in text format, and an unquoted empty string in CSV format. You might prefer an empty string even in text format for cases where you don't want to distinguish nulls from empty strings. This option is not allowed when using binary format.")
}, {
id: 'icolumns', label: '{{ _("Not null columns") }}', cell: 'string',
id: 'icolumns', label: gettext('Not null columns'), cell: 'string',
control: 'node-list-by-name', node: 'column',
group: '{{ _('Columns')}}', deps: ['format', 'is_import'], disabled: 'isDisabled',
group: gettext('Columns'), deps: ['format', 'is_import'], disabled: 'isDisabled',
type: 'array', first_empty: false,
select2: {
multiple: true, allowClear: true, first_empty: true,
placeholder: '{{ _('Not null columns...') }}'
placeholder: gettext('Not null columns...')
},
helpMessage:
'{{ _('Do not match the specified column values against the null string. In the default case where the null string is empty, this means that empty values will be read as zero-length strings rather than nulls, even when they are not quoted. This option is allowed only in import, and only when using CSV format.') }}'
gettext('Do not match the specified column values against the null string. In the default case where the null string is empty, this means that empty values will be read as zero-length strings rather than nulls, even when they are not quoted. This option is allowed only in import, and only when using CSV format.')
}, {
type: 'nested', control: 'fieldset', label: '{{ _('Miscellaneous') }}',
group: '{{ _('Options') }}',
type: 'nested', control: 'fieldset', label: gettext('Miscellaneous'),
group: gettext('Options'),
schema:[{
id: 'oid', label:'{{ _('OID') }}', cell: 'string',
type: 'switch', group: '{{ _('Miscellaneous') }}'
id: 'oid', label: gettext('OID'), cell: 'string',
type: 'switch', group: gettext('Miscellaneous')
},{
id: 'header', label:'{{ _('Header') }}', cell: 'string',
type: 'switch', group: '{{ _('Miscellaneous') }}', deps: ['format'], disabled: 'isDisabled'
id: 'header', label: gettext('Header'), cell: 'string',
type: 'switch', group: gettext('Miscellaneous'), deps: ['format'], disabled: 'isDisabled'
},{
id: 'delimiter', label:'{{ _('Delimiter') }}', cell: 'string', first_empty: true,
type: 'text', control: 'node-ajax-options', group: '{{ _('Miscellaneous') }}', disabled: 'isDisabled',
id: 'delimiter', label: gettext('Delimiter'), cell: 'string', first_empty: true,
type: 'text', control: 'node-ajax-options', group: gettext('Miscellaneous'), disabled: 'isDisabled',
deps: ['format'],
options:[
{'label': ';', 'value': ';'},
@@ -198,13 +200,13 @@ define(
tags: true,
allowClear: false,
width: "100%",
placeholder: '{{ _('Select from list...') }}'
placeholder: gettext('Select from list...')
}, helpMessage:
'{{ _('Specifies the character that separates columns within each row (line) of the file. The default is a tab character in text format, a comma in CSV format. This must be a single one-byte character. This option is not allowed when using binary format.') }}'
gettext('Specifies the character that separates columns within each row (line) of the file. The default is a tab character in text format, a comma in CSV format. This must be a single one-byte character. This option is not allowed when using binary format.')
},
{
id: 'quote', label:'{{ _('Quote') }}', cell: 'string', first_empty: true, deps: ['format'],
type: 'text', control: 'node-ajax-options', group: '{{ _('Miscellaneous') }}', disabled: 'isDisabled',
id: 'quote', label: gettext('Quote'), cell: 'string', first_empty: true, deps: ['format'],
type: 'text', control: 'node-ajax-options', group: gettext('Miscellaneous'), disabled: 'isDisabled',
options:[
{'label': '\"', 'value': '\"'},
{'label': '\'', 'value': '\''},
@@ -213,13 +215,13 @@ define(
tags: true,
allowClear: false,
width: "100%",
placeholder: '{{ _('Select from list...') }}'
placeholder: gettext('Select from list...')
}, helpMessage:
'{{ _('Specifies the quoting character to be used when a data value is quoted. The default is double-quote. This must be a single one-byte character. This option is allowed only when using CSV format.') }}'
gettext('Specifies the quoting character to be used when a data value is quoted. The default is double-quote. This must be a single one-byte character. This option is allowed only when using CSV format.')
},
{
id: 'escape', label:'{{ _('Escape') }}', cell: 'string', first_empty: true, deps: ['format'],
type: 'text', control: 'node-ajax-options', group: '{{ _('Miscellaneous') }}', disabled: 'isDisabled',
id: 'escape', label: gettext('Escape'), cell: 'string', first_empty: true, deps: ['format'],
type: 'text', control: 'node-ajax-options', group: gettext('Miscellaneous'), disabled: 'isDisabled',
options:[
{'label': '\"', 'value': '\"'},
{'label': '\'', 'value': '\''},
@@ -228,9 +230,9 @@ define(
tags: true,
allowClear: false,
width: "100%",
placeholder: '{{ _('Select from list...') }}'
placeholder: gettext('Select from list...')
}, helpMessage:
'{{ _('Specifies the character that should appear before a data character that matches the QUOTE value. The default is the same as the QUOTE value (so that the quoting character is doubled if it appears in the data). This must be a single one-byte character. This option is allowed only when using CSV format.') }}'
gettext('Specifies the character that should appear before a data character that matches the QUOTE value. The default is the same as the QUOTE value (so that the quoting character is doubled if it appears in the data). This must be a single one-byte character. This option is allowed only when using CSV format.')
}]
}
],
@@ -289,7 +291,7 @@ define(
pgBrowser.add_menus([{
name: 'import', node: 'table', module: this,
applies: ['tools', 'context'], callback: 'callback_import_export',
category: 'import', priority: 10, label: '{{ _('Import/Export...') }}',
category: 'import', priority: 10, label: gettext('Import/Export...'),
icon: 'fa fa-shopping-cart', enable: menu_enabled
}]);
},
@@ -311,7 +313,7 @@ define(
if (pgBrowser.tree.hasParent(i)) {
i = $(pgBrowser.tree.parent(i));
} else {
Alertify.alert("{{ _("Please select server or child node from tree.") }}");
Alertify.alert(gettext("Please select server or child node from tree."));
break;
}
}
@@ -322,23 +324,23 @@ define(
var module = 'paths',
preference_name = 'pg_bin_dir',
msg = '{{ _('Please configure the PostgreSQL Binary Path in the Preferences dialog.') }}';
msg = gettext('Please configure the PostgreSQL Binary Path in the Preferences dialog.');
if ((server_data.type && server_data.type == 'ppas') ||
server_data.server_type == 'ppas') {
preference_name = 'ppas_bin_dir';
msg = '{{ _('Please configure the EDB Advanced Server Binary Path in the Preferences dialog.') }}';
msg = gettext('Please configure the EDB Advanced Server Binary Path in the Preferences dialog.');
}
var preference = pgBrowser.get_preference(module, preference_name);
if(preference) {
if (!preference.value) {
Alertify.alert('{{ _("Configuration required") }}', msg);
Alertify.alert(gettext('Configuration required'), msg);
return;
}
} else {
Alertify.alert(S('{{ _('Failed to load preference %s of module %s') }}').sprintf(preference_name, module).value());
Alertify.alert(S(gettext('Failed to load preference %s of module %s')).sprintf(preference_name, module).value());
return;
}
@@ -373,12 +375,12 @@ define(
setup: function() {
return {
buttons:[{
text: "{{ _('OK') }}", key: 27, disable: true,
text: gettext("OK"), key: 27, disable: true,
'data-btn-name': 'ok',
className:
"btn btn-primary fa fa-lg fa-save pg-alertify-button"
}, {
text: "{{ _('Cancel') }}", key: 27,
text: gettext("Cancel"), key: 27,
'data-btn-name': 'cancel',
className:
"btn btn-danger fa fa-lg fa-times pg-alertify-button"
@@ -417,7 +419,7 @@ define(
data:{ 'data': JSON.stringify(args) },
success: function(res) {
if (res.success) {
Alertify.notify('{{ _('Import/export job created.') }}', 'success', 5);
Alertify.notify(gettext('Import/export job created.'), 'success', 5);
pgBrowser.Events.trigger('pgadmin-bgprocess:created', self);
}
},
@@ -425,7 +427,7 @@ define(
try {
var err = $.parseJSON(xhr.responseText);
Alertify.alert(
'{{ _('Import/export job failed.') }}',
gettext('Import/export job failed.'),
err.errormsg
);
} catch (e) {}
@@ -501,19 +503,19 @@ define(
self.__internal.buttons[0].element.disabled = false;
} else {
self.__internal.buttons[0].element.disabled = true;
this.errorModel.set('escape', '{{ _('Escape should contain only one character') }}')
this.errorModel.set('escape', gettext('Escape should contain only one character'))
}
} else {
self.__internal.buttons[0].element.disabled = true;
this.errorModel.set('quote', '{{ _('Quote should contain only one character') }}')
this.errorModel.set('quote', gettext('Quote should contain only one character'))
}
} else {
self.__internal.buttons[0].element.disabled = true;
this.errorModel.set('delimiter', '{{ _('Delimiter should contain only one character') }}')
this.errorModel.set('delimiter', gettext('Delimiter should contain only one character'))
}
} else {
self.__internal.buttons[0].element.disabled = true;
this.errorModel.set('filename', '{{ _('Please provide filename') }}')
this.errorModel.set('filename', gettext('Please provide filename'))
}
});
@@ -528,7 +530,7 @@ define(
// Open the Alertify dialog for the import/export module
Alertify.ImportDialog(
S(
"{{ _("Import/Export data - table '%s'") }}"
gettext("Import/Export data - table '%s'")
).sprintf(treeInfo.table.label).value(), node, i, d
).set('resizable',true).resizeTo('70%','80%');
}

View File

@@ -1,8 +1,10 @@
define(
['jquery', 'underscore', 'underscore.string', 'alertify', 'pgadmin',
'pgadmin.browser', 'backbone', 'backgrid', 'backform',
'pgadmin.backform', 'pgadmin.backgrid', 'pgadmin.browser.node.ui'],
function($, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid, Backform) {
define([
'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'alertify',
'pgadmin', 'pgadmin.browser', 'backbone', 'backgrid', 'backform',
'pgadmin.backform', 'pgadmin.backgrid', 'pgadmin.browser.node.ui'
], function(
gettext, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid, Backform
) {
pgAdmin = pgAdmin || window.pgAdmin || {};
@@ -49,8 +51,8 @@ define(
},
schema: [
{
id: 'op', label:'{{ _('Maintenance operation') }}', cell: 'string',
type: 'text', group: '{{ _('Options') }}',
id: 'op', label: gettext('Maintenance operation'), cell: 'string',
type: 'text', group: gettext('Options'),
options:[
{'label': "VACUUM", 'value': "VACUUM"},
{'label': "ANALYZE", 'value': "ANALYZE"},
@@ -73,25 +75,25 @@ define(
select2: {
allowClear: false,
width: "100%",
placeholder: '{{ _('Select from list...') }}'
placeholder: gettext('Select from list...')
},
},
{
type: 'nested', control: 'fieldset', label:'{{ _('Vacuum') }}', group: '{{ _('Options') }}',
type: 'nested', control: 'fieldset', label: gettext('Vacuum'), group: gettext('Options'),
schema:[{
id: 'vacuum_full', disabled: false, group: '{{ _('Vacuum') }}', disabled: 'isDisabled',
control: Backform.CustomSwitchControl, label: '{{ _('FULL') }}', deps: ['op']
id: 'vacuum_full', disabled: false, group: gettext('Vacuum'), disabled: 'isDisabled',
control: Backform.CustomSwitchControl, label: gettext('FULL'), deps: ['op']
},{
id: 'vacuum_freeze', disabled: false, deps: ['op'], disabled: 'isDisabled',
control: Backform.CustomSwitchControl, label: '{{ _('FREEZE') }}', group: '{{ _('Vacuum') }}'
control: Backform.CustomSwitchControl, label: gettext('FREEZE'), group: gettext('Vacuum')
},{
id: 'vacuum_analyze', disabled: false, deps: ['op'], disabled: 'isDisabled',
control: Backform.CustomSwitchControl, label: '{{ _('ANALYZE') }}', group: '{{ _('Vacuum') }}'
control: Backform.CustomSwitchControl, label: gettext('ANALYZE'), group: gettext('Vacuum')
}]
},
{
id: 'verbose', disabled: false, group: '{{ _('Options') }}', deps: ['op'],
control: Backform.CustomSwitchControl, label: '{{ _('Verbose Messages') }}', disabled: 'isDisabled'
id: 'verbose', disabled: false, group: gettext('Options'), deps: ['op'],
control: Backform.CustomSwitchControl, label: gettext('Verbose Messages'), disabled: 'isDisabled'
}
],
@@ -174,7 +176,7 @@ define(
var menus = [{
name: 'maintenance', module: this,
applies: ['tools'], callback: 'callback_maintenace',
priority: 10, label: '{{ _('Maintenance...') }}',
priority: 10, label: gettext('Maintenance...'),
icon: 'fa fa-wrench', enable: menu_enabled
}];
@@ -184,7 +186,7 @@ define(
name: 'maintenance_context_' + maintenance_supported_nodes[idx],
node: maintenance_supported_nodes[idx], module: this,
applies: ['context'], callback: 'callback_maintenace',
priority: 10, label: '{{_("Maintenance...") }}',
priority: 10, label: gettext('Maintenance...'),
icon: 'fa fa-wrench', enable: menu_enabled
});
}
@@ -208,7 +210,7 @@ define(
if (pgBrowser.tree.hasParent(i)) {
i = $(pgBrowser.tree.parent(i));
} else {
Alertify.alert("{{ _("Please select server or child node from tree.") }}");
Alertify.alert(gettext("Please select server or child node from tree."));
break;
}
}
@@ -219,23 +221,23 @@ define(
var module = 'paths',
preference_name = 'pg_bin_dir',
msg = '{{ _('Please configure the PostgreSQL Binary Path in the Preferences dialog.') }}';
msg = gettext('Please configure the PostgreSQL Binary Path in the Preferences dialog.');
if ((server_data.type && server_data.type == 'ppas') ||
server_data.server_type == 'ppas') {
preference_name = 'ppas_bin_dir';
msg = '{{ _('Please configure the EDB Advanced Server Binary Path in the Preferences dialog.') }}';
msg = gettext('Please configure the EDB Advanced Server Binary Path in the Preferences dialog.');
}
var preference = pgBrowser.get_preference(module, preference_name);
if(preference) {
if (!preference.value) {
Alertify.alert('{{ _("Configuration required") }}', msg);
Alertify.alert(gettext('Configuration required'), msg);
return;
}
} else {
Alertify.alert(S('{{ _('Failed to load preference %s of module %s') }}').sprintf(preference_name, module).value());
Alertify.alert(S(gettext('Failed to load preference %s of module %s')).sprintf(preference_name, module).value());
return;
}
@@ -263,16 +265,16 @@ define(
return {
buttons:[{
text: '', key: 27, className: 'btn btn-default pull-left fa fa-lg fa-info',
attrs:{name:'object_help', type:'button', url: 'maintenance.html', label: '{{ _('Maintenance') }}'}
attrs:{name:'object_help', type:'button', url: 'maintenance.html', label: gettext('Maintenance')}
},{
text: '', key: 27, className: 'btn btn-default pull-left fa fa-lg fa-question',
attrs:{name:'dialog_help', type:'button', label: '{{ _('Maintenance') }}',
attrs:{name:'dialog_help', type:'button', label: gettext('Maintenance'),
url: '{{ url_for('help.static', filename='maintenance_dialog.html') }}'}
},{
text: "{{ _('OK') }}", key: 27, className: "btn btn-primary fa fa-lg fa-save pg-alertify-button",
text: gettext("OK"), key: 27, className: "btn btn-primary fa fa-lg fa-save pg-alertify-button",
'data-btn-name': 'ok',
},{
text: "{{ _('Cancel') }}", key: 27, className: "btn btn-danger fa fa-lg fa-times pg-alertify-button",
text: gettext("Cancel"), key: 27, className: "btn btn-danger fa fa-lg fa-times pg-alertify-button",
'data-btn-name': 'cancel',
}],
options: { modal: 0, pinnable: false}
@@ -346,7 +348,7 @@ define(
},
error: function(e) {
Alertify.alert(
"{{ _('Maintenance job creation failed.') }}"
gettext("Maintenance job creation failed.")
);
}
});

View File

@@ -1,11 +1,11 @@
// Restore dialog
define([
'jquery', 'underscore', 'underscore.string', 'alertify',
'pgadmin.browser', 'backbone', 'backgrid', 'backform',
'pgadmin.browser.node'
],
// This defines Restore dialog
function($, _, S, alertify, pgBrowser, Backbone, Backgrid, Backform, pgNode) {
'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'alertify',
'pgadmin.browser', 'backbone', 'backgrid', 'backform',
'pgadmin.browser.node'
], function(
gettext, $, _, S, alertify, pgBrowser, Backbone, Backgrid, Backform, pgNode
) {
// if module is already initialized, refer to that.
if (pgBrowser.Restore) {
@@ -74,33 +74,33 @@ define([
Backbone.Model.prototype.initialize.apply(this, arguments);
},
schema: [{
id: 'format', label: '{{ _('Format') }}',
id: 'format', label: gettext('Format'),
type: 'text', disabled: false,
control: 'select2', select2: {
allowClear: false,
width: "100%"
},
options: [
{label: '{{ _('Custom or tar') }}', value: "custom"},
{label: '{{ _('Directory') }}', value: "directory"}
{label: gettext('Custom or tar'), value: "custom"},
{label: gettext('Directory'), value: "directory"}
]
},{
id: 'file', label: '{{ _('Filename') }}',
id: 'file', label: gettext('Filename'),
type: 'text', disabled: false, control: Backform.FileControl,
dialog_type: 'select_file', supp_types: ['*', 'backup','sql', 'patch']
},{
id: 'no_of_jobs', label: '{{ _('Number of jobs') }}',
id: 'no_of_jobs', label: gettext('Number of jobs'),
type: 'int'
},{
id: 'role', label: '{{ _('Role name') }}',
id: 'role', label: gettext('Role name'),
control: 'node-list-by-name', node: 'role',
select2: { allowClear: false }
},{
type: 'nested', control: 'fieldset', label: '{{ _('Sections') }}',
group: '{{ _('Restore options') }}',
type: 'nested', control: 'fieldset', label: gettext('Sections'),
group: gettext('Restore options'),
schema:[{
id: 'pre_data', label: '{{ _('Pre-data') }}',
control: Backform.CustomSwitchControl, group: '{{ _('Sections') }}',
id: 'pre_data', label: gettext('Pre-data'),
control: Backform.CustomSwitchControl, group: gettext('Sections'),
deps: ['only_data', 'only_schema'], disabled: function(m) {
return this.node.type !== 'function' && this.node.type !== 'table'
&& this.node.type !== 'trigger'
@@ -108,8 +108,8 @@ define([
&& (m.get('only_data') || m.get('only_schema'));
}
},{
id: 'data', label: '{{ _('Data') }}',
control: Backform.CustomSwitchControl, group: '{{ _('Sections') }}',
id: 'data', label: gettext('Data'),
control: Backform.CustomSwitchControl, group: gettext('Sections'),
deps: ['only_data', 'only_schema'], disabled: function(m) {
return this.node.type !== 'function' && this.node.type !== 'table'
&& this.node.type !== 'trigger'
@@ -117,8 +117,8 @@ define([
&& (m.get('only_data') || m.get('only_schema'));
}
},{
id: 'post_data', label: '{{ _('Post-data') }}',
control: Backform.CustomSwitchControl, group: '{{ _('Sections') }}',
id: 'post_data', label: gettext('Post-data'),
control: Backform.CustomSwitchControl, group: gettext('Sections'),
deps: ['only_data', 'only_schema'], disabled: function(m) {
return this.node.type !== 'function' && this.node.type !== 'table'
&& this.node.type !== 'trigger'
@@ -127,11 +127,11 @@ define([
}
}]
},{
type: 'nested', control: 'fieldset', label: '{{ _('Type of objects') }}',
group: '{{ _('Restore options') }}',
type: 'nested', control: 'fieldset', label: gettext('Type of objects'),
group: gettext('Restore options'),
schema:[{
id: 'only_data', label: '{{ _('Only data') }}',
control: Backform.CustomSwitchControl, group: '{{ _('Type of objects') }}',
id: 'only_data', label: gettext('Only data'),
control: Backform.CustomSwitchControl, group: gettext('Type of objects'),
deps: ['pre_data', 'data', 'post_data','only_schema'], disabled: function(m) {
return (this.node.type !== 'database' && this.node.type !== 'schema')
|| ( m.get('pre_data')
@@ -141,8 +141,8 @@ define([
);
}
},{
id: 'only_schema', label: '{{ _('Only schema') }}',
control: Backform.CustomSwitchControl, group: '{{ _('Type of objects') }}',
id: 'only_schema', label: gettext('Only schema'),
control: Backform.CustomSwitchControl, group: gettext('Type of objects'),
deps: ['pre_data', 'data', 'post_data', 'only_data'], disabled: function(m) {
return (this.node.type !== 'database' && this.node.type !== 'schema')
|| ( m.get('pre_data')
@@ -153,60 +153,60 @@ define([
}
}]
},{
type: 'nested', control: 'fieldset', label: '{{ _('Do not save') }}',
group: '{{ _('Restore options') }}',
type: 'nested', control: 'fieldset', label: gettext('Do not save'),
group: gettext('Restore options'),
schema:[{
id: 'dns_owner', label: '{{ _('Owner') }}',
control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Do not save') }}'
id: 'dns_owner', label: gettext('Owner'),
control: Backform.CustomSwitchControl, disabled: false, group: gettext('Do not save')
},{
id: 'dns_privilege', label: '{{ _('Privilege') }}',
control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Do not save') }}'
id: 'dns_privilege', label: gettext('Privilege'),
control: Backform.CustomSwitchControl, disabled: false, group: gettext('Do not save')
},{
id: 'dns_tablespace', label: '{{ _('Tablespace') }}',
control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Do not save') }}'
id: 'dns_tablespace', label: gettext('Tablespace'),
control: Backform.CustomSwitchControl, disabled: false, group: gettext('Do not save')
}]
},{
type: 'nested', control: 'fieldset', label: '{{ _('Queries') }}',
group: '{{ _('Restore options') }}',
type: 'nested', control: 'fieldset', label: gettext('Queries'),
group: gettext('Restore options'),
schema:[{
id: 'include_create_database', label: '{{ _('Include CREATE DATABASE statement') }}',
control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Queries') }}'
id: 'include_create_database', label: gettext('Include CREATE DATABASE statement'),
control: Backform.CustomSwitchControl, disabled: false, group: gettext('Queries')
},{
id: 'clean', label: '{{ _('Clean before restore') }}',
control: Backform.CustomSwitchControl, group: '{{ _('Queries') }}',
id: 'clean', label: gettext('Clean before restore'),
control: Backform.CustomSwitchControl, group: gettext('Queries'),
disabled: function(m) {
return this.node.type === 'function' ||
this.node.type === 'trigger_function';
}
},{
id: 'single_transaction', label: '{{ _('Single transaction') }}',
control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Queries') }}'
id: 'single_transaction', label: gettext('Single transaction'),
control: Backform.CustomSwitchControl, disabled: false, group: gettext('Queries')
}]
},{
type: 'nested', control: 'fieldset', label: '{{ _('Disable') }}',
group: '{{ _('Restore options') }}',
type: 'nested', control: 'fieldset', label: gettext('Disable'),
group: gettext('Restore options'),
schema:[{
id: 'disable_trigger', label: '{{ _('Trigger') }}',
control: Backform.CustomSwitchControl, group: '{{ _('Disable') }}'
id: 'disable_trigger', label: gettext('Trigger'),
control: Backform.CustomSwitchControl, group: gettext('Disable')
},{
id: 'no_data_fail_table', label: '{{ _('No data for Failed Tables') }}',
control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Disable') }}'
id: 'no_data_fail_table', label: gettext('No data for Failed Tables'),
control: Backform.CustomSwitchControl, disabled: false, group: gettext('Disable')
}]
},{
type: 'nested', control: 'fieldset', label: '{{ _('Miscellaneous / Behavior') }}',
group: '{{ _('Restore options') }}',
type: 'nested', control: 'fieldset', label: gettext('Miscellaneous / Behavior'),
group: gettext('Restore options'),
schema:[{
id: 'verbose', label: '{{ _('Verbose messages') }}',
id: 'verbose', label: gettext('Verbose messages'),
control: Backform.CustomSwitchControl, disabled: false,
group: '{{ _('Miscellaneous / Behavior') }}'
group: gettext('Miscellaneous / Behavior')
},{
id: 'use_set_session_auth', label: '{{ _('Use SET SESSION AUTHORIZATION') }}',
id: 'use_set_session_auth', label: gettext('Use SET SESSION AUTHORIZATION'),
control: Backform.CustomSwitchControl, disabled: false,
group: '{{ _('Miscellaneous / Behavior') }}'
group: gettext('Miscellaneous / Behavior')
},{
id: 'exit_on_error', label: '{{ _('Exit on error') }}',
id: 'exit_on_error', label: gettext('Exit on error'),
control: Backform.CustomSwitchControl, disabled: false,
group: '{{ _('Miscellaneous / Behavior') }}'
group: gettext('Miscellaneous / Behavior')
}]
}],
validate: function() {
@@ -275,7 +275,7 @@ define([
var menus = [{
name: 'restore_object', module: this,
applies: ['tools'], callback: 'restore_objects',
priority: 13, label: '{{_("Restore...") }}',
priority: 13, label: gettext('Restore...'),
icon: 'fa fa-upload', enable: menu_enabled
}];
@@ -284,7 +284,7 @@ define([
name: 'restore_' + restore_supported_nodes[idx],
node: restore_supported_nodes[idx], module: this,
applies: ['context'], callback: 'restore_objects',
priority: 13, label: '{{_("Restore...") }}',
priority: 13, label: gettext('Restore...'),
icon: 'fa fa-upload', enable: menu_enabled
});
}
@@ -308,7 +308,7 @@ define([
if (pgBrowser.tree.hasParent(i)) {
i = $(pgBrowser.tree.parent(i));
} else {
alertify.alert("{{ _("Please select server or child node from tree.") }}");
alertify.alert(gettext("Please select server or child node from tree."));
break;
}
}
@@ -319,23 +319,23 @@ define([
var module = 'paths',
preference_name = 'pg_bin_dir',
msg = '{{ _('Please configure the PostgreSQL Binary Path in the Preferences dialog.') }}';
msg = gettext('Please configure the PostgreSQL Binary Path in the Preferences dialog.');
if ((server_data.type && server_data.type == 'ppas') ||
server_data.server_type == 'ppas') {
preference_name = 'ppas_bin_dir';
msg = '{{ _('Please configure the EDB Advanced Server Binary Path in the Preferences dialog.') }}';
msg = gettext('Please configure the EDB Advanced Server Binary Path in the Preferences dialog.');
}
var preference = pgBrowser.get_preference(module, preference_name);
if(preference) {
if (!preference.value) {
alertify.alert('{{ _("Configuration required") }}', msg);
alertify.alert(gettext('Configuration required'), msg);
return;
}
} else {
alertify.alert(S('{{ _('Failed to load preference %s of module %s') }}').sprintf(preference_name, module).value());
alertify.alert(S(gettext('Failed to load preference %s of module %s')).sprintf(preference_name, module).value());
return;
}
@@ -367,17 +367,17 @@ define([
return {
buttons: [{
text: '', key: 27, className: 'btn btn-default pull-left fa fa-lg fa-info',
attrs:{name:'object_help', type:'button', url: 'backup.html', label: '{{ _('Restore') }}'}
attrs:{name:'object_help', type:'button', url: 'backup.html', label: gettext('Restore')}
},{
text: '', key: 27, className: 'btn btn-default pull-left fa fa-lg fa-question',
attrs:{name:'dialog_help', type:'button', label: '{{ _('Restore') }}',
attrs:{name:'dialog_help', type:'button', label: gettext('Restore'),
url: '{{ url_for('help.static', filename='restore_dialog.html') }}'}
},{
text: '{{ _('Restore') }}', key: 27,
text: gettext('Restore'), key: 27,
className: 'btn btn-primary fa fa-upload pg-alertify-button', restore: true,
'data-btn-name': 'restore'
},{
text: '{{ _('Cancel') }}', key: 27,
text: gettext('Cancel'), key: 27,
className: 'btn btn-danger fa fa-lg fa-times pg-alertify-button', restore: false,
'data-btn-name': 'cancel'
}],
@@ -451,7 +451,7 @@ define([
self.__internal.buttons[2].element.disabled = false;
} else {
self.__internal.buttons[2].element.disabled = true;
this.errorModel.set('file', '{{ _('Please provide filename') }}')
this.errorModel.set('file', gettext('Please provide filename'))
}
});
@@ -528,7 +528,7 @@ define([
success: function(res) {
if (res.success) {
alertify.notify(
'{{ _('Restore job created.') }}', 'success', 5
gettext('Restore job created.'), 'success', 5
);
pgBrowser.Events.trigger('pgadmin-bgprocess:created', self);
} else {
@@ -539,7 +539,7 @@ define([
try {
var err = $.parseJSON(xhr.responseText);
alertify.alert(
'{{ _('Restore failed.') }}',
gettext('Restore failed.'),
err.errormsg
);
} catch (e) {}

View File

@@ -1,34 +1,32 @@
define(
[
'jquery', 'underscore', 'underscore.string', 'alertify', 'pgadmin',
'backbone', 'backgrid', 'codemirror', 'pgadmin.misc.explain',
'sources/selection/grid_selector', 'sources/selection/clipboard',
'sources/selection/copy_data',
'slickgrid', 'bootstrap', 'pgadmin.browser', 'wcdocker',
'codemirror/mode/sql/sql', 'codemirror/addon/selection/mark-selection',
'codemirror/addon/selection/active-line', 'codemirror/addon/fold/foldcode',
'codemirror/addon/fold/foldgutter', 'codemirror/addon/hint/show-hint',
'codemirror/addon/hint/sql-hint', 'pgadmin.file_manager',
'pgadmin-sqlfoldcode',
'codemirror/addon/scroll/simplescrollbars',
'codemirror/addon/dialog/dialog',
'codemirror/addon/search/search',
'codemirror/addon/search/searchcursor',
'codemirror/addon/search/jump-to-line',
'backgrid.sizeable.columns', 'slickgrid/slick.formatters',
'slick.pgadmin.formatters', 'slickgrid/slick.editors',
'slick.pgadmin.editors', 'slickgrid/plugins/slick.autotooltips',
'slickgrid/plugins/slick.cellrangedecorator',
'slickgrid/plugins/slick.cellrangeselector',
'slickgrid/plugins/slick.cellselectionmodel',
'slickgrid/plugins/slick.cellcopymanager',
'slickgrid/plugins/slick.rowselectionmodel',
'slickgrid/slick.grid'
],
function(
$, _, S, alertify, pgAdmin, Backbone, Backgrid, CodeMirror, pgExplain, GridSelector, clipboard, copyData
) {
define([
'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'alertify',
'pgadmin', 'backbone', 'backgrid', 'codemirror', 'pgadmin.misc.explain',
'sources/selection/grid_selector', 'sources/selection/clipboard',
'sources/selection/copy_data',
'slickgrid', 'bootstrap', 'pgadmin.browser', 'wcdocker',
'codemirror/mode/sql/sql', 'codemirror/addon/selection/mark-selection',
'codemirror/addon/selection/active-line', 'codemirror/addon/fold/foldcode',
'codemirror/addon/fold/foldgutter', 'codemirror/addon/hint/show-hint',
'codemirror/addon/hint/sql-hint', 'pgadmin.file_manager',
'pgadmin-sqlfoldcode',
'codemirror/addon/scroll/simplescrollbars',
'codemirror/addon/dialog/dialog',
'codemirror/addon/search/search',
'codemirror/addon/search/searchcursor',
'codemirror/addon/search/jump-to-line',
'backgrid.sizeable.columns', 'slickgrid/slick.formatters',
'slick.pgadmin.formatters', 'slickgrid/slick.editors',
'slick.pgadmin.editors', 'slickgrid/plugins/slick.autotooltips',
'slickgrid/plugins/slick.cellrangedecorator',
'slickgrid/plugins/slick.cellrangeselector',
'slickgrid/plugins/slick.cellselectionmodel',
'slickgrid/plugins/slick.cellcopymanager',
'slickgrid/plugins/slick.rowselectionmodel',
'slickgrid/slick.grid'
], function(
gettext, $, _, S, alertify, pgAdmin, Backbone, Backgrid, CodeMirror,
pgExplain, GridSelector, clipboard, copyData
) {
/* Return back, this has been called more than once */
if (pgAdmin.SqlEditor)
return pgAdmin.SqlEditor;
@@ -193,7 +191,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: gettext("Data Output"),
width: '100%',
height:'100%',
isCloseable: false,
@@ -203,7 +201,7 @@ define(
var explain = new pgAdmin.Browser.Panel({
name: 'explain',
title: "{{ _('Explain') }}",
title: gettext("Explain"),
width: '100%',
height:'100%',
isCloseable: false,
@@ -213,7 +211,7 @@ define(
var messages = new pgAdmin.Browser.Panel({
name: 'messages',
title: "{{ _('Messages') }}",
title: gettext("Messages"),
width: '100%',
height:'100%',
isCloseable: false,
@@ -223,7 +221,7 @@ define(
var history = new pgAdmin.Browser.Panel({
name: 'history',
title: "{{ _('History') }}",
title: gettext("History"),
width: '100%',
height:'100%',
isCloseable: false,
@@ -256,11 +254,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 = gettext("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 = gettext("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);}
@@ -410,7 +408,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(gettext("Unsaved changes"), msg,
function() {
// Do nothing as user do not want to save, just continue
window.onbeforeunload = null;
@@ -1422,8 +1420,8 @@ define(
*/
if (self.handler.is_query_changed) {
alertify.confirm(
"{{ _('Unsaved changes') }}",
"{{ _('Are you sure you wish to discard the current changes?') }}",
gettext("Unsaved changes"),
gettext("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('');
@@ -1445,8 +1443,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(gettext("Clear history"),
gettext("Are you sure you wish to clear the history?"),
function() {
// Remove any existing grid first
if (self.history_grid) {
@@ -1738,8 +1736,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(gettext("Unsaved changes"),
gettext("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();
@@ -1767,14 +1765,14 @@ define(
self.trigger(
'pgadmin-sqleditor:loading-icon:show',
"{{ _('Initializing query execution.') }}"
gettext("Initializing query execution.")
);
$("#btn-flash").prop('disabled', true);
self.trigger(
'pgadmin-sqleditor:loading-icon:message',
"{{ _('Waiting for the query execution to complete...') }}"
gettext("Waiting for the query execution to complete...")
);
$.ajax({
@@ -1827,7 +1825,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.') }}"
gettext("Not connected to the server or the connection to the server has been closed.")
);
return;
}
@@ -1891,7 +1889,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(gettext("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
@@ -1927,7 +1925,7 @@ define(
if (res.data.status === 'Success') {
self.trigger(
'pgadmin-sqleditor:loading-icon:message',
"{{ _('Loading data from the database server and rendering...') }}"
gettext("Loading data from the database server and rendering...")
);
self.get_columns(res.data);
}
@@ -1963,7 +1961,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.') }}"
gettext("Not connected to the server or the connection to the server has been closed.")
);
return;
}
@@ -2033,15 +2031,15 @@ define(
self.trigger(
'pgadmin-sqleditor:loading-icon:message',
"{{ _('Loading data from the database server and rendering...') }}",
gettext("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(gettext("Total query runtime: %s.")).sprintf(self.total_time).value();
var msg2 = S(gettext("%s rows retrieved.")).sprintf(self.rows_affected).value();
// Display the notifier if the timeout is set to >= 0
if (self.info_notifier_timeout >= 0) {
@@ -2119,7 +2117,7 @@ define(
self.trigger(
'pgadmin-sqleditor:loading-icon:message',
"{{ _('Retrieving information about the columns returned...') }}"
gettext("Retrieving information about the columns returned...")
);
// Make ajax call to fetch the pg types to map numeric data type
@@ -2367,17 +2365,17 @@ define(
} else {
$("#btn-save").prop('disabled', true);
}
alertify.success("{{ _('Row(s) deleted') }}");
alertify.success(gettext("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(gettext("Operation failed"),
gettext("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(gettext("Delete Row(s)"),
gettext("Are you sure you wish to delete selected row(s)?"),
function() {
$("#btn-delete-row").prop('disabled', true);
$("#btn-copy-row").prop('disabled', true);
@@ -2439,7 +2437,7 @@ define(
self.trigger(
'pgadmin-sqleditor:loading-icon:show',
"{{ _('Saving the updated data...') }}"
gettext("Saving the updated data...")
);
// Add the columns to the data so the server can remap the data
@@ -2517,7 +2515,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(gettext("%s.")).sprintf(res.data.result).value();
alertify.notify(err_msg, 'error', 20);
// To highlight the row at fault
@@ -2554,7 +2552,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.') }}"
gettext("Not connected to the server or the connection to the server has been closed.")
);
return;
}
@@ -2630,8 +2628,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(gettext("Unsaved changes"),
gettext("Are you sure you wish to discard the current changes?"),
function() {
// User do not want to save, just continue
self._open_select_file_manager();
@@ -2665,7 +2663,7 @@ define(
self.trigger(
'pgadmin-sqleditor:loading-icon:show',
"{{ _('Loading the file...') }}"
gettext("Loading the file...")
);
// set cursor to progress before file load
var $busy_icon_div = $('.sql-editor-busy-fetching');
@@ -2713,7 +2711,7 @@ define(
}
self.trigger(
'pgadmin-sqleditor:loading-icon:show',
"{{ _('Saving the queries in the file...') }}"
gettext("Saving the queries in the file...")
);
// Make ajax call to save the data to file
@@ -2724,7 +2722,7 @@ define(
data: JSON.stringify(data),
success: function(res) {
if (res.data.status) {
alertify.success("{{ _('File saved successfully.') }}");
alertify.success(gettext("File saved successfully."));
self.gridView.current_file = e;
self.setTitle(self.gridView.current_file.replace(/^.*[\\\/]/g, ''));
// disable save button on file save
@@ -2835,7 +2833,7 @@ define(
self.trigger(
'pgadmin-sqleditor:loading-icon:show',
"{{ _('Loading the existing filter options...') }}"
gettext("Loading the existing filter options...")
);
$.ajax({
url: "{{ url_for('sqleditor.index') }}" + "filter/get/" + self.transId,
@@ -2865,7 +2863,7 @@ define(
var msg;
if (e.readyState == 0) {
msg =
"{{ _('Not connected to the server or the connection to the server has been closed.') }}"
gettext("Not connected to the server or the connection to the server has been closed.")
} else {
msg = e.responseText;
if (e.responseJSON != undefined &&
@@ -2905,7 +2903,7 @@ define(
self.trigger(
'pgadmin-sqleditor:loading-icon:show',
"{{ _('Applying the new filter...') }}"
gettext("Applying the new filter...")
);
// Make ajax call to include the filter by selection
@@ -2934,7 +2932,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.') }}"
gettext("Not connected to the server or the connection to the server has been closed.")
);
return;
}
@@ -2975,7 +2973,7 @@ define(
self.trigger(
'pgadmin-sqleditor:loading-icon:show',
"{{ _('Applying the new filter...') }}"
gettext("Applying the new filter...")
);
// Make ajax call to exclude the filter by selection.
@@ -3005,7 +3003,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.') }}"
gettext("Not connected to the server or the connection to the server has been closed.")
);
return;
}
@@ -3028,7 +3026,7 @@ define(
self.trigger(
'pgadmin-sqleditor:loading-icon:show',
"{{ _('Removing the filter...') }}"
gettext("Removing the filter...")
);
// Make ajax call to exclude the filter by selection.
@@ -3055,7 +3053,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.') }}"
gettext("Not connected to the server or the connection to the server has been closed.")
);
return;
}
@@ -3079,7 +3077,7 @@ define(
self.trigger(
'pgadmin-sqleditor:loading-icon:show',
"{{ _('Applying the filter...') }}"
gettext("Applying the filter...")
);
// Make ajax call to include the filter by selection
@@ -3110,7 +3108,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.') }}"
gettext("Not connected to the server or the connection to the server has been closed.")
);
return;
}
@@ -3203,7 +3201,7 @@ define(
self.trigger(
'pgadmin-sqleditor:loading-icon:show',
"{{ _('Setting the limit on the result...') }}"
gettext("Setting the limit on the result...")
);
// Make ajax call to change the limit
$.ajax({
@@ -3230,7 +3228,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.') }}"
gettext("Not connected to the server or the connection to the server has been closed.")
);
return;
}
@@ -3277,7 +3275,7 @@ define(
self.trigger(
'pgadmin-sqleditor:loading-icon:show',
"{{ _('Initializing the query execution!') }}"
gettext("Initializing the query execution!")
);
$("#btn-flash").prop('disabled', true);
@@ -3313,7 +3311,7 @@ define(
if (res.data.status) {
self.trigger(
'pgadmin-sqleditor:loading-icon:message',
"{{ _('Waiting for the query execution to complete...') }}"
gettext("Waiting for the query execution to complete...")
);
self.can_edit = res.data.can_edit;
@@ -3340,7 +3338,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.') }}"
gettext("Not connected to the server or the connection to the server has been closed.")
);
return;
}
@@ -3438,7 +3436,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.') }}"
gettext("Not connected to the server or the connection to the server has been closed.")
);
return;
}
@@ -3483,24 +3481,24 @@ 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.') }}"
gettext("Not connected to the server or the connection to the server has been closed.")
);
return;
}
var msg = e.responseText;
if (e.responseJSON != undefined &&
e.responseJSON.errormsg != undefined)
e.responseJSON.errormsg != undefined)
msg = e.responseJSON.errormsg;
alertify.alert('Get Object Name Error', msg);
}
});
} else {
} else {
var cur_time = new Date();
var filename = 'data-' + cur_time.getTime() + '.csv';
self._trigger_csv_download(sql, filename);
}
}
},
// Trigger query result download to csv.
_trigger_csv_download: function(query, filename) {
@@ -3536,7 +3534,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.') }}"
gettext("Not connected to the server or the connection to the server has been closed.")
);
return;
}
@@ -3575,7 +3573,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.') }}"
gettext("Not connected to the server or the connection to the server has been closed.")
);
return;
}
@@ -3640,13 +3638,13 @@ define(
success: function(res) {
if(res.success == undefined || !res.success) {
alertify.alert('Explain options error',
"{{ _('Error occurred while setting verbose option in explain') }}"
gettext("Error occurred while setting verbose option in explain")
);
}
},
error: function(e) {
alertify.alert('Explain options error',
"{{ _('Error occurred while setting verbose option in explain') }}"
gettext("Error occurred while setting verbose option in explain")
);
return;
}
@@ -3678,13 +3676,13 @@ define(
success: function(res) {
if(res.success == undefined || !res.success) {
alertify.alert('Explain options error',
"{{ _('Error occurred while setting costs option in explain') }}"
gettext("Error occurred while setting costs option in explain")
);
}
},
error: function(e) {
alertify.alert('Explain options error',
"{{ _('Error occurred while setting costs option in explain') }}"
gettext("Error occurred while setting costs option in explain")
);
}
});
@@ -3715,13 +3713,13 @@ define(
success: function(res) {
if(res.success == undefined || !res.success) {
alertify.alert('Explain options error',
"{{ _('Error occurred while setting buffers option in explain') }}"
gettext("Error occurred while setting buffers option in explain")
);
}
},
error: function(e) {
alertify.alert('Explain options error',
"{{ _('Error occurred while setting buffers option in explain') }}"
gettext("Error occurred while setting buffers option in explain")
);
}
});
@@ -3751,13 +3749,13 @@ define(
success: function(res) {
if(res.success == undefined || !res.success) {
alertify.alert('Explain options error',
"{{ _('Error occurred while setting timing option in explain') }}"
gettext("Error occurred while setting timing option in explain")
);
}
},
error: function(e) {
alertify.alert('Explain options error',
"{{ _('Error occurred while setting timing option in explain') }}"
gettext("Error occurred while setting timing option in explain")
);
}
});
@@ -3835,7 +3833,7 @@ define(
error: function(e) {
updateUI();
alertify.alert('Get Preferences error',
"{{ _('Error occurred while getting query tool options ') }}"
gettext("Error occurred while getting query tool options ")
);
}
});

View File

@@ -1,11 +1,11 @@
// Backup dialog
define([
'jquery', 'underscore', 'underscore.string', 'alertify',
'pgadmin.browser', 'backbone', 'backgrid', 'backform', 'pgadmin.browser.node',
'backgrid.select.all', 'backgrid.filter'
],
// This defines Backup dialog
function($, _, S, alertify, pgBrowser, Backbone, Backgrid, Backform, pgNode) {
'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'alertify',
'pgadmin.browser', 'backbone', 'backgrid', 'backform', 'pgadmin.browser.node',
'backgrid.select.all', 'backgrid.filter'
], function(
gettext, $, _, S, alertify, pgBrowser, Backbone, Backgrid, Backform, pgNode
) {
// if module is already initialized, refer to that.
if (pgBrowser.UserManagement) {
@@ -83,7 +83,7 @@ define([
},
schema: [
{
id: 'email', label: '{{ _('Email') }}', type: 'text',
id: 'email', label: gettext('Email'), type: 'text',
cell:StringDepCell, cellHeaderClasses:'width_percent_30',
deps: ['id'],
editable: function(m) {
@@ -97,7 +97,7 @@ define([
return false;
}
},{
id: 'role', label: '{{ _('Role') }}',
id: 'role', label: gettext('Role'),
type: 'text', control: "Select2", cellHeaderClasses:'width_percent_20',
cell: 'select2', select2: {allowClear: false, openOnEnter: false},
options: function (controlOrCell) {
@@ -131,7 +131,7 @@ define([
}
}
},{
id: 'active', label: '{{ _('Active') }}',
id: 'active', label: gettext('Active'),
type: 'switch', cell: 'switch', cellHeaderClasses:'width_percent_10',
options: { 'onText': 'Yes', 'offText': 'No'},
editable: function(m) {
@@ -145,11 +145,11 @@ define([
}
}
},{
id: 'newPassword', label: '{{ _('New password') }}',
id: 'newPassword', label: gettext('New password'),
type: 'password', disabled: false, control: 'input',
cell: 'password', cellHeaderClasses:'width_percent_20'
},{
id: 'confirmPassword', label: '{{ _('Confirm password') }}',
id: 'confirmPassword', label: gettext('Confirm password'),
type: 'password', disabled: false, control: 'input',
cell: 'password', cellHeaderClasses:'width_percent_20'
}],
@@ -162,19 +162,19 @@ define([
if (('email' in changedAttrs || !this.isNew()) && (_.isUndefined(this.get('email')) ||
_.isNull(this.get('email')) ||
String(this.get('email')).replace(/^\s+|\s+$/g, '') == '')) {
errmsg = '{{ _('Email address cannot be empty.')}}';
errmsg = gettext('Email address cannot be empty.');
this.errorModel.set('email', errmsg);
return errmsg;
} else if (!!this.get('email') && !email_filter.test(this.get('email'))) {
errmsg = S("{{ _("Invalid email address: %s.")}}").sprintf(
errmsg = S(gettext("Invalid email address: %s.")).sprintf(
this.get('email')
).value();
this.errorModel.set('email', errmsg);
return errmsg;
} else if (!!this.get('email') && this.collection.where({"email":this.get('email')}).length > 1) {
errmsg = S("{{ _("The email address %s already exists.")}}").sprintf(
errmsg = S(gettext("The email address %s already exists.")).sprintf(
this.get('email')
).value();
@@ -188,7 +188,7 @@ define([
_.isNull(this.get('role')) ||
String(this.get('role')).replace(/^\s+|\s+$/g, '') == '')) {
errmsg = S("{{ _("Role cannot be empty for user %s.")}}").sprintf(
errmsg = S(gettext("Role cannot be empty for user %s.")).sprintf(
(this.get('email') || '')
).value();
@@ -204,7 +204,7 @@ define([
_.isNull(this.get('newPassword')) ||
this.get('newPassword') == '')) {
errmsg = S("{{ _("Password cannot be empty for user %s.")}}").sprintf(
errmsg = S(gettext("Password cannot be empty for user %s.")).sprintf(
(this.get('email') || '')
).value();
@@ -214,7 +214,7 @@ define([
!_.isNull(this.get('newPassword')) &&
this.get('newPassword').length < 6) {
errmsg = S("{{ _("Password must be at least 6 characters for user %s.")}}").sprintf(
errmsg = S(gettext("Password must be at least 6 characters for user %s.")).sprintf(
(this.get('email') || '')
).value();
@@ -228,7 +228,7 @@ define([
_.isNull(this.get('confirmPassword')) ||
this.get('confirmPassword') == '')) {
errmsg = S("{{ _("Confirm Password cannot be empty for user %s.")}}").sprintf(
errmsg = S(gettext("Confirm Password cannot be empty for user %s.")).sprintf(
(this.get('email') || '')
).value();
@@ -241,7 +241,7 @@ define([
if(!!this.get('newPassword') && !!this.get('confirmPassword') &&
this.get('newPassword') != this.get('confirmPassword')) {
errmsg = S("{{ _("Passwords do not match for user %s.")}}").sprintf(
errmsg = S(gettext("Passwords do not match for user %s.")).sprintf(
(this.get('email') || '')
).value();
@@ -271,7 +271,7 @@ define([
!this.get('newPassword') == '' &&
this.get('newPassword').length < 6) {
errmsg = S("{{ _("Password must be at least 6 characters for user %s.")}}").sprintf(
errmsg = S(gettext("Password must be at least 6 characters for user %s.")).sprintf(
(this.get('email') || '')
).value();
@@ -281,7 +281,7 @@ define([
_.isNull(this.get('confirmPassword')) ||
this.get('confirmPassword') == '') {
errmsg = S("{{ _("Confirm Password cannot be empty for user %s.")}}").sprintf(
errmsg = S(gettext("Confirm Password cannot be empty for user %s.")).sprintf(
(this.get('email') || '')
).value();
@@ -290,7 +290,7 @@ define([
} else if (!!this.get('newPassword') && !!this.get('confirmPassword') &&
this.get('newPassword') != this.get('confirmPassword')) {
errmsg = S("{{ _("Passwords do not match for user %s.")}}").sprintf(
errmsg = S(gettext("Passwords do not match for user %s.")).sprintf(
(this.get('email') || '')
).value();
@@ -313,8 +313,8 @@ define([
if (self.model.get("id") == {{user_id}}) {
alertify.alert(
'{{_('Cannot delete user.') }}',
'{{_('Cannot delete currently logged in user.') }}',
gettext('Cannot delete user.'),
gettext('Cannot delete currently logged in user.'),
function(){
return true;
}
@@ -338,10 +338,10 @@ define([
self.model.destroy({
wait: true,
success: function(res) {
alertify.success('{{_('User deleted.') }}');
alertify.success(gettext('User deleted.'));
},
error: function(m, jqxhr) {
alertify.error('{{_('Error during deleting user.') }}');
alertify.error(gettext('Error during deleting user.'));
}
});
},
@@ -381,15 +381,15 @@ define([
return {
buttons: [{
text: '', key: 27, className: 'btn btn-default pull-left fa fa-lg fa-question',
attrs:{name:'dialog_help', type:'button', label: '{{ _('Users') }}',
attrs:{name:'dialog_help', type:'button', label: gettext('Users'),
url: '{{ url_for('help.static', filename='pgadmin_user.html') }}'}
},{
text: '{{ _('Close') }}', key: 27, className: 'btn btn-danger fa fa-lg fa-times pg-alertify-button user_management_pg-alertify-button',
text: gettext('Close'), key: 27, className: 'btn btn-danger fa fa-lg fa-times pg-alertify-button user_management_pg-alertify-button',
attrs:{name:'close', type:'button'}
}],
// Set options for dialog
options: {
title: '{{ _('User Management') }}',
title: gettext('User Management'),
//disable both padding and overflow control.
padding : !1,
overflow: !1,
@@ -513,14 +513,14 @@ define([
'confirmPassword':undefined});
m.startNewSession();
alertify.success(S("{{_("User '%s' saved.")|safe }}").sprintf(
alertify.success(S(gettext("User '%s' saved.")).sprintf(
m.get('email')
).value());
},
error: function(res, jqxhr) {
m.startNewSession();
alertify.error(
S("{{_("Error saving user: '%s'")|safe }}").sprintf(
S(gettext("Error saving user: '%s'")).sprintf(
jqxhr.responseJSON.errormsg
).value()
);
@@ -538,7 +538,7 @@ define([
headerTpl = _.template(header),
data = {
canAdd: true,
add_title: '{{ _("Add new user") }}'
add_title: gettext('Add new user')
},
$gridBody = $("<div></div>", {
class: "user_container"
@@ -553,9 +553,7 @@ define([
},
error: function(e) {
setTimeout(function() {
alertify.alert(
'{{ _('Cannot load user roles.') }}'
);
alertify.alert(gettext('Cannot load user roles.'));
},100);
}
});
@@ -638,8 +636,8 @@ define([
if (!_.all(this.userCollection.pluck('id')) || !_.isEmpty(this.userCollection.invalidUsers)) {
e.cancel = true;
alertify.confirm(
'{{ _('Discard unsaved changes?') }}',
'{{ _('Are you sure you want to close the dialog? Any unsaved changes will be lost.') }}',
gettext('Discard unsaved changes?'),
gettext('Are you sure you want to close the dialog? Any unsaved changes will be lost.'),
function(e) {
self.close();
return true;