mirror of
https://github.com/myvesta/vesta
synced 2025-07-13 00:23:35 -07:00
Added hint for database name. Similar to ftp and db username feature.
GLOBAL.DB_DBNAME_PREFIX contains user prefix, by default it is set to 'admin_' and replaced by current value inside template
This commit is contained in:
parent
4d0591c343
commit
c04b47d5df
5 changed files with 50 additions and 3 deletions
|
@ -45,6 +45,7 @@ var Error = {FATAL: 1, WARNING: 0, NORMAL: -1};
|
|||
GLOBAL = {};
|
||||
GLOBAL.FTP_USER_PREFIX = 'admin_';
|
||||
GLOBAL.DB_USER_PREFIX = 'admin_';
|
||||
GLOBAL.DB_DBNAME_PREFIX = 'admin_';
|
||||
GLOBAL.AJAX_URL = '';
|
||||
|
||||
/**
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -71,6 +71,7 @@
|
|||
<tr>
|
||||
<td>
|
||||
<input type="text" size="20" class="vst-input" name="v_database" <?php if (!empty($v_database)) echo "value=".$v_database; ?>>
|
||||
<small class="hint"></small>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -187,5 +188,6 @@
|
|||
|
||||
<script type="text/javascript">
|
||||
GLOBAL.DB_USER_PREFIX = '<?php echo $user; ?>_';
|
||||
GLOBAL.DB_DBNAME_PREFIX = '<?php echo $user; ?>_';
|
||||
</script>
|
||||
<script type="text/javascript" src="/js/pages/add.db.js"></script>
|
||||
|
|
|
@ -73,6 +73,7 @@
|
|||
<tr>
|
||||
<td>
|
||||
<input type="text" size="20" class="vst-input" name="v_database" <?php if (!empty($v_database)) echo "value=".$v_database; ?> disabled>
|
||||
<small class="hint"></small>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -144,5 +145,6 @@
|
|||
|
||||
<script type="text/javascript">
|
||||
GLOBAL.DB_USER_PREFIX = '<?php echo $user; ?>_';
|
||||
GLOBAL.DB_DBNAME_PREFIX = '<?php echo $user; ?>_';
|
||||
</script>
|
||||
<script type="text/javascript" src="/js/pages/add.db.js"></script>
|
||||
<script type="text/javascript" src="/js/pages/edit.db.js"></script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue