2011-05-10 Juan Manuel Ramon <juanmanuel.ramon@artica.es>

* include/functions_visual_map.php
	include/ajax/visual_console_builder.ajax.php
	include/functions_ui.php
	include/functions_themes.php
	include/functions_ui_renders.php
	operation/visual_console/render_view.php
	operation/visual_console/index.php
	general/ui/agents_list.php
	godmode/setup/setup_visuals.php
	godmode/reporting/visual_console_builder.php
	godmode/reporting/visual_console_builder.editor.js
	godmode/reporting/visual_console_builder.elements.php
	godmode/reporting/visual_console_builder.preview.php
	godmode/reporting/visual_console_builder.editor.php
	godmode/reporting/map_builder.php: Functions in functions_themes.php,
	functions_ui_renders.php and functions_visual_map.php have "themes_",
	"ui_renders_" and "visual_map_" prefixes respectively. 



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4328 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
juanmanuelr 2011-05-10 08:31:33 +00:00
parent 99defec315
commit acb94aa55a
16 changed files with 76 additions and 56 deletions

View File

@ -1,3 +1,23 @@
2011-05-10 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_visual_map.php
include/ajax/visual_console_builder.ajax.php
include/functions_ui.php
include/functions_themes.php
include/functions_ui_renders.php
operation/visual_console/render_view.php
operation/visual_console/index.php
general/ui/agents_list.php
godmode/setup/setup_visuals.php
godmode/reporting/visual_console_builder.php
godmode/reporting/visual_console_builder.editor.js
godmode/reporting/visual_console_builder.elements.php
godmode/reporting/visual_console_builder.preview.php
godmode/reporting/visual_console_builder.editor.php
godmode/reporting/map_builder.php: Functions in functions_themes.php,
functions_ui_renders.php and functions_visual_map.php have "themes_",
"ui_renders_" and "visual_map_" prefixes respectively.
2011-05-10 Junichi Satoh <junichi@rworks.jp>
* operation/agentes/estado_agente.php: Replaced get_agents() with

View File

@ -139,9 +139,9 @@ if ($agents !== false) {
$data = array ();
foreach ($table_renders as $name => $values) {
if (! is_numeric ($name)) {
array_push ($data, render_agent_field ($agent, $name, $values, true));
array_push ($data, renders_agent_field ($agent, $name, $values, true));
} else {
array_push ($data, render_agent_field ($agent, $values, false, true));
array_push ($data, renders_agent_field ($agent, $values, false, true));
}
}
array_push ($table->data, $data);

View File

@ -118,9 +118,9 @@ $table->align[4] = 'center';
// Only display maps of "All" group if user is administrator or has "PM" privileges, otherwise show only maps of user group
$own_info = get_user_info ($config['id_user']);
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
$maps = get_user_layouts ();
$maps = visual_map_get_user_layouts ();
else
$maps = get_user_layouts ($config['id_user'], false, false, false);
$maps = visual_map_get_user_layouts ($config['id_user'], false, false, false);
if (!$maps) {
echo '<div class="nf">'.('No maps defined').'</div>';

View File

@ -725,7 +725,7 @@ function getImageElement(id_data) {
return img;
}
function getColorLineStatus(id) {
function visual_map_get_color_line_status(id) {
var parameter = Array();
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
parameter.push ({name: "action", value: "get_color_line"});
@ -879,7 +879,7 @@ function createItem(type, values, id_data) {
var line = {"id": id_data,
"node_begin": values['parent'],
"node_end": id_data,
"color": getColorLineStatus(id_data) };
"color": visual_map_get_color_line_status(id_data) };
lines.push(line);
refresh_lines(lines, 'background');

View File

@ -61,15 +61,15 @@ foreach ($all_images as $image_file) {
echo '<div id="editor" style="margin-top: -10px;">';
echo '<div id="toolbox">';
printButtonEditorVisualConsole('static_graph', __('Static Graph'), 'left', false, 'camera_min', true);
printButtonEditorVisualConsole('percentile_bar', __('Percentile Bar'), 'left', false, 'percentile_min', true);
printButtonEditorVisualConsole('module_graph', __('Module Graph'), 'left', false, 'graph_min', true);
printButtonEditorVisualConsole('simple_value', __('Simple Value'), 'left', false, 'binary_min', true);
printButtonEditorVisualConsole('label', __('Label'), 'left', false, 'label_min', true);
printButtonEditorVisualConsole('icon', __('Icon'), 'left', false, 'icon_min', true);
visual_map_print_button_editor('static_graph', __('Static Graph'), 'left', false, 'camera_min', true);
visual_map_print_button_editor('percentile_bar', __('Percentile Bar'), 'left', false, 'percentile_min', true);
visual_map_print_button_editor('module_graph', __('Module Graph'), 'left', false, 'graph_min', true);
visual_map_print_button_editor('simple_value', __('Simple Value'), 'left', false, 'binary_min', true);
visual_map_print_button_editor('label', __('Label'), 'left', false, 'label_min', true);
visual_map_print_button_editor('icon', __('Icon'), 'left', false, 'icon_min', true);
printButtonEditorVisualConsole('edit_item', __('Edit item'), 'right', true, 'config_min', true);
printButtonEditorVisualConsole('delete_item', __('Delete item'), 'right', true, 'delete_min', true);
visual_map_print_button_editor('edit_item', __('Edit item'), 'right', true, 'config_min', true);
visual_map_print_button_editor('delete_item', __('Delete item'), 'right', true, 'delete_min', true);
echo '</div>';
echo '</div>';
echo '<div style="clear: right; margin-bottom: 10px;"></div>';
@ -231,7 +231,7 @@ echo '<div id="properties_panel" style="display: none; position: absolute; borde
<td><?php echo __('Parent');?></td>
<td>
<?php
$parents = get_items_parents($visualConsole['id']);
$parents = visual_map_get_items_parents($visualConsole['id']);
html_print_select($parents, 'parent', '', '', __('None'), 0);
?>
</td>
@ -269,8 +269,8 @@ foreach ($layoutDatas as $layoutData) {
if($delete_pending_module == 1 || $disabled_module == 1)
continue;
printItemInVisualConsole($layoutData);
html_print_input_hidden('status_'.$layoutData['id'], getStatusElement($layoutData));
visual_map_print_item($layoutData);
html_print_input_hidden('status_'.$layoutData['id'], visual_map_get_status_element($layoutData));
}
echo '</div>';

View File

@ -45,7 +45,7 @@ foreach ($all_images as $image_file) {
$images_list[$image_file] = $image_file;
}
$layoutDataTypes = get_layout_data_types();
$layoutDataTypes = visual_map_get_layout_data_types();
/* Layout_data editor form */
$intervals = array ();

View File

@ -166,7 +166,7 @@ switch ($activeTab) {
}
else {
if ($name_modules[0] == '0')
$message .= process_wizard_add ($id_agents, $image, $idVisualConsole, $range, $width, $height);
$message .= visual_map_process_wizard_add ($id_agents, $image, $idVisualConsole, $range, $width, $height);
else{
$id_modules = array();
$cont_dest = 1;
@ -184,7 +184,7 @@ switch ($activeTab) {
}
$cont_mod = $cont_mod + 1;
}
$message .= process_wizard_add_modules ($id_modules, $image, $idVisualConsole, $range, $width, $height);
$message .= visual_map_process_wizard_add_modules ($id_modules, $image, $idVisualConsole, $range, $width, $height);
}
$statusProcessInDB = array('flag' => true, 'message' => $message);
}

View File

@ -26,7 +26,7 @@ if (! check_acl ($config['id_user'], 0, "IW")) {
require_once ('include/functions_visual_map.php');
print_pandora_visual_map ($visualConsole['id']);
visual_map_print_visual_map ($visualConsole['id']);
ui_require_javascript_file ('wz_jsgraphics');
ui_require_javascript_file ('pandora_visual_console');

View File

@ -61,7 +61,7 @@ $table->data[5][0] = __('Graphic resolution (1-low, 5-high)');
$table->data[5][1] = html_print_input_text ('graph_res', $config["graph_res"], '', 5, 5, true);
$table->data[6][0] = __('Style template');
$table->data[6][1] = html_print_select (get_css_themes (), 'style', $config["style"].'.css', '', '', '', true);
$table->data[6][1] = html_print_select (themes_get_css (), 'style', $config["style"].'.css', '', '', '', true);
$table->data[7][0] = __('Block size for pagination');
$table->data[7][1] = html_print_input_text ('block_size', $config["block_size"], '', 5, 5, true);

View File

@ -97,14 +97,14 @@ switch ($action) {
$layoutData = db_get_row_filter('tlayout_data', array('id' => $id_element));
$return = array();
$return['color_line'] = getColorLineStatus($layoutData);
$return['color_line'] = visual_map_get_color_line_status($layoutData);
echo json_encode($return);
break;
case 'get_image':
$layoutData = db_get_row_filter('tlayout_data', array('id' => $id_element));
$return = array();
$return['image'] = getImageStatusElement($layoutData);
$return['image'] = visual_map_get_image_status_element($layoutData);
echo json_encode($return);
break;
case 'update':
@ -290,7 +290,7 @@ switch ($action) {
$return['correct'] = 0;
}
else {
$text = createInternalNameItem($label, $type, $image, $agent, $id_module, $idData);
$text = visual_map_create_internal_name_item($label, $type, $image, $agent, $id_module, $idData);
$return['correct'] = 1;
$return['id_data'] = $idData;
@ -313,7 +313,7 @@ switch ($action) {
/* visual map element status check */
if ($get_element_status){
$res = getStatusElement($id_element);
$res = visual_map_get_status_element($id_element);
echo $res;
return;

View File

@ -27,7 +27,7 @@
* @return array An indexed array with the file name in the index and the theme
* name (if available) as the value.
*/
function get_css_themes ($path = false) {
function themes_get_css ($path = false) {
if ($path)
$theme_dir = $path;
else

View File

@ -876,7 +876,7 @@ function ui_process_page_head ($string, $bitfield) {
$exists_skin = enterprise_hook('is_skin_path_set');
if ($exists_skin){
$skin_path = enterprise_hook('get_skin_path');
$skin_styles = get_css_themes ($skin_path . 'include/styles/');
$skin_styles = themes_get_css ($skin_path . 'include/styles/');
$exists_css = !empty($skin_styles);
}
}

View File

@ -23,7 +23,7 @@ require_once ($config['homedir'] . '/include/functions_groups.php');
/**
*/
function render_agent_field ($agent, $field, $field_value = false, $return = false) {
function renders_agent_field ($agent, $field, $field_value = false, $return = false) {
global $config;
if (empty ($agent))

View File

@ -31,7 +31,7 @@ require_once ($config['homedir'].'/include/functions_agents.php');
require_once ($config['homedir'].'/include/functions_modules.php');
require_once ($config['homedir'].'/include/functions_users.php');
function printButtonEditorVisualConsole($idDiv, $label, $float = 'left', $disabled = false, $class= '', $imageButton = false) {
function visual_map_print_button_editor($idDiv, $label, $float = 'left', $disabled = false, $class= '', $imageButton = false) {
if ($float == 'left') {
$margin = 'margin-right';
}
@ -60,7 +60,7 @@ function printButtonEditorVisualConsole($idDiv, $label, $float = 'left', $disabl
}
function printItemInVisualConsole($layoutData) {
function visual_map_print_item($layoutData) {
global $config;
require_once ($config["homedir"] . '/include/functions_graph.php');
@ -85,7 +85,7 @@ function printItemInVisualConsole($layoutData) {
switch ($type) {
case STATIC_GRAPH:
if ($layoutData['image'] != null) {
$img = getImageStatusElement($layoutData);
$img = visual_map_get_image_status_element($layoutData);
if(substr($img,0,1) == '4') {
$borderStyle ='border: 2px solid #ffa300;';
$img = substr_replace($img, '', 0,1);
@ -144,7 +144,7 @@ function printItemInVisualConsole($layoutData) {
break;
case ICON:
if ($layoutData['image'] != null) {
$img = getImageStatusElement($layoutData);
$img = visual_map_get_image_status_element($layoutData);
$imgSizes = getimagesize($img);
}
if (($width != 0) && ($height != 0)) {
@ -168,7 +168,7 @@ function printItemInVisualConsole($layoutData) {
if ($layoutData['parent_item'] != 0) {
echo '<script type="text/javascript">';
echo '$(document).ready (function() {
lines.push({"id": "' . $id . '" , "node_begin":"' . $layoutData['parent_item'] . '","node_end":"' . $id . '","color":"' . getColorLineStatus($layoutData) . '"});
lines.push({"id": "' . $id . '" , "node_begin":"' . $layoutData['parent_item'] . '","node_end":"' . $id . '","color":"' . visual_map_get_color_line_status($layoutData) . '"});
});';
echo '</script>';
}
@ -186,7 +186,7 @@ function printItemInVisualConsole($layoutData) {
*
* @return string Return the message status to insert DB.
*/
function process_wizard_add ($id_agents, $image, $id_layout, $range, $width = 0, $height = 0) {
function visual_map_process_wizard_add ($id_agents, $image, $id_layout, $range, $width = 0, $height = 0) {
if (empty ($id_agents)) {
print_error_message (__('No agents selected'));
return false;
@ -235,7 +235,7 @@ function process_wizard_add ($id_agents, $image, $id_layout, $range, $width = 0,
*
* @return string Return the message status to insert DB.
*/
function process_wizard_add_modules ($id_modules, $image, $id_layout, $range, $width = 0, $height = 0) {
function visual_map_process_wizard_add_modules ($id_modules, $image, $id_layout, $range, $width = 0, $height = 0) {
if (empty ($id_modules)) {
$return = print_error_message (__('No modules selected'), '', true);
return false;
@ -283,13 +283,13 @@ function process_wizard_add_modules ($id_modules, $image, $id_layout, $range, $w
*
* @return string The color as hexadecimal color in html.
*/
function getColorLineStatus($layoutData) {
function visual_map_get_color_line_status($layoutData) {
if (($layoutData['type'] == 5) || ($layoutData['type'] == 4)) {
//ICON ELEMENT OR LABEL ELEMENT
$color = "#cccccc";
}
else {
switch (getStatusElement($layoutData)) {
switch (visual_map_get_status_element($layoutData)) {
case 3:
$color = "#cccccc"; // Gray
break;
@ -316,7 +316,7 @@ function getColorLineStatus($layoutData) {
*
* @return string The image with the relative path to pandora console directory.
*/
function getImageStatusElement($layoutData) {
function visual_map_get_image_status_element($layoutData) {
$img = "images/console/icons/" . $layoutData["image"];
if ($layoutData['type'] == 5) {
@ -324,7 +324,7 @@ function getImageStatusElement($layoutData) {
$img .= ".png";
}
else {
switch (getStatusElement($layoutData)) {
switch (visual_map_get_status_element($layoutData)) {
case 1:
//Critical (BAD)
$img .= "_bad.png";
@ -360,10 +360,10 @@ function getImageStatusElement($layoutData) {
*
* @return integer
*/
function getStatusElement($layoutData) {
function visual_map_get_status_element($layoutData) {
//Linked to other layout ?? - Only if not module defined
if ($layoutData['id_layout_linked'] != 0) {
$status = get_layout_status ($layoutData['id_layout_linked']);
$status = visual_map_get_layout_status ($layoutData['id_layout_linked']);
}
else if ($layoutData["type"] == 0) { //Single object
//Status for a simple module
@ -398,7 +398,7 @@ function getStatusElement($layoutData) {
* @param bool $show_links
* @param bool $draw_lines
*/
function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines = true, $width = null, $height = null) {
function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_lines = true, $width = null, $height = null) {
global $config;
$layout = db_get_row ('tlayout', 'id', $id_layout);
@ -460,7 +460,7 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines =
}
// Another layout/map
elseif ($id_layout_linked != 0) {
$status_parent = get_layout_status ($id_layout_linked);
$status_parent = visual_map_get_layout_status ($id_layout_linked);
}
else {
@ -479,7 +479,7 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines =
// Linked to other layout ?? - Only if not module defined
if ($layout_data['id_layout_linked'] != 0) {
$status = get_layout_status ($layout_data['id_layout_linked']);
$status = visual_map_get_layout_status ($layout_data['id_layout_linked']);
// Single object
} elseif ($layout_data["type"] == 0) {
@ -855,7 +855,7 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines =
/**
* @return array Layout data types
*/
function get_layout_data_types () {
function visual_map_get_layout_data_types () {
$types = array ();
$types[0] = __('Static graph');
$types[1] = __('Module graph');
@ -876,7 +876,7 @@ function get_layout_data_types () {
*
* @return array A list of layouts the user can see.
*/
function get_user_layouts ($id_user = 0, $only_names = false, $filter = false, $returnAllGroup = true) {
function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter = false, $returnAllGroup = true) {
if (! is_array ($filter))
$filter = array ();
@ -919,7 +919,7 @@ function get_user_layouts ($id_user = 0, $only_names = false, $filter = false, $
*
* @return bool The status of the given layout. True if it's OK, false if not.
*/
function get_layout_status ($id_layout = 0, $depth = 0) {
function visual_map_get_layout_status ($id_layout = 0, $depth = 0) {
$temp_status = 0;
$temp_total = 0;
$depth++; // For recursion depth checking
@ -941,7 +941,7 @@ function get_layout_status ($id_layout = 0, $depth = 0) {
continue;
// Other Layout (Recursive!)
if (($data["id_layout_linked"] != 0) && ($data["id_agente_modulo"] == 0)) {
$status = get_layout_status ($data["id_layout_linked"], $depth);
$status = visual_map_get_layout_status ($data["id_layout_linked"], $depth);
// Module
} elseif ($data["id_agente_modulo"] != 0) {
$status = modules_get_agentmodule_status ($data["id_agente_modulo"]);
@ -972,7 +972,7 @@ function get_layout_status ($id_layout = 0, $depth = 0) {
*
* @return string The text for the parent.
*/
function createInternalNameItem($label = null, $type, $image, $agent = null, $id_module, $idData) {
function visual_map_create_internal_name_item($label = null, $type, $image, $agent = null, $id_module, $idData) {
$text = '';
if (empty($label))
@ -1025,7 +1025,7 @@ function createInternalNameItem($label = null, $type, $image, $agent = null, $id
return $text;
}
function get_items_parents($idVisual) {
function visual_map_get_items_parents($idVisual) {
$items = db_get_all_rows_filter('tlayout_data',array('id_layout' => $idVisual));
if ($items == false) {
$items = array();
@ -1038,7 +1038,7 @@ function get_items_parents($idVisual) {
$agent = io_safe_output(get_agent_name($item['id_agent']));
}
$return[$item['id']] = createInternalNameItem($item['label'],
$return[$item['id']] = visual_map_create_internal_name_item($item['label'],
$item['type'], $item['image'], $agent, $item['id_agente_modulo'],
$item['id']);
}
@ -1053,7 +1053,7 @@ function get_items_parents($idVisual) {
*
* @return int The X axis coordinate value.
*/
function get_layoutdata_x ($id_layoutdata) {
function visual_map_get_layoutdata_x ($id_layoutdata) {
return (float) db_get_value ('pos_x', 'tlayout_data', 'id', (int) $id_layoutdata);
}
@ -1064,7 +1064,7 @@ function get_layoutdata_x ($id_layoutdata) {
*
* @return int The Y axis coordinate value.
*/
function get_layoutdata_y ($id_layoutdata){
function visual_map_get_layoutdata_y ($id_layoutdata){
return (float) db_get_value ('pos_y', 'tlayout_data', 'id', (int) $id_layoutdata);
}

View File

@ -24,7 +24,7 @@ ui_print_page_header (__("Visual console"), "images/monitor.png", false, "operat
require_once ('include/functions_visual_map.php');
require_once ('include/functions_groups.php');
$layouts = get_user_layouts ();
$layouts = visual_map_get_user_layouts ();
$table->width = "70%";
$table->data = array ();

View File

@ -74,7 +74,7 @@ $options['pure']['active'] = false;
ui_print_page_header (__("Visual console") . " &raquo; " . $layout_name, "images/monitor.png", false, '', false, $options);
print_pandora_visual_map ($id_layout);
visual_map_print_visual_map ($id_layout);
$values = array ();
$values[5] = human_time_description_raw (5);