zarzuelo 6cd21beca0 2014-05-30 Sergio Martin <sergio.martin@artica.es>
* general/news_dialog.php: Missed file in last commit

	* godmode/alerts/configure_alert_action.php
	godmode/alerts/configure_alert_command.php
	include/javascript/pandora_alerts.js: fixed preview
	of commands in action configuration and changed the 
	text input by a textarea in command configuration for
	ticket: #852



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10046 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-05-30 10:34:21 +00:00

40 lines
988 B
JavaScript

var original_command = "";
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() == '') {
return;
}
var field = '_field' + nfield + '_';
nfield++;
var regex = new RegExp(field,"gi");
command = command.replace (regex, $(this).val());
});
return command;
}
function render_command_preview (original_command) {
$("#textarea_command_preview").text (parse_alert_command (original_command, ''));
}
function render_command_recovery_preview (original_command) {
$("#textarea_command_recovery_preview").text (parse_alert_command (original_command, 'recovery'));
}
function render_command_description (command_description) {
if (command_description != '') {
command_description = '<br>'+command_description;
}
$("#command_description").html(command_description);
}