2019-01-02 04:24:12 -06:00
|
|
|
/////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// pgAdmin 4 - PostgreSQL Tools
|
|
|
|
//
|
2021-01-04 04:04:45 -06:00
|
|
|
// Copyright (C) 2013 - 2021, The pgAdmin Development Team
|
2019-01-02 04:24:12 -06:00
|
|
|
// This software is released under the PostgreSQL Licence
|
|
|
|
//
|
|
|
|
//////////////////////////////////////////////////////////////
|
|
|
|
|
2015-06-30 00:51:55 -05:00
|
|
|
define(
|
2019-10-10 01:35:28 -05:00
|
|
|
['jquery', 'alertify', 'sources/pgadmin', 'sources/gettext',
|
2021-06-01 09:48:24 -05:00
|
|
|
'sources/url_for','sources/utils','pgadmin.user_management.current_user',
|
2017-07-18 09:13:16 -05:00
|
|
|
],
|
2021-06-01 09:48:24 -05:00
|
|
|
function($, alertify, pgAdmin, gettext, url_for, commonUtils, current_user) {
|
2015-06-30 00:51:55 -05:00
|
|
|
pgAdmin = pgAdmin || window.pgAdmin || {};
|
2015-01-28 11:56:13 -06:00
|
|
|
|
2015-06-30 00:51:55 -05:00
|
|
|
/* Return back, this has been called more than once */
|
|
|
|
if (pgAdmin.About)
|
2018-01-12 01:29:51 -06:00
|
|
|
return;
|
2015-01-28 09:57:03 -06:00
|
|
|
|
2015-06-30 00:51:55 -05:00
|
|
|
pgAdmin.About = {
|
|
|
|
about_show: function() {
|
|
|
|
if (!alertify.aboutDialog) {
|
|
|
|
alertify.dialog('aboutDialog', function factory() {
|
|
|
|
return {
|
2016-06-20 02:16:30 -05:00
|
|
|
main: function(title, message) {
|
2015-06-30 00:51:55 -05:00
|
|
|
this.set('title', title);
|
|
|
|
this.message = message;
|
|
|
|
},
|
2016-06-20 02:16:30 -05:00
|
|
|
setup: function() {
|
2015-06-30 00:51:55 -05:00
|
|
|
return {
|
2019-01-02 03:35:15 -06:00
|
|
|
buttons:[{ text: gettext('OK'), key: 27,
|
|
|
|
className: 'btn btn-primary fa fa-lg fa-check pg-alertify-button' }],
|
2017-02-27 08:58:22 -06:00
|
|
|
options: {
|
|
|
|
modal: false,
|
|
|
|
resizable: true,
|
|
|
|
maximizable: true,
|
|
|
|
pinnable: false,
|
2018-01-12 01:29:51 -06:00
|
|
|
closableByDimmer: false,
|
|
|
|
},
|
2015-06-30 00:51:55 -05:00
|
|
|
};
|
|
|
|
},
|
2016-06-20 02:16:30 -05:00
|
|
|
build: function() {
|
|
|
|
alertify.pgDialogBuild.apply(this);
|
|
|
|
},
|
2020-03-06 07:17:22 -06:00
|
|
|
hooks:{
|
|
|
|
onshow:function(){
|
2021-06-11 09:00:32 -05:00
|
|
|
var self = this;
|
2020-03-06 07:17:22 -06:00
|
|
|
var container = $(this.elements.footer).find('button:not([disabled])');
|
|
|
|
commonUtils.findAndSetFocus(container);
|
2021-06-11 09:00:32 -05:00
|
|
|
$('#copy_textarea').on('click', function(){
|
|
|
|
//Copy the server configuration details
|
|
|
|
let textarea = document.getElementById('about-textarea');
|
|
|
|
textarea.select();
|
|
|
|
document.execCommand('copy');
|
|
|
|
$('#copy_textarea').text('Copied');
|
|
|
|
});
|
|
|
|
|
|
|
|
$(this.elements.resizeHandle).on('click', function(){
|
|
|
|
// Set the height of the Textarea
|
|
|
|
var height = self.elements.dialog.scrollHeight - 300;
|
|
|
|
if (height < 0)
|
|
|
|
height = self.elements.dialog.scrollHeight - 150;
|
|
|
|
$('#about-textarea').css({'height':height});
|
|
|
|
});
|
2020-03-06 07:17:22 -06:00
|
|
|
},
|
|
|
|
},
|
2015-06-30 00:51:55 -05:00
|
|
|
prepare:function() {
|
|
|
|
this.setContent(this.message);
|
2018-01-12 01:29:51 -06:00
|
|
|
},
|
2015-06-30 00:51:55 -05:00
|
|
|
};
|
|
|
|
});
|
2015-01-28 09:57:03 -06:00
|
|
|
}
|
2015-06-30 00:51:55 -05:00
|
|
|
|
2017-07-18 09:13:16 -05:00
|
|
|
$.get(url_for('about.index'),
|
2019-03-14 10:11:16 -05:00
|
|
|
function(data) {
|
2021-06-01 09:48:24 -05:00
|
|
|
if(!current_user.is_admin && pgAdmin.server_mode){
|
|
|
|
alertify.aboutDialog(
|
|
|
|
gettext('About %s', pgAdmin.Browser.utils.app_name), data
|
|
|
|
).resizeTo(pgAdmin.Browser.stdW.md, 300);
|
|
|
|
}else{
|
|
|
|
alertify.aboutDialog(
|
|
|
|
gettext('About %s', pgAdmin.Browser.utils.app_name), data
|
|
|
|
).resizeTo(750, 470);
|
|
|
|
}
|
2019-03-14 10:11:16 -05:00
|
|
|
});
|
2018-01-12 01:29:51 -06:00
|
|
|
},
|
2015-06-30 00:51:55 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
return pgAdmin.About;
|
|
|
|
});
|