Re: [pgadmin-hackers] Fix for RM1318 [pgadmin4]

2016-06-14 Thread Dave Page
Thanks, applied.

On Mon, Jun 13, 2016 at 7:20 PM, Harshal Dhumal
 wrote:
> Hi,
>
> PFA patch for issue RM1318 with remaining bug fixes.
>
>
> On Mon, Jun 13, 2016 at 8:49 PM, Dave Page  wrote:
>>
>> On Mon, Jun 13, 2016 at 7:25 AM, Harshal Dhumal
>>  wrote:
>> > Hi,
>> >
>> > PFA attached patch for issue RM1318.
>> >
>> >
>> > Issue fixed: Added help buttons on backup, restore, maintenance, user
>> > management dialogs.
>>
>> Thanks - I've committed this as-is, however the following issues
>> should also be fixed:
>>
>> - The help for the User Manager dialogue cannot be used because the
>> dialogue is modal.
>
>
> Changed user dialog to non modal from modal dialog.
>
>>
>>
>> - There's no help button on the Preferences dialogue. It should also
>> be made non-modal so the user can actually use the help once it's
>> displayed.
>
> Added missing help button and also changed dialog to non modal.
>
>
>>
>>
>> Thanks.
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>
>



-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] Fix for RM1318 [pgadmin4]

2016-06-13 Thread Harshal Dhumal
Hi,

PFA patch for issue RM1318 with remaining bug fixes.


On Mon, Jun 13, 2016 at 8:49 PM, Dave Page  wrote:

> On Mon, Jun 13, 2016 at 7:25 AM, Harshal Dhumal
>  wrote:
> > Hi,
> >
> > PFA attached patch for issue RM1318.
> >
> >
> > Issue fixed: Added help buttons on backup, restore, maintenance, user
> > management dialogs.
>
> Thanks - I've committed this as-is, however the following issues
> should also be fixed:
>
> - The help for the User Manager dialogue cannot be used because the
> dialogue is modal.
>

Changed user dialog to non modal from modal dialog.


>
> - There's no help button on the Preferences dialogue. It should also
> be made non-modal so the user can actually use the help once it's
> displayed.
>
Added missing help button and also changed dialog to non modal.



>
> Thanks.
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
diff --git a/web/pgadmin/preferences/templates/preferences/preferences.js b/web/pgadmin/preferences/templates/preferences/preferences.js
index 69053b3..0600a8c 100644
--- a/web/pgadmin/preferences/templates/preferences/preferences.js
+++ b/web/pgadmin/preferences/templates/preferences/preferences.js
@@ -1,8 +1,8 @@
 define(
-  ['jquery', 'alertify', 'pgadmin', 'underscore', 'backform', 'pgadmin.backform'],
+  ['jquery', 'alertify', 'pgadmin', 'underscore', 'backform', 'pgadmin.browser', 'pgadmin.backform'],
 
   // This defines the Preference/Options Dialog for pgAdmin IV.
-  function($, alertify, pgAdmin, _, Backform) {
+  function($, alertify, pgAdmin, _, Backform, pgBrowser) {
 pgAdmin = pgAdmin || window.pgAdmin || {};
 
 /*
@@ -351,12 +351,13 @@ define(
 },
 setup:function(){
   return {
-buttons:[
-  {
+buttons:[{
+text: '', key: 27, className: 'btn btn-default pull-left fa fa-lg fa-question',
+attrs:{name:'dialog_help', type:'button', label: '{{ _('Preferences') }}',
+url: '{{ url_for('help.static', filename='preferences_dialog.html') }}'}
+  },{
 text: "{{ _('OK') }}", key: 13, className: "btn btn-primary fa fa-lg fa-save pg-alertify-button"
-
-  },
-  {
+  },{
 text: "{{ _('Cancel') }}", className: "btn btn-danger fa fa-lg fa-times pg-alertify-button"
   }
 ],
@@ -365,12 +366,20 @@ define(
   padding: !1,
   overflow: !1,
   title: '{{ _('Preferences')|safe }}',
-  closableByDimmer: false
+  closableByDimmer: false,
+  modal:false
 }
   };
 },
-callback: function(closeEvent){
-  if (closeEvent.button.text == "{{ _('OK') }}"){
+callback: function(e){
+  if (e.button.element.name == "dialog_help") {
+  e.cancel = true;
+  pgBrowser.showHelp(e.button.element.name, e.button.element.getAttribute('url'),
+null, null, e.button.element.getAttribute('label'));
+  return;
+   }
+
+  if (e.button.text == "{{ _('OK') }}"){
 preferences.updateAll();
   }
 },
diff --git a/web/pgadmin/tools/user_management/templates/user_management/js/user_management.js b/web/pgadmin/tools/user_management/templates/user_management/js/user_management.js
index 4e01863..9109044 100644
--- a/web/pgadmin/tools/user_management/templates/user_management/js/user_management.js
+++ b/web/pgadmin/tools/user_management/templates/user_management/js/user_management.js
@@ -390,7 +390,7 @@ define([
 //disable both padding and overflow control.
 padding : !1,
 overflow: !1,
-model: 0,
+modal: false,
 resizable: true,
 maximizable: true,
 pinnable: false,

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] Fix for RM1318 [pgadmin4]

2016-06-13 Thread Dave Page
On Mon, Jun 13, 2016 at 7:25 AM, Harshal Dhumal
 wrote:
> Hi,
>
> PFA attached patch for issue RM1318.
>
>
> Issue fixed: Added help buttons on backup, restore, maintenance, user
> management dialogs.

Thanks - I've committed this as-is, however the following issues
should also be fixed:

- The help for the User Manager dialogue cannot be used because the
dialogue is modal.

- There's no help button on the Preferences dialogue. It should also
be made non-modal so the user can actually use the help once it's
displayed.

Thanks.

-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] Fix for RM1318 [pgadmin4]

2016-06-13 Thread Harshal Dhumal
Hi,

PFA attached patch for issue RM1318.


Issue fixed: Added help buttons on backup, restore, maintenance, user
management dialogs.



-- 
*Harshal Dhumal*
*Software Engineer*

EnterpriseDB India: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/browser/__init__.py b/web/pgadmin/browser/__init__.py
index e82b673..8cd356b 100644
--- a/web/pgadmin/browser/__init__.py
+++ b/web/pgadmin/browser/__init__.py
@@ -485,6 +485,15 @@ def index():
 def browser_js():
 layout = get_setting('Browser/Layout', default='')
 snippets = []
+
+prefs = Preferences.module('paths')
+
+pg_help_path_pref = prefs.preference('pg_help_path')
+pg_help_path = pg_help_path_pref.get()
+
+edbas_help_path_pref = prefs.preference('edbas_help_path')
+edbas_help_path = edbas_help_path_pref.get()
+
 for submodule in current_blueprint.submodules:
 snippets.extend(submodule.jssnippets)
 return make_response(
@@ -492,6 +501,8 @@ def browser_js():
 'browser/js/browser.js',
 layout=layout,
 jssnippets=snippets,
+pg_help_path=pg_help_path,
+edbas_help_path=edbas_help_path,
 _=gettext
 ),
 200, {'Content-Type': 'application/x-javascript'})
diff --git a/web/pgadmin/browser/templates/browser/js/browser.js b/web/pgadmin/browser/templates/browser/js/browser.js
index 12ffd6f..91aaa81 100644
--- a/web/pgadmin/browser/templates/browser/js/browser.js
+++ b/web/pgadmin/browser/templates/browser/js/browser.js
@@ -681,10 +681,60 @@ function(require, $, _, S, Bootstrap, pgAdmin, alertify, CodeMirror) {
   // Do nothing as user cancel the operation
 }
   );
+},
+// General function to handle callbacks for object or dialog help.
+showHelp: function(type, url, node, item, label) {
+  if (type == "object_help") {
+// See if we can find an existing panel, if not, create one
+pnlSqlHelp = this.docker.findPanels('pnl_sql_help')[0];
+
+if (pnlSqlHelp == null) {
+  pnlProperties = this.docker.findPanels('properties')[0];
+  this.docker.addPanel('pnl_sql_help', wcDocker.DOCK.STACKED, pnlProperties);
+  pnlSqlHelp = this.docker.findPanels('pnl_sql_help')[0];
+}
+
+// Construct the URL
+server = node.getTreeNodeHierarchy(item).server;
+
+baseUrl = '{{ pg_help_path }}'
+if (server.server_type == 'ppas') {
+  baseUrl = '{{ edbas_help_path }}'
+}
+
+major = Math.floor(server.version / 1)
+minor = Math.floor(server.version / 100) - (major * 100)
+
+baseUrl = baseUrl.replace('$VERSION$', major + '.' + minor)
+if (!S(baseUrl).endsWith('/')) {
+  baseUrl = baseUrl + '/'
+}
+fullUrl = baseUrl+ url;
+// Update the panel
+iframe = $(pnlSqlHelp).data('embeddedFrame');
+pnlSqlHelp.title('Help: '+ label);
+
+pnlSqlHelp.focus();
+iframe.openURL(fullUrl);
+  } else if(type == "dialog_help") {
+// See if we can find an existing panel, if not, create one
+pnlDialogHelp = this.docker.findPanels('pnl_online_help')[0];
+
+if (pnlDialogHelp == null) {
+  pnlProperties = this.docker.findPanels('properties')[0];
+  this.docker.addPanel('pnl_online_help', wcDocker.DOCK.STACKED, pnlProperties);
+  pnlDialogHelp = this.docker.findPanels('pnl_online_help')[0];
+}
+
+// Update the panel
+iframe = $(pnlDialogHelp).data('embeddedFrame');
+
+pnlDialogHelp.focus();
+iframe.openURL(url);
+  }
 }
   });
 
-
   window.onbeforeunload = function(ev) {
 var e = ev || window.event;
 if(onbeforeunload_flag) {
diff --git a/web/pgadmin/static/css/overrides.css b/web/pgadmin/static/css/overrides.css
index 403de28..41ffde0 100755
--- a/web/pgadmin/static/css/overrides.css
+++ b/web/pgadmin/static/css/overrides.css
@@ -1028,7 +1028,7 @@ ul.nav.nav-tabs {
 }
 
 .alertify .ajs-footer .ajs-buttons .ajs-button {
-  min-width: 80px;
+  min-width: 40px;
   min-height: 30px;
 }
 
@@ -1343,4 +1343,4 @@ height: calc(100% - 35px);
 
 .pg-panel-statistics-container > table > thead > tr > th:last-child {
   border-right: 0px;
-}
\ No newline at end of file
+}
diff --git a/web/pgadmin/tools/backup/templates/backup/js/backup.js b/web/pgadmin/tools/backup/templates/backup/js/backup.js
index dcdd2a2..8fff960 100644
--- a/web/pgadmin/tools/backup/templates/backup/js/backup.js
+++ b/web/pgadmin/tools/backup/templates/backup/js/backup.js
@@ -385,6 +385,14 @@ TODO LIST FOR BACKUP:
setup:function() {
 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') }}'}
+