2010-11-15 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_extensions.php: added functions "add_extension_godmode_tab_agent" and "add_extension_opemode_tab_agent" to add the extensions tab in the header in operation and godmode. * operation/agentes/ver_agente.php, godmode/agentes/configurar_agente.php: added hook for to add the extension tabs. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3585 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
83368c071f
commit
1b85363a8c
|
@ -1,3 +1,13 @@
|
||||||
|
2010-11-15 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* include/functions_extensions.php: added functions
|
||||||
|
"add_extension_godmode_tab_agent" and "add_extension_opemode_tab_agent" to
|
||||||
|
add the extensions tab in the header in operation and godmode.
|
||||||
|
|
||||||
|
* operation/agentes/ver_agente.php,
|
||||||
|
godmode/agentes/configurar_agente.php: added hook for to add the extension
|
||||||
|
tabs.
|
||||||
|
|
||||||
2010-11-14 Junichi Satoh <junichi@rworks.jp>
|
2010-11-14 Junichi Satoh <junichi@rworks.jp>
|
||||||
|
|
||||||
* operation/agentes/status_monitor.php: Fixed unnecessary strings
|
* operation/agentes/status_monitor.php: Fixed unnecessary strings
|
||||||
|
|
|
@ -282,7 +282,32 @@ if ($id_agente) {
|
||||||
$gistab['active'] = false;
|
$gistab['active'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$onheader = array('view' => $viewtab, 'separator' => "", 'main' => $maintab, 'module' => $moduletab, 'alert' => $alerttab, 'template' => $templatetab, 'inventory' => $inventorytab, 'collection'=> $collectiontab, 'group' => $grouptab, 'gis' => $gistab);
|
$onheader = array('view' => $viewtab, 'separator' => "", 'main' => $maintab,
|
||||||
|
'module' => $moduletab, 'alert' => $alerttab, 'template' => $templatetab,
|
||||||
|
'inventory' => $inventorytab, 'collection'=> $collectiontab, 'group' => $grouptab, 'gis' => $gistab);
|
||||||
|
|
||||||
|
foreach($config['extensions'] as $extension) {
|
||||||
|
if (isset($extension['extension_god_tab'])) {
|
||||||
|
$image = $extension['extension_god_tab']['icon'];
|
||||||
|
$name = $extension['extension_god_tab']['name'];
|
||||||
|
$id = $extension['extension_god_tab']['id'];
|
||||||
|
|
||||||
|
$id_extension = get_parameter('id_extension', '');
|
||||||
|
|
||||||
|
if ($id_extension == $id) {
|
||||||
|
$active = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$active = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=extension&id_agente='.$id_agente . '&id_extension=' . $id;
|
||||||
|
|
||||||
|
$extension_tab = array('text' => '<a href="' . $url .'">' . print_image ($image, true, array ( "title" => $name)) . '</a>', 'active' => $active);
|
||||||
|
|
||||||
|
$onheader = $onheader + array($id => $extension_tab);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
print_page_header (__('Agent configuration').' - '.printTruncateText(get_agent_name ($id_agente)), "images/setup.png", false, "", true, $onheader);
|
print_page_header (__('Agent configuration').' - '.printTruncateText(get_agent_name ($id_agente)), "images/setup.png", false, "", true, $onheader);
|
||||||
|
|
||||||
|
@ -651,6 +676,7 @@ if ($update_module) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// MODULE INSERT
|
// MODULE INSERT
|
||||||
|
// =================
|
||||||
if ($create_module) {
|
if ($create_module) {
|
||||||
if (isset ($_POST["combo_snmp_oid"])) {
|
if (isset ($_POST["combo_snmp_oid"])) {
|
||||||
$combo_snmp_oid = get_parameter_post ("combo_snmp_oid");
|
$combo_snmp_oid = get_parameter_post ("combo_snmp_oid");
|
||||||
|
@ -867,7 +893,8 @@ switch ($tab) {
|
||||||
case "module":
|
case "module":
|
||||||
if ($id_agent_module || $edit_module) {
|
if ($id_agent_module || $edit_module) {
|
||||||
require ("module_manager_editor.php");
|
require ("module_manager_editor.php");
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
require ("module_manager.php");
|
require ("module_manager.php");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -881,10 +908,29 @@ switch ($tab) {
|
||||||
case "gis":
|
case "gis":
|
||||||
require("agent_conf_gis.php");
|
require("agent_conf_gis.php");
|
||||||
break;
|
break;
|
||||||
|
case "extension":
|
||||||
|
$found = false;
|
||||||
|
foreach($config['extensions'] as $extension) {
|
||||||
|
if (isset($extension['extension_god_tab'])) {
|
||||||
|
$id = $extension['extension_god_tab']['id'];
|
||||||
|
$function = $extension['extension_god_tab']['function'];
|
||||||
|
|
||||||
|
$id_extension = get_parameter('id_extension', '');
|
||||||
|
|
||||||
|
if ($id_extension == $id) {
|
||||||
|
call_user_func_array($function, array());
|
||||||
|
$found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$found) {
|
||||||
|
print_error_message ("Invalid tab specified");
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if (enterprise_hook ('switch_agent_tab', array ($tab)))
|
if (enterprise_hook ('switch_agent_tab', array ($tab)))
|
||||||
//This will make sure that blank pages will have at least some
|
//This will make sure that blank pages will have at least some
|
||||||
//debug info in them - do not translate debug
|
//debug info in them - do not translate debug
|
||||||
print_error_message ("DEBUG: Invalid tab specified in ".__FILE__.":".__LINE__);
|
print_error_message ("Invalid tab specified");
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -189,6 +189,46 @@ function add_godmode_menu_option ($name, $acl, $fatherId = null, $icon = null) {
|
||||||
$extension['godmode_menu'] = $option_menu;
|
$extension['godmode_menu'] = $option_menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add in the header tabs in godmode agent the extension tab.
|
||||||
|
*
|
||||||
|
* @param $tabId
|
||||||
|
* @param $tabName
|
||||||
|
* @param $tabIcon
|
||||||
|
* @param $tabFunction
|
||||||
|
*/
|
||||||
|
function add_extension_godmode_tab_agent($tabId, $tabName, $tabIcon, $tabFunction) {
|
||||||
|
global $config;
|
||||||
|
global $extension_file;
|
||||||
|
|
||||||
|
$extension = &$config['extensions'][$extension_file];
|
||||||
|
$extension['extension_god_tab'] = array();
|
||||||
|
$extension['extension_god_tab']['id'] = $tabId;
|
||||||
|
$extension['extension_god_tab']['name'] = $tabName;
|
||||||
|
$extension['extension_god_tab']['icon'] = $tabIcon;
|
||||||
|
$extension['extension_god_tab']['function'] = $tabFunction;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add in the header tabs in operation agent the extension tab.
|
||||||
|
*
|
||||||
|
* @param unknown_type $tabId
|
||||||
|
* @param unknown_type $tabName
|
||||||
|
* @param unknown_type $tabIcon
|
||||||
|
* @param unknown_type $tabFunction
|
||||||
|
*/
|
||||||
|
function add_extension_opemode_tab_agent($tabId, $tabName, $tabIcon, $tabFunction) {
|
||||||
|
global $config;
|
||||||
|
global $extension_file;
|
||||||
|
|
||||||
|
$extension = &$config['extensions'][$extension_file];
|
||||||
|
$extension['extension_ope_tab'] = array();
|
||||||
|
$extension['extension_ope_tab']['id'] = $tabId;
|
||||||
|
$extension['extension_ope_tab']['name'] = $tabName;
|
||||||
|
$extension['extension_ope_tab']['icon'] = $tabIcon;
|
||||||
|
$extension['extension_ope_tab']['function'] = $tabFunction;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: Document extensions
|
* TODO: Document extensions
|
||||||
*
|
*
|
||||||
|
|
|
@ -447,11 +447,35 @@ else {
|
||||||
$graphs['active'] = false;
|
$graphs['active'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$onheader = array('manage' => $managetab, 'separator' => "", 'main' => $maintab,
|
$onheader = array('manage' => $managetab, 'separator' => "", 'main' => $maintab,
|
||||||
'data' => $datatab, 'alert' => $alerttab, 'sla' => $slatab,
|
'data' => $datatab, 'alert' => $alerttab, 'sla' => $slatab,
|
||||||
'inventory' => $inventorytab, 'collection' => $collectiontab,
|
'inventory' => $inventorytab, 'collection' => $collectiontab,
|
||||||
'group' => $grouptab, 'gis' => $gistab, 'custom' => $custom_fields, 'graphs' => $graphs, 'policy' => $policyTab);
|
'group' => $grouptab, 'gis' => $gistab, 'custom' => $custom_fields, 'graphs' => $graphs, 'policy' => $policyTab);
|
||||||
|
|
||||||
|
foreach($config['extensions'] as $extension) {
|
||||||
|
if (isset($extension['extension_ope_tab'])) {
|
||||||
|
$image = $extension['extension_ope_tab']['icon'];
|
||||||
|
$name = $extension['extension_ope_tab']['name'];
|
||||||
|
$id = $extension['extension_ope_tab']['id'];
|
||||||
|
|
||||||
|
$id_extension = get_parameter('id_extension', '');
|
||||||
|
|
||||||
|
if ($id_extension == $id) {
|
||||||
|
$active = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$active = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=extension&id_agente='.$id_agente . '&id_extension=' . $id;
|
||||||
|
|
||||||
|
$extension_tab = array('text' => '<a href="' . $url .'">' . print_image ($image, true, array ( "title" => $name)) . '</a>', 'active' => $active);
|
||||||
|
|
||||||
|
$onheader = $onheader + array($id => $extension_tab);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
print_page_header (__('Agent').' - '.mb_substr(get_agent_name($id_agente),0,25), $icon, false, "", false, $onheader);
|
print_page_header (__('Agent').' - '.mb_substr(get_agent_name($id_agente),0,25), $icon, false, "", false, $onheader);
|
||||||
|
|
||||||
|
|
||||||
|
@ -495,6 +519,25 @@ switch ($tab) {
|
||||||
case "graphs";
|
case "graphs";
|
||||||
require("operation/agentes/graphs.php");
|
require("operation/agentes/graphs.php");
|
||||||
break;
|
break;
|
||||||
|
case "extension":
|
||||||
|
$found = false;
|
||||||
|
foreach($config['extensions'] as $extension) {
|
||||||
|
if (isset($extension['extension_ope_tab'])) {
|
||||||
|
$id = $extension['extension_ope_tab']['id'];
|
||||||
|
$function = $extension['extension_ope_tab']['function'];
|
||||||
|
|
||||||
|
$id_extension = get_parameter('id_extension', '');
|
||||||
|
|
||||||
|
if ($id_extension == $id) {
|
||||||
|
call_user_func_array($function, array());
|
||||||
|
$found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$found) {
|
||||||
|
print_error_message ("Invalid tab specified in ".__FILE__.":".__LINE__);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue