2013-04-23 Miguel de Dios <miguel.dedios@artica.es>

* godmode/tag/tag.php: fixed the column for large list of emails,
	now it shows a dialog.
	
	Fixes: #3611472
	
	* include/functions_api.php, operation/snmpconsole/snmp_browser.php,
	extensions/ssh_gateway.php: cleaned source code style.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8031 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-04-23 11:02:18 +00:00
parent 327ec4d7b2
commit 85413ab82b
5 changed files with 81 additions and 35 deletions

View File

@ -1,3 +1,13 @@
2013-04-23 Miguel de Dios <miguel.dedios@artica.es>
* godmode/tag/tag.php: fixed the column for large list of emails,
now it shows a dialog.
Fixes: #3611472
* include/functions_api.php, operation/snmpconsole/snmp_browser.php,
extensions/ssh_gateway.php: cleaned source code style.
2013-04-22 Miguel de Dios <miguel.dedios@artica.es> 2013-04-22 Miguel de Dios <miguel.dedios@artica.es>
* operation/users/user_edit.php, include/functions_graph.php: * operation/users/user_edit.php, include/functions_graph.php:

View File

@ -19,7 +19,7 @@ $id_agente = get_parameter ("id_agente");
// This extension is usefull only if the agent has associated IP // This extension is usefull only if the agent has associated IP
$address = agents_get_address($id_agente); $address = agents_get_address($id_agente);
if(!empty($address) || empty($id_agente)) { if (!empty($address) || empty($id_agente)) {
extensions_add_opemode_tab_agent ('ssh_gateway','SSH Gateway','extensions/ssh_gateway/secure_console.png',"ssh_gateway", "v1r1"); extensions_add_opemode_tab_agent ('ssh_gateway','SSH Gateway','extensions/ssh_gateway/secure_console.png',"ssh_gateway", "v1r1");
} }
@ -41,7 +41,7 @@ function ssh_gateway () {
$USER = "<auto>"; $USER = "<auto>";
$id_agente = get_parameter ("id_agente"); $id_agente = get_parameter ("id_agente");
$ip = db_get_sql ("SELECT direccion FROM tagente WHERE id_agente = $id_agente"); $ip = db_get_sql ("SELECT direccion FROM tagente WHERE id_agente = $id_agente");
if ($HOST == "") if ($HOST == "")
@ -51,14 +51,14 @@ function ssh_gateway () {
if ($COMMIT == 1) { if ($COMMIT == 1) {
echo "<h3 class=error>".__("You need to specify a user and a host address")."</h3>"; echo "<h3 class=error>".__("You need to specify a user and a host address")."</h3>";
} }
echo "<form method=post>"; echo "<form method=post>";
echo "<table class=databox cellspacing=4 cellpadding=4>"; echo "<table class=databox cellspacing=4 cellpadding=4>";
echo "<td>".__("Host address")."<td><input type=text size=25 value='$HOST' name=host>"; echo "<td>".__("Host address")."<td><input type=text size=25 value='$HOST' name=host>";
echo "<tr>"; echo "<tr>";
echo "<td>".__("User")."<td><input type=text size=25 value='$USER' name=user>"; echo "<td>".__("User")."<td><input type=text size=25 value='$USER' name=user>";
echo "<tr>"; echo "<tr>";
echo "<td>".__("Port (use 0 for default)")."<td><input type=text size=5 value='$PORT' name=port>"; echo "<td>".__("Port (use 0 for default)")."<td><input type=text size=5 value='$PORT' name=port>";
echo "<tr><td>"; echo "<tr><td>";
echo __("Connect mode")."<td><select name=mode>"; echo __("Connect mode")."<td><select name=mode>";
if ($MODE == "telnet") { if ($MODE == "telnet") {
@ -77,14 +77,15 @@ function ssh_gateway () {
} }
else { else {
if ($MODE == "telnet"){ if ($MODE == "telnet") {
if ($PORT == 0) if ($PORT == 0)
$PORT = 23; $PORT = 23;
} else { }
if ($PORT == 0) else {
$PORT = 22; if ($PORT == 0)
} $PORT = 22;
}
if ($MODE == "ssh") if ($MODE == "ssh")
echo "<iframe style='border: 0px' src='http://".$SERVER_ADDR.":8022/anyterm.html?param=-p $PORT $USER@$HOST' width='100%' height=550>"; echo "<iframe style='border: 0px' src='http://".$SERVER_ADDR.":8022/anyterm.html?param=-p $PORT $USER@$HOST' width='100%' height=550>";
else else

View File

@ -50,7 +50,7 @@ if (is_ajax ()) {
echo '<br>'; echo '<br>';
echo '<strong>'.__('Number of policy modules').': </strong>' . echo '<strong>'.__('Number of policy modules').': </strong>' .
tags_get_policy_modules_count($id_tag); tags_get_policy_modules_count($id_tag);
return; return;
} }
return; return;
@ -76,10 +76,10 @@ if (defined('METACONSOLE')) {
} }
else { else {
// Header // Header
ui_print_page_header (__('Tags configuration'), "images/tag.png", false, "tags_config", true, $buttons); ui_print_page_header (__('Tags configuration'), "images/tag.png", false, "tags_config", true, $buttons);
} }
// Two actions can performed in this page: search and delete tags // Two actions can performed in this page: search and delete tags
@ -181,7 +181,22 @@ if (!empty($result)) {
html_print_image("images/zoom.png", true, array("id" => 'tag-details-'.$tag['id_tag'], "class" => "img_help")) . '</a> '; html_print_image("images/zoom.png", true, array("id" => 'tag-details-'.$tag['id_tag'], "class" => "img_help")) . '</a> ';
$data[3] .= tags_get_modules_count($tag["id_tag"]); $data[3] .= tags_get_modules_count($tag["id_tag"]);
$data[4] = $tag["email"];
$email_large = io_safe_output($tag["email"]);
$email_small = substr($email_large,0, 24);
if ($email_large == $email_small) {
$output = $email_large;
}
else {
$output =
"<div title='" . sprintf(__('Emails for the tag: %s'), $tag['name']) . "' style='display: none;' class='email_large' id='email_large_" . $tag["id_tag"] . "'>" .
$email_large . "</div>" .
'<span id="value_' . $tag["id_tag"] . '">' .
$email_small . '</span> ' .
"<a href='javascript: show_dialog(" . $tag["id_tag"] . ")'>" . html_print_image("images/rosette.png", true) . "" . "</a></span>";
}
$data[4] = $output;
$data[5] = "<a href='index.php?sec=".$sec."&sec2=godmode/tag/edit_tag&action=update&id_tag=".$tag["id_tag"] . "'>" . html_print_image("images/config.png", true, array("title" => "Edit")) . "</a>&nbsp;&nbsp;"; $data[5] = "<a href='index.php?sec=".$sec."&sec2=godmode/tag/edit_tag&action=update&id_tag=".$tag["id_tag"] . "'>" . html_print_image("images/config.png", true, array("title" => "Edit")) . "</a>&nbsp;&nbsp;";
$data[5] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/tag/tag&delete_tag='.$tag["id_tag"] . '"onclick="if (! confirm (\''.__('Are you sure?').'\')) return false">' . html_print_image("images/cross.png", true, array("title" => "Delete")) . '</a>'; $data[5] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/tag/tag&delete_tag='.$tag["id_tag"] . '"onclick="if (! confirm (\''.__('Are you sure?').'\')) return false">' . html_print_image("images/cross.png", true, array("title" => "Delete")) . '</a>';
array_push ($table->data, $data); array_push ($table->data, $data);
@ -206,3 +221,17 @@ ui_require_jquery_file ('cluetip');
}); });
/* ]]> */ /* ]]> */
</script> </script>
<script type="text/javascript">
$(document).ready(function () {
$(".email_large").dialog(
{
autoOpen: false,
resizable: true,
width: 400,
height: 200
});
});
function show_dialog(id) {
$("#email_large_" + id).dialog("open");
}
</script>

View File

@ -5700,34 +5700,38 @@ function api_get_event_info($id_event, $trash1, $trash, $returnType) {
//http://127.0.0.1/pandora_console/include/api.php?op=set&op2=create_tag&other=tag_name|tag_description|tag_url|tag_email&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora //http://127.0.0.1/pandora_console/include/api.php?op=set&op2=create_tag&other=tag_name|tag_description|tag_url|tag_email&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora
function api_set_create_tag ($id, $trash1, $other, $returnType) { function api_set_create_tag ($id, $trash1, $other, $returnType) {
$data = array(); $data = array();
if ($other['type'] == 'string') { if ($other['type'] == 'string') {
$data["name"] = $other["data"]; $data["name"] = $other["data"];
} else if ($other['type'] == 'array') { }
else if ($other['type'] == 'array') {
$data['name'] = $other["data"][0];
$data['name'] = $other["data"][0];
if ($other["data"][1] != '') { if ($other["data"][1] != '') {
$data['description'] = $other["data"][1]; $data['description'] = $other["data"][1];
} else { }
else {
$data['description'] = ""; $data['description'] = "";
} }
if ($other["data"][1] != '') { if ($other["data"][1] != '') {
$data['url'] = $other["data"][2]; $data['url'] = $other["data"][2];
} else { }
else {
$data['url'] = ""; $data['url'] = "";
} }
if ($other["data"][1] != '') { if ($other["data"][1] != '') {
$data['email'] = $other["data"][3]; $data['email'] = $other["data"][3];
} else { }
else {
$data['email'] = ''; $data['email'] = '';
} }
} }
tags_create_tag ($data); tags_create_tag ($data);
} }

View File

@ -34,7 +34,8 @@ if (is_ajax()) {
$snmp_tree = snmp_browser_get_tree ($target_ip, $community, $starting_oid); $snmp_tree = snmp_browser_get_tree ($target_ip, $community, $starting_oid);
if (! is_array ($snmp_tree)) { if (! is_array ($snmp_tree)) {
echo $snmp_tree; echo $snmp_tree;
} else { }
else {
snmp_browser_print_tree ($snmp_tree); snmp_browser_print_tree ($snmp_tree);
} }
return; return;
@ -46,7 +47,7 @@ if (is_ajax()) {
if ($custom_action != "") { if ($custom_action != "") {
$custom_action = urldecode (base64_decode ($custom_action)); $custom_action = urldecode (base64_decode ($custom_action));
} }
$oid = snmp_browser_get_oid ($target_ip, $community, $target_oid); $oid = snmp_browser_get_oid ($target_ip, $community, $target_oid);
snmp_browser_print_oid ($oid, $custom_action); snmp_browser_print_oid ($oid, $custom_action);
return; return;
@ -69,7 +70,8 @@ $url = 'index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_browser&refr='
if ($config["pure"]) { if ($config["pure"]) {
// Windowed // Windowed
$link['text'] = '<a target="_top" href="'.$url.'&pure=0&refr=30">' . html_print_image("images/normal_screen.png", true, array("title" => __('Normal screen'))) . '</a>'; $link['text'] = '<a target="_top" href="'.$url.'&pure=0&refr=30">' . html_print_image("images/normal_screen.png", true, array("title" => __('Normal screen'))) . '</a>';
} else { }
else {
// Fullscreen // Fullscreen
$link['text'] = '<a target="_top" href="'.$url.'&pure=1&refr=0">' . html_print_image("images/full_screen.png", true, array("title" => __('Full screen'))) . '</a>'; $link['text'] = '<a target="_top" href="'.$url.'&pure=1&refr=0">' . html_print_image("images/full_screen.png", true, array("title" => __('Full screen'))) . '</a>';
} }