Fixed the javascript of form editor of module plugin. TICKET: #1854

This commit is contained in:
mdtrooper 2015-02-27 15:07:32 +01:00
parent 1b637a8d13
commit 166c4fe504
1 changed files with 8 additions and 11 deletions

View File

@ -367,6 +367,10 @@ function configure_modules_form () {
$("input[name='throw_unknown_events']").check();
else
$("input[name='throw_unknown_events']").uncheck();
if (data["id_plugin"] != undefined) {
$("#id_plugin").trigger("change");
}
},
"json"
);
@ -580,7 +584,7 @@ function new_macro(prefix) {
function add_macro_field(macro, row_model_id) {
var macro_desc = macro['desc'];
// Change the carriage returns by html returns <br> in help
var macro_help = macro['help'].replace(/&#x0d;/g,"<br>");
var macro_help = macro['help'].replace(/&#x0d;/g, "<br>");
var macro_macro = macro['macro'];
var macro_value = $('<div />').html(macro['value']).text();
var macro_hide = macro['hide'];
@ -592,8 +596,8 @@ function add_macro_field(macro, row_model_id) {
var $macro_field = $('#'+ row_model_id +'_field').clone(true);
// Change attributes to be unique and with identificable class
$macro_field.attr('id',row_id);
$macro_field.attr('class','macro_field');
$macro_field.attr('id', row_id);
$macro_field.attr('class', 'macro_field');
// Get the number of fields already printed
var fields = $('.macro_field').size();
@ -613,17 +617,10 @@ function add_macro_field(macro, row_model_id) {
}
else {
var field_desc = $('#'+row_id).children().eq(0).html();
field_desc = field_desc.replace('macro_desc',macro_desc);
field_desc = field_desc.replace('macro_help',macro_help);
// Get the cloned forced title id and replace for a uniq id
regex = /forced_title_(\w+)/;
var forced_title_id = field_desc.match(regex)[1];
var uniq_id = 'id' + (new Date()).getTime();
field_desc = field_desc.replace(forced_title_id, uniq_id);
field_desc = field_desc.replace(forced_title_id, uniq_id);
$('#'+row_id).children().eq(0).html(field_desc);
}