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;
|
2014-03-05 12:34:05 +01:00
|
|
|
$('.' + classs).each(function() {
|
2012-10-30 17:52:56 +01:00
|
|
|
// Only render values different from ''
|
2013-02-04 11:22:56 +01:00
|
|
|
if ($(this).val() == '') {
|
2012-10-30 17:52:56 +01:00
|
|
|
return;
|
|
|
|
}
|
2013-02-04 11:22:56 +01:00
|
|
|
var field = '_field' + nfield+'_';
|
2012-10-29 09:45:06 +01:00
|
|
|
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));
|
2014-03-05 12:34:05 +01:00
|
|
|
$("#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
|
|
|
|
2012-05-21 12:28:35 +02:00
|
|
|
function render_command_description (command_description) {
|
2013-07-17 13:12:37 +02:00
|
|
|
if (command_description != '') {
|
2012-05-21 12:28:35 +02:00
|
|
|
command_description = '<br>'+command_description;
|
|
|
|
}
|
|
|
|
$("#command_description").html(command_description);
|
|
|
|
}
|