mirror of
https://github.com/myvesta/vesta
synced 2025-07-30 11:39:44 -07:00
Added hints for db usernames, similar to ftp usernames
This commit is contained in:
parent
afffd18e01
commit
9aca19d773
5 changed files with 62 additions and 0 deletions
|
@ -44,6 +44,7 @@ var Error = {FATAL: 1, WARNING: 0, NORMAL: -1};
|
|||
//
|
||||
GLOBAL = {};
|
||||
GLOBAL.FTP_USER_PREFIX = 'admin_';
|
||||
GLOBAL.DB_USER_PREFIX = 'admin_';
|
||||
GLOBAL.AJAX_URL = '';
|
||||
|
||||
/**
|
||||
|
@ -77,6 +78,7 @@ var App = {
|
|||
Core: {},
|
||||
// Actions. More widly used funcs
|
||||
Actions: {
|
||||
DB: {},
|
||||
WEB: {}
|
||||
},
|
||||
// Utilities
|
||||
|
@ -88,6 +90,7 @@ var App = {
|
|||
},
|
||||
i18n: {},
|
||||
Listeners: {
|
||||
DB: {},
|
||||
WEB: {}
|
||||
},
|
||||
View:{
|
||||
|
|
23
web/js/pages/add.db.js
Normal file
23
web/js/pages/add.db.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
App.Actions.DB.update_db_username_hint = function(elm, hint) {
|
||||
if (hint.trim() == '') {
|
||||
$(elm).parent().find('.hint').html('');
|
||||
}
|
||||
if (hint.indexOf(GLOBAL.DB_USER_PREFIX) == 0) {
|
||||
hint = hint.slice(GLOBAL.DB_USER_PREFIX.length, hint.length);
|
||||
}
|
||||
$(elm).parent().find('.hint').html(GLOBAL.DB_USER_PREFIX + hint);
|
||||
}
|
||||
|
||||
App.Listeners.DB.keypress_db_username = function() {
|
||||
$('input[name="v_dbuser"]').bind('keypress', function(evt) {
|
||||
clearTimeout(window.frp_usr_tmt);
|
||||
window.frp_usr_tmt = setTimeout(function() {
|
||||
var elm = $(evt.target);
|
||||
App.Actions.DB.update_db_username_hint(elm, $(elm).val());
|
||||
}, 100);
|
||||
});
|
||||
}
|
||||
|
||||
//
|
||||
// Page entry point
|
||||
App.Listeners.DB.keypress_db_username();
|
23
web/js/pages/edit.db.js
Normal file
23
web/js/pages/edit.db.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
App.Actions.DB.update_db_username_hint = function(elm, hint) {
|
||||
if (hint.trim() == '') {
|
||||
$(elm).parent().find('.hint').html('');
|
||||
}
|
||||
if (hint.indexOf(GLOBAL.DB_USER_PREFIX) == 0) {
|
||||
hint = hint.slice(GLOBAL.DB_USER_PREFIX.length, hint.length);
|
||||
}
|
||||
$(elm).parent().find('.hint').html(GLOBAL.DB_USER_PREFIX + hint);
|
||||
}
|
||||
|
||||
App.Listeners.DB.keypress_db_username = function() {
|
||||
$('input[name="v_dbuser"]').bind('keypress', function(evt) {
|
||||
clearTimeout(window.frp_usr_tmt);
|
||||
window.frp_usr_tmt = setTimeout(function() {
|
||||
var elm = $(evt.target);
|
||||
App.Actions.DB.update_db_username_hint(elm, $(elm).val());
|
||||
}, 100);
|
||||
});
|
||||
}
|
||||
|
||||
//
|
||||
// Page entry point
|
||||
App.Listeners.DB.keypress_db_username();
|
|
@ -81,6 +81,7 @@
|
|||
<tr>
|
||||
<td>
|
||||
<input type="text" size="20" class="vst-input" name="v_dbuser" <?php if (!empty($v_dbuser)) echo "value=".$v_dbuser; ?>>
|
||||
<small class="hint"></small>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -182,3 +183,9 @@
|
|||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
GLOBAL.DB_USER_PREFIX = '<?php echo $user; ?>_';
|
||||
</script>
|
||||
<script type="text/javascript" src="/js/pages/add.db.js"></script>
|
||||
|
|
|
@ -83,6 +83,7 @@
|
|||
<tr>
|
||||
<td>
|
||||
<input type="text" size="20" class="vst-input" name="v_dbuser" <?php if (!empty($v_dbuser)) echo "value=".$v_dbuser; ?> disabled>
|
||||
<small class="hint"></small>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -140,3 +141,8 @@
|
|||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
GLOBAL.DB_USER_PREFIX = '<?php echo $user; ?>_';
|
||||
</script>
|
||||
<script type="text/javascript" src="/js/pages/add.db.js"></script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue