diff --git a/web/js/app.js b/web/js/app.js index 0cb06f365..9b3a2fc1d 100644 --- a/web/js/app.js +++ b/web/js/app.js @@ -43,8 +43,9 @@ var Error = {FATAL: 1, WARNING: 0, NORMAL: -1}; // GLOBAL SETTINGS // GLOBAL = {}; -GLOBAL.FTP_USER_PREFIX = 'admin_'; -GLOBAL.DB_USER_PREFIX = 'admin_'; +GLOBAL.FTP_USER_PREFIX = 'admin_'; +GLOBAL.DB_USER_PREFIX = 'admin_'; +GLOBAL.DB_DBNAME_PREFIX = 'admin_'; GLOBAL.AJAX_URL = ''; /** diff --git a/web/js/pages/add.db.js b/web/js/pages/add.db.js index c9c4c2fdc..9c1222199 100644 --- a/web/js/pages/add.db.js +++ b/web/js/pages/add.db.js @@ -8,6 +8,16 @@ App.Actions.DB.update_db_username_hint = function(elm, hint) { $(elm).parent().find('.hint').html(GLOBAL.DB_USER_PREFIX + hint); } +App.Actions.DB.update_db_databasename_hint = function(elm, hint) { + if (hint.trim() == '') { + $(elm).parent().find('.hint').html(''); + } + if (hint.indexOf(GLOBAL.DB_DBNAME_PREFIX) == 0) { + hint = hint.slice(GLOBAL.DB_DBNAME_PREFIX.length, hint.length); + } + $(elm).parent().find('.hint').html(GLOBAL.DB_DBNAME_PREFIX + hint); +} + App.Listeners.DB.keypress_db_username = function() { $('input[name="v_dbuser"]').bind('keypress', function(evt) { clearTimeout(window.frp_usr_tmt); @@ -18,6 +28,17 @@ App.Listeners.DB.keypress_db_username = function() { }); } +App.Listeners.DB.keypress_db_databasename = function() { + $('input[name="v_database"]').bind('keypress', function(evt) { + clearTimeout(window.frp_dbn_tmt); + window.frp_dbn_tmt = setTimeout(function() { + var elm = $(evt.target); + App.Actions.DB.update_db_databasename_hint(elm, $(elm).val()); + }, 100); + }); +} + // // Page entry point App.Listeners.DB.keypress_db_username(); +App.Listeners.DB.keypress_db_databasename(); diff --git a/web/js/pages/edit.db.js b/web/js/pages/edit.db.js index c9c4c2fdc..9c1222199 100644 --- a/web/js/pages/edit.db.js +++ b/web/js/pages/edit.db.js @@ -8,6 +8,16 @@ App.Actions.DB.update_db_username_hint = function(elm, hint) { $(elm).parent().find('.hint').html(GLOBAL.DB_USER_PREFIX + hint); } +App.Actions.DB.update_db_databasename_hint = function(elm, hint) { + if (hint.trim() == '') { + $(elm).parent().find('.hint').html(''); + } + if (hint.indexOf(GLOBAL.DB_DBNAME_PREFIX) == 0) { + hint = hint.slice(GLOBAL.DB_DBNAME_PREFIX.length, hint.length); + } + $(elm).parent().find('.hint').html(GLOBAL.DB_DBNAME_PREFIX + hint); +} + App.Listeners.DB.keypress_db_username = function() { $('input[name="v_dbuser"]').bind('keypress', function(evt) { clearTimeout(window.frp_usr_tmt); @@ -18,6 +28,17 @@ App.Listeners.DB.keypress_db_username = function() { }); } +App.Listeners.DB.keypress_db_databasename = function() { + $('input[name="v_database"]').bind('keypress', function(evt) { + clearTimeout(window.frp_dbn_tmt); + window.frp_dbn_tmt = setTimeout(function() { + var elm = $(evt.target); + App.Actions.DB.update_db_databasename_hint(elm, $(elm).val()); + }, 100); + }); +} + // // Page entry point App.Listeners.DB.keypress_db_username(); +App.Listeners.DB.keypress_db_databasename(); diff --git a/web/templates/admin/add_db.html b/web/templates/admin/add_db.html index 4dfbb545c..bb396fe34 100644 --- a/web/templates/admin/add_db.html +++ b/web/templates/admin/add_db.html @@ -71,6 +71,7 @@ @@ -187,5 +188,6 @@ diff --git a/web/templates/admin/edit_db.html b/web/templates/admin/edit_db.html index d5cafde6b..5bd823cb8 100644 --- a/web/templates/admin/edit_db.html +++ b/web/templates/admin/edit_db.html @@ -73,6 +73,7 @@ @@ -144,5 +145,6 @@ - +