2009-01-12 16:17:19 +01:00
|
|
|
var original_command = "";
|
|
|
|
|
2019-01-30 12:27:18 +01:00
|
|
|
function parse_alert_command(command, classs) {
|
|
|
|
if (classs == "recovery") {
|
|
|
|
classs = "fields_recovery";
|
|
|
|
} else {
|
|
|
|
classs = "fields";
|
|
|
|
}
|
|
|
|
|
|
|
|
var nfield = 1;
|
|
|
|
$("." + classs).each(function() {
|
|
|
|
// Only render values different from ''
|
|
|
|
if ($(this).val() == "") {
|
|
|
|
nfield++;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
var field = "_field" + nfield + "_";
|
|
|
|
|
|
|
|
var regex = new RegExp(field, "gi");
|
|
|
|
|
|
|
|
command = command.replace(regex, $(this).val());
|
|
|
|
|
|
|
|
nfield++;
|
|
|
|
});
|
|
|
|
|
|
|
|
return command;
|
2009-01-12 16:17:19 +01:00
|
|
|
}
|
|
|
|
|
2019-01-30 12:27:18 +01:00
|
|
|
function render_command_preview(original_command) {
|
|
|
|
$("#textarea_command_preview").text(
|
|
|
|
parse_alert_command(original_command, "")
|
|
|
|
);
|
2014-05-30 12:34:21 +02:00
|
|
|
}
|
|
|
|
|
2019-01-30 12:27:18 +01:00
|
|
|
function render_command_recovery_preview(original_command) {
|
|
|
|
$("#textarea_command_recovery_preview").text(
|
|
|
|
parse_alert_command(original_command, "recovery")
|
|
|
|
);
|
2009-01-12 16:17:19 +01:00
|
|
|
}
|
2013-07-17 13:12:37 +02:00
|
|
|
|
2019-01-30 12:27:18 +01:00
|
|
|
function render_command_description(command_description) {
|
|
|
|
if (command_description != "") {
|
|
|
|
command_description = "<br>" + command_description;
|
|
|
|
}
|
|
|
|
$("#command_description").html(command_description);
|
2012-05-21 12:28:35 +02:00
|
|
|
}
|