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
This commit is contained in:
zarzuelo 2014-05-30 10:34:21 +00:00
parent 3d04ceaeb8
commit 8932a80bcf
5 changed files with 127 additions and 5 deletions

View File

@ -1,3 +1,14 @@
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
2014-05-30 Sergio Martin <sergio.martin@artica.es>
* general/logon_ok.php

View File

@ -0,0 +1,104 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
/**
* @package General
*/
global $config;
$options = array();
$options['id_user'] = $config['id_user'];
$options['modal'] = true;
$news = get_news($options);
// Clean subject entities
foreach($news as $k => $v) {
$news[$k]['text'] = io_safe_output($v['text']);
$news[$k]['subject'] = io_safe_output($v['subject']);
}
if (!empty($news)) {
$options = array();
$options['id'] = 'news_json';
$options['hidden'] = 1;
$options['content'] = base64_encode(json_encode($news));
html_print_div($options);
}
// Prints news dialog template
echo '<div id="news_dialog" title="" style="display: none;">';
echo '<div style="position:absolute; top:30px; left: 10px; text-align: left; right:0%; height:70px; min-width:560px; width: 95%; margin: 0 auto; border: 1px solid #FFF; line-height: 19px;">';
echo '<span style="display: block; height: 260px; overflow: auto; text-align: justify; padding: 5px 15px 4px 10px; background: #ECECEC; border-radius: 4px;" id="new_text"></span>';
echo '<span style="font-size: 12px; display: block; margin-top: 20px;" id="new_author"></span>';
echo '<span style="font-size: 12px; display: block; font-style: italic;" id="new_timestamp"></span>';
echo '</div>';
echo '<div style="position:absolute; margin: 0 auto; top: 340px; right: 10px; width: 570px">';
echo '<div style="float: right; width: 20%;">';
html_print_submit_button("Ok", 'hide-login-help', false, 'class="ui-button-dialog ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok" style="width:100px;"');
echo '</div>';
echo '</div>';
echo '</div>';
ui_require_javascript_file ('encode_decode_base64');
?>
<script type="text/javascript" language="javascript">
/* <![CDATA[ */
$(document).ready (function () {
var news_raw = Base64.decode($('#news_json').html());
var news = JSON.parse(news_raw);
var inew = 0;
function show_new () {
if (news[inew] != undefined) {
$('#new_text').html(news[inew].text);
$('#new_timestamp').html(news[inew].timestamp);
$('#new_author').html(news[inew].author);
$("#news_dialog").dialog({
resizable: true,
draggable: true,
modal: true,
closeOnEscape: false,
height: 450,
width: 630,
title: news[inew].subject,
overlay: {
opacity: 0.5,
background: "black"
}
});
$('.ui-dialog-titlebar-close').hide();
}
}
$("#submit-hide-login-help").click (function () {
$("#news_dialog" ).dialog('close');
inew++;
show_new ();
});
show_new ();
});
/* ]]> */
</script>

View File

@ -255,12 +255,13 @@ $(document).ready (function () {
}
render_command_preview(original_command);
render_command_recovery_preview(original_command);
$(".fields").keyup (function() {
render_command_preview(original_command);
});
$(".fields_recovery").keyup (function() {
render_command_preview(original_command);
render_command_recovery_preview(original_command);
});
},
"json"

View File

@ -77,7 +77,7 @@ $table->data[0][2] = html_print_input_text ('name', $name, '', 35, 255, true);
$table->colspan[1][1] = 3;
$table->data[1][0] = __('Command');
$table->data[1][0] .= ui_print_help_icon ('alert_macros', true);
$table->data[1][1] = html_print_input_text ('command', $command, '', 80, 255, true);
$table->data[1][1] = html_print_textarea ('command', 8, 30, $command, '', true);
$table->colspan[2][1] = 3;
$table->data[2][0] = __('Description');

View File

@ -1,10 +1,13 @@
var original_command = "";
function parse_alert_command (command, classs) {
classs = 'field';
if (classs == 'recovery') {
classs = 'field_recovery';
classs = 'fields_recovery';
}
else {
classs = 'fields';
}
var nfield = 1;
$('.' + classs).each(function() {
// Only render values different from ''
@ -22,6 +25,9 @@ function parse_alert_command (command, classs) {
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'));
}