root/tags/module-NagiosStatusMap-1.1/statusmap.php

Revision 3010, 4.2 kB (checked in by jmathis, 17 months ago)

menage d'automne !:)

Line 
1<?
2/**
3Oreon is developped with GPL Licence 2.0 :
4http://www.gnu.org/licenses/gpl.txt
5Developped by : Christophe Coraboeuf
6
7Adapted to Pear library by Merethis company, under direction of Cedrick Facon, Romain Le Merlus, Julien Mathis
8
9The Software is provided to you AS IS and WITH ALL FAULTS.
10OREON makes no representation and gives no warranty whatsoever,
11whether express or implied, and without limitation, with regard to the quality,
12safety, contents, performance, merchantability, non-infringement or suitability for
13any particular or intended purpose of the Software found on the OREON web site.
14In no event will OREON be liable for any direct, indirect, punitive, special,
15incidental or consequential damages however they may arise and even if OREON has
16been previously advised of the possibility of such damages.
17
18For information : contact@oreon-project.org
19*/
20        if (!isset ($oreon))
21                exit ();
22       
23               
24        #Pear library
25        require_once "HTML/QuickForm.php";
26        require_once 'HTML/QuickForm/select.php';
27        require_once 'HTML/QuickForm/Renderer/ArraySmarty.php';
28       
29        $form = new HTML_QuickForm();
30       
31        #Path to the configuration dir
32        global $path;
33        $path = "./modules/statusmap/";
34
35        #PHP functions
36        require_once $path."DB-Func.php";
37       
38        #PHP functions
39       
40        $statusmapcgiOpt = getStatusmapcgiOpt() ;
41        $cgi = getActiveCgiInfo();
42        $hgs = getHostGroups();
43
44
45        ##########################################################
46        # Var information to format the element
47        #
48        $attrsText       = array("size"=>"4", "maxlength"=>"5");
49        $attrsText2  = array("size"=>"60");
50        $attrsSelect = array("style" => "width: 100px; height: 80px;");
51       
52        # Smarty template Init
53        $tpl = new Smarty();
54        $tpl = initSmartyTpl($path, $tpl);
55
56        $url = "modules/statusmap/statusmapproxy.php";
57               
58        $refresh = (isset($cgi['refresh_rate']) ?  $cgi['refresh_rate'] : "90");
59        $use_lca = (isset($statusmapcgiOpt['nagios_statusmap_use_lca']) ?  $statusmapcgiOpt['nagios_statusmap_use_lca'] : "0");
60
61        $tpl->assign("STATUSMAP_URL", $url);
62        $tpl->assign("STATUSMAP_TITLE", $lang["m_nagios_map"]);
63        $tpl->assign("initJS", "<script type='text/javascript'>refreshStatusmap('". $url."')</script>");
64       
65        //$form->addElement('layoutmethodheader', 'layoutmethod', $lang['statusmap_layout_method_header']);
66               
67        $layout_method = array();
68        $layout_method[0] = "User-supplied coords";
69        $layout_method[1] = "Depth layers";
70        $layout_method[2] = "Collapsed tree";
71        $layout_method[3] = "Balanced tree";
72        $layout_method[4] = "Circular";
73        $layout_method[5] = "Circular (Marked Up)";
74        $layout_method[6] = "Circular (Balloon)";
75        $form->addElement('select', 'layout_method', $lang["statusmap_layout_method"], $layout_method);
76        $form->setDefaults(array('layout_method' => $cgi['default_statusmap_layout'])); 
77
78
79        $layer_input =& $form->addElement('select', 'layer',$lang["statusmap_drawing_layers"], $hgs,$attrsSelect,array("id"=>"layer"));
80        $layer_input->setMultiple(true);
81               
82        $layermode = array();
83        $layermode[] = &HTML_QuickForm::createElement('radio', 'layermode', 'include', $lang["include"], '0');
84        $layermode[] = &HTML_QuickForm::createElement('radio', 'layermode','exclude', $lang["exclude"], '1');
85        $form->addGroup($layermode, 'layermode', $lang["statusmap_layer_mode"], '&nbsp;');
86        $form->setDefaults(array('layermode' => '0'));
87       
88        $form->addElement('text', 'scaling_factor', $lang["statusmap_scaling_factor"] , $attrsText);
89        $form->setDefaults(array( 'scaling_factor' => '0.0')); 
90       
91        $popup = array();
92        $popup[] = &HTML_QuickForm::createElement('checkbox', 'popup', '&nbsp;', $lang["yes"]);
93        $form->addGroup($popup, 'popup',$lang["statusmap_popup"], '&nbsp;&nbsp;');
94
95        $form->addElement('hidden', 'refresh');
96        $form->setDefaults(array('refresh' => $refresh));
97        $form->addElement('hidden', 'hgs');
98        $form->setDefaults(array('hgs' => implode(",",$hgs)));
99        $form->addElement('hidden', 'use_lca');
100        $form->setDefaults(array('use_lca' => $use_lca));
101               
102        $form->addElement("button", "update", $lang['statusmapUpdate'], array("onClick"=>"javascript:refreshStatusmap('". $url."')"));
103       
104        $renderer =& new HTML_QuickForm_Renderer_ArraySmarty($tpl);
105        $form->accept($renderer);
106        $tpl->assign('form', $renderer->toArray());
107        $tpl->assign('o', $o);
108        $tpl->assign('use_lca', $use_lca);
109        $tpl->display("statusmap.ihtml");       
110       
111?>
Note: See TracBrowser for help on using the browser.