Browse Source

replace html() with text

+ 2 small problems on add / edit database page
Jaap Marcus 4 years ago
parent
commit
640f822d30

+ 0 - 1
web/js/app.js

@@ -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,

+ 2 - 2
web/js/pages/add_db.js

@@ -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);
 }
@@ -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);
 }

+ 1 - 1
web/js/pages/add_dns_rec.js

@@ -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

+ 17 - 17
web/js/pages/add_mail_acc.js

@@ -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, "");
@@ -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();

+ 3 - 3
web/js/pages/add_web.js

@@ -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"]');
@@ -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, '');
@@ -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] != '/') {

+ 2 - 2
web/js/pages/edit_db.js

@@ -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);
 }
@@ -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);
 }

+ 1 - 1
web/js/pages/edit_dns_rec.js

@@ -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

+ 17 - 17
web/js/pages/edit_mail_acc.js

@@ -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, "");
@@ -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();

+ 3 - 3
web/templates/pages/add_db.html

@@ -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>
@@ -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>

+ 2 - 2
web/templates/pages/edit_db.html

@@ -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>