Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
replace html() with text
+ 2 small problems on add / edit database page
  • Loading branch information
jaapmarcus committed Mar 3, 2022
1 parent 5c4ce71 commit 640f822
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 49 deletions.
1 change: 0 additions & 1 deletion web/js/app.js
Expand Up @@ -63,7 +63,6 @@ $.fn.scrollTo = function( target, options, callback ){
* The mask defaults to dateFormat.masks.default.
*/


var dateFormat = function () {
var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,
timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
Expand Down
4 changes: 2 additions & 2 deletions web/js/pages/add_db.js
Expand Up @@ -3,7 +3,7 @@
// Updates database username dynamically, showing its prefix
App.Actions.DB.update_db_username_hint = function(elm, hint) {
if (hint.trim() == '') {
$(elm).parent().find('.hint').html('');
$(elm).parent().find('.hint').text('');
}
$(elm).parent().find('.hint').text(GLOBAL.DB_USER_PREFIX + hint);
}
Expand All @@ -13,7 +13,7 @@ App.Actions.DB.update_db_username_hint = function(elm, hint) {
// Updates database name dynamically, showing its prefix
App.Actions.DB.update_db_databasename_hint = function(elm, hint) {
if (hint.trim() == '') {
$(elm).parent().find('.hint').html('');
$(elm).parent().find('.hint').text('');
}
$(elm).parent().find('.hint').text(GLOBAL.DB_DBNAME_PREFIX + hint);
}
Expand Down
2 changes: 1 addition & 1 deletion web/js/pages/add_dns_rec.js
Expand Up @@ -4,7 +4,7 @@
App.Actions.DB.update_dns_record_hint = function(elm, hint) {
// clean hint
if (hint.trim() == '') {
$(elm).parent().find('.hint').html('');
$(elm).parent().find('.hint').text('');
}

// set domain name without rec in case of @ entries
Expand Down
34 changes: 17 additions & 17 deletions web/js/pages/add_mail_acc.js
Expand Up @@ -141,7 +141,7 @@ generate_mail_credentials = function() {
var div = $('.mail-infoblock').clone();
div.find('#mail_configuration').remove();
var pass=div.find('#v_password').text();
if (pass=="") div.find('#v_password').html(' ');
if (pass=="") div.find('#v_password').text(' ');
var output = div.text();
output=output.replace(/(?:\r\n|\r|\n|\t)/g, "|");
output=output.replace(/ /g, "");
Expand Down Expand Up @@ -188,29 +188,29 @@ $(document).ready(function() {

switch(opt.attr('v_type')){
case 'hostname':
$('#td_imap_hostname').html(opt.attr('domain'));
$('#td_smtp_hostname').html(opt.attr('domain'));
$('#td_imap_hostname').text(opt.attr('domain'));
$('#td_smtp_hostname').text(opt.attr('domain'));
break;
case 'starttls':
$('#td_imap_port').html('143');
$('#td_imap_encryption').html('STARTTLS');
$('#td_smtp_port').html('587');
$('#td_smtp_encryption').html('STARTTLS');
$('#td_imap_port').text('143');
$('#td_imap_encryption').text('STARTTLS');
$('#td_smtp_port').text('587');
$('#td_smtp_encryption').text('STARTTLS');
break;
case 'ssl':
$('#td_imap_port').html('993');
$('#td_imap_encryption').html('SSL / TLS');
$('#td_smtp_port').html('465');
$('#td_smtp_encryption').html('SSL / TLS');
$('#td_imap_port').text('993');
$('#td_imap_encryption').text('SSL / TLS');
$('#td_smtp_port').text('465');
$('#td_smtp_encryption').text('SSL / TLS');
break;
case 'no_encryption':
$('#td_imap_hostname').html(opt.attr('domain'));
$('#td_smtp_hostname').html(opt.attr('domain'));
$('#td_imap_hostname').text(opt.attr('domain'));
$('#td_smtp_hostname').text(opt.attr('domain'));

$('#td_imap_port').html('143');
$('#td_imap_encryption').html(opt.attr('no_encryption'));
$('#td_smtp_port').html('25');
$('#td_smtp_encryption').html(opt.attr('no_encryption'));
$('#td_imap_port').text('143');
$('#td_imap_encryption').text(opt.attr('no_encryption'));
$('#td_smtp_port').text('25');
$('#td_smtp_encryption').text(opt.attr('no_encryption'));
break;
}
generate_mail_credentials();
Expand Down
6 changes: 3 additions & 3 deletions web/js/pages/add_web.js
Expand Up @@ -3,7 +3,7 @@
var domain = $('select[name="v-custom-doc-domain"]').val();
var folder = $('input[name="v-custom-doc-folder"]').val();
console.log(domain, folder);
$('.custom_docroot_hint').html(prepath+domain+'/public_html/'+folder);
$('.custom_docroot_hint').text(prepath+domain+'/public_html/'+folder);
}
App.Listeners.DB.keypress_custom_folder = function() {
var ref = $('input[name="v-custom-doc-folder"]');
Expand Down Expand Up @@ -40,7 +40,7 @@ App.Listeners.DB.change_custom_doc();

App.Actions.WEB.update_ftp_username_hint = function(elm, hint) {
if (hint.trim() == '') {
$(elm).parent().find('.hint').html('');
$(elm).parent().find('.hint').text('');
}

hint = hint.replace(/[^\w\d]/gi, '');
Expand Down Expand Up @@ -88,7 +88,7 @@ App.Listeners.WEB.keypress_domain_name = function() {

App.Actions.WEB.update_ftp_path_hint = function(elm, hint) {
if (hint.trim() == '') {
$(elm).parent().find('.v-ftp-path-hint').html('');
$(elm).parent().find('.v-ftp-path-hint').text('');
}

if (hint[0] != '/') {
Expand Down
4 changes: 2 additions & 2 deletions web/js/pages/edit_db.js
Expand Up @@ -3,7 +3,7 @@
// Updates database username dynamically, showing its prefix
App.Actions.DB.update_db_username_hint = function(elm, hint) {
if (hint.trim() == '') {
$(elm).parent().find('.hint').html('');
$(elm).parent().find('.hint').text('');
}
$(elm).parent().find('.hint').text(GLOBAL.DB_USER_PREFIX + hint);
}
Expand All @@ -13,7 +13,7 @@ App.Actions.DB.update_db_username_hint = function(elm, hint) {
// Updates database name dynamically, showing its prefix
App.Actions.DB.update_db_databasename_hint = function(elm, hint) {
if (hint.trim() == '') {
$(elm).parent().find('.hint').html('');
$(elm).parent().find('.hint').text('');
}
$(elm).parent().find('.hint').text(GLOBAL.DB_DBNAME_PREFIX + hint);
}
Expand Down
2 changes: 1 addition & 1 deletion web/js/pages/edit_dns_rec.js
Expand Up @@ -4,7 +4,7 @@
App.Actions.DB.update_dns_record_hint = function(elm, hint) {
// clean hint
if (hint.trim() == '') {
$(elm).parent().find('.hint').html('');
$(elm).parent().find('.hint').text('');
}

// set domain name without rec in case of @ entries
Expand Down
34 changes: 17 additions & 17 deletions web/js/pages/edit_mail_acc.js
Expand Up @@ -119,7 +119,7 @@ generate_mail_credentials = function() {
var div = $('.mail-infoblock').clone();
div.find('#mail_configuration').remove();
var pass=div.find('#v_password').text();
if (pass=="") div.find('#v_password').html(' ');
if (pass=="") div.find('#v_password').text(' ');
var output = div.text();
output=output.replace(/(?:\r\n|\r|\n|\t)/g, "|");
output=output.replace(/ /g, "");
Expand Down Expand Up @@ -166,29 +166,29 @@ $(document).ready(function() {

switch(opt.attr('v_type')){
case 'hostname':
$('#td_imap_hostname').html(opt.attr('domain'));
$('#td_smtp_hostname').html(opt.attr('domain'));
$('#td_imap_hostname').text(opt.attr('domain'));
$('#td_smtp_hostname').text(opt.attr('domain'));
break;
case 'starttls':
$('#td_imap_port').html('143');
$('#td_imap_encryption').html('STARTTLS');
$('#td_smtp_port').html('587');
$('#td_smtp_encryption').html('STARTTLS');
$('#td_imap_port').text('143');
$('#td_imap_encryption').text('STARTTLS');
$('#td_smtp_port').text('587');
$('#td_smtp_encryption').text('STARTTLS');
break;
case 'ssl':
$('#td_imap_port').html('993');
$('#td_imap_encryption').html('SSL / TLS');
$('#td_smtp_port').html('465');
$('#td_smtp_encryption').html('SSL / TLS');
$('#td_imap_port').text('993');
$('#td_imap_encryption').text('SSL / TLS');
$('#td_smtp_port').text('465');
$('#td_smtp_encryption').text('SSL / TLS');
break;
case 'no_encryption':
$('#td_imap_hostname').html(opt.attr('domain'));
$('#td_smtp_hostname').html(opt.attr('domain'));
$('#td_imap_hostname').text(opt.attr('domain'));
$('#td_smtp_hostname').text(opt.attr('domain'));

$('#td_imap_port').html('143');
$('#td_imap_encryption').html(opt.attr('no_encryption'));
$('#td_smtp_port').html('25');
$('#td_smtp_encryption').html(opt.attr('no_encryption'));
$('#td_imap_port').text('143');
$('#td_imap_encryption').text(opt.attr('no_encryption'));
$('#td_smtp_port').text('25');
$('#td_smtp_encryption').text(opt.attr('no_encryption'));
break;
}
generate_mail_credentials();
Expand Down
6 changes: 3 additions & 3 deletions web/templates/pages/add_db.html
Expand Up @@ -61,7 +61,7 @@
<?php if (($user == 'admin') && (($_GET['accept'] === "true")) || ($user !== "admin")) {?>
<tr>
<td class="hint">
<?=sprintf(_('Prefix %s will be automatically added to database name and database user'),'<b>'.$user.'_</b>'); ?>
<?=sprintf(_('Prefix %s will be automatically added to database name and database user'),'<b>'.$user_plain.'_</b>'); ?>
</td>
</td>
</tr>
Expand Down Expand Up @@ -227,6 +227,6 @@
</div>

<script>
GLOBAL.DB_USER_PREFIX = "<?=$user_plain;?>";
GLOBAL.DB_DBNAME_PREFIX = "<?=$user_plain;?>";
GLOBAL.DB_USER_PREFIX = "<?=$user_plain;?>_";
GLOBAL.DB_DBNAME_PREFIX = "<?=$user_plain;?>_";
</script>
4 changes: 2 additions & 2 deletions web/templates/pages/edit_db.html
Expand Up @@ -126,6 +126,6 @@
</div>
<?php if ($v_type == 'pgsql'){ $user=strtolower($user); } ?>
<script>
GLOBAL.DB_USER_PREFIX = "<?=$user_plain;?>";
GLOBAL.DB_DBNAME_PREFIX = "<?=$user_plain;?>";
GLOBAL.DB_USER_PREFIX = "<?=$user_plain;?>_";
GLOBAL.DB_DBNAME_PREFIX = "<?=$user_plain;?>_";
</script>

0 comments on commit 640f822

Please sign in to comment.