2009-01-12 16:17:19 +01:00
|
|
|
var original_command = "";
|
|
|
|
|
|
|
|
function parse_alert_command (command) {
|
2012-10-29 09:45:06 +01:00
|
|
|
var nfield = 1;
|
|
|
|
$('.fields').each(function() {
|
2012-10-30 17:52:56 +01:00
|
|
|
// Only render values different from ''
|
|
|
|
if($(this).val() == '') {
|
|
|
|
return;
|
|
|
|
}
|
2012-10-29 09:45:06 +01:00
|
|
|
var field = '_field'+nfield+'_';
|
|
|
|
nfield++;
|
|
|
|
var regex = new RegExp(field,"gi");
|
|
|
|
command = command.replace (regex, $(this).val());
|
|
|
|
});
|
2009-01-12 16:17:19 +01:00
|
|
|
|
|
|
|
return command;
|
|
|
|
}
|
|
|
|
|
2012-10-30 17:52:56 +01:00
|
|
|
function render_command_preview (original_command) {
|
2009-01-12 16:17:19 +01:00
|
|
|
$("#textarea_command_preview").text (parse_alert_command (original_command));
|
|
|
|
}
|
2012-05-21 12:28:35 +02:00
|
|
|
function render_command_description (command_description) {
|
|
|
|
if(command_description != '') {
|
|
|
|
command_description = '<br>'+command_description;
|
|
|
|
}
|
|
|
|
$("#command_description").html(command_description);
|
|
|
|
}
|