Menu

#1806 HTML tags not working in lang.en

open
nobody
None
1
2019-07-20
2019-07-19
carmean
No

We have installed a new MRBS system 1.7.3 (rather than updating our old one). We copied text from lang.en and some of them show the html tags on the page. I tried \r\n for line breaks but they did not show or work. In an earlier version of MRBS (1.6.1 on the same server) this was not a problem.

$vocab["namebooker"]         = "Contact Person/Lab and\r\n
 Purpose (Seminar or Meeting)";  // 
$vocab["fulldescription"]    = "Full Description:<br>&nbsp;&nbsp;(Number of people,<br>&nbsp;&nbsp;Course Number, Name etc)";//worked in 1.6.1 but shows the tags on the page in 1.7.3

We would also like to put warnings in edit_entry.php to the right of the list of rooms to select from based on the area or room e.g.

if ( $room == 12 ) {
                echo "<br><b>B9111</b> has first priority for departmental seminars, and meetings.<br><br>";
}

if ( $room == 23 ) {
                 echo get_vocab("van_warning");
}

if ( $area == 4 ) {
                echo "<br><b>B8111</b> & <b>B9111</b> have overhead projectors. <br>";
}

Right now I can only figure out how to put them at the top.

Discussion

  • Campbell Morrison

    We copied text from lang.en and some of them show the html tags on the page. I tried \r\n for line breaks but they did not show or work. In an earlier version of MRBS (1.6.1 on the same server) this was not a problem.

    Two points:

    (1) Yes, HTML tags in vocab strings aren't supported anymore for security reasons. However you should be able to achieve what you want by creating a custom CSS file (see systemdefaults.inc.php for how to) and setting a max-width on the label, eg

    .standard fieldset > div > label {
      max-width: 12em;
    }
    

    (2) If you want to change the standard language strings you should really use the $vocab_override config setting, eg

    $vocab_override['en']['namebooker'] = "Contact Person/Lab and Purpose (Seminar or Meeting)";
    

    That way your changes will be preserved when you upgrade to the next version of MRBS.

     
  • Campbell Morrison

    We would also like to put warnings in edit_entry.php to the right of the list of rooms to select from based on the area or room

    You will need to edit the function get_field_rooms() in edit_entry.php and use the new Form classes to add an extra div to the field just before the end, eg

      $div = new ElementDiv();
      $div->setText("B9111 has first priority for departmental seminars, and meetings.");
    
      $field->addElement($div);
    
      return $field;
    

    If you want to get some text in bold then the best thing to do is probably to create an ElementSpan and give it a class which you can style in bold and then put that Element inside the ElementDiv.

    Ideally you'd also want to add something to the JavaScript so that the messages change when you select a different area.

     
MongoDB Logo MongoDB