diff options
| author | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-04-05 09:16:29 +0000 |
|---|---|---|
| committer | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-04-05 09:16:29 +0000 |
| commit | 0c9653d6ab8fca3be69489943f1fcc4e9d797102 (patch) | |
| tree | 4e3d0f7e328577428161b62d3872bbdeefacb70c /frontends/php/include | |
| parent | 07abfc5904f98fd5139b5ac6d92aaa34a7ccf9b7 (diff) | |
- added latest values filtring/marking of log history (Eugene)
- developed multiple log history viewing (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@2719 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include')
| -rw-r--r-- | frontends/php/include/classes/cform.inc.php | 10 | ||||
| -rw-r--r-- | frontends/php/include/classes/ctag.inc.php | 37 | ||||
| -rw-r--r-- | frontends/php/include/config.inc.php | 317 | ||||
| -rw-r--r-- | frontends/php/include/db.inc.php | 4 | ||||
| -rw-r--r-- | frontends/php/include/defines.inc.php | 9 | ||||
| -rw-r--r-- | frontends/php/include/forms.inc.php | 165 | ||||
| -rw-r--r-- | frontends/php/include/graphs.inc.php | 319 | ||||
| -rw-r--r-- | frontends/php/include/locales/en_gb.inc.php | 17 | ||||
| -rw-r--r-- | frontends/php/include/screens.inc.php | 2 |
9 files changed, 187 insertions, 693 deletions
diff --git a/frontends/php/include/classes/cform.inc.php b/frontends/php/include/classes/cform.inc.php index ace2a10b..2d2e8103 100644 --- a/frontends/php/include/classes/cform.inc.php +++ b/frontends/php/include/classes/cform.inc.php @@ -66,7 +66,15 @@ } function AddVar($name, $value) { - $this->AddItem(new CVar($name, $value)); + if(is_array($value)) + { + foreach($value as $item) + { + $this->AddItem(new CVar($name."[]", $item)); + } + return 1; + } + return $this->AddItem(new CVar($name, $value)); } } ?> diff --git a/frontends/php/include/classes/ctag.inc.php b/frontends/php/include/classes/ctag.inc.php index 563ad4eb..9ddc0b20 100644 --- a/frontends/php/include/classes/ctag.inc.php +++ b/frontends/php/include/classes/ctag.inc.php @@ -27,6 +27,7 @@ var $paired; /* protected */ var $items = array(); + var $items_max_count; var $tag_body_start; var $tag_body_end; @@ -34,14 +35,27 @@ var $tag_end; /* public */ - function CTag($name=NULL, $paired='no') + function CTag($name=NULL, $paired='no', $body=NULL) { $this->SetTagName($name); $this->SetPaired($paired); - $this->tag_start= ""; - $this->tag_end = "\n"; - $this->tag_body_start = "\n"; - $this->tag_body_end = ""; + $this->SetMaxLength(0); + + $this->tag_start=$this->tag_end=$this->tag_body_start=$this->tag_body_end= ""; + + if(is_null($body)) $this->tag_end = "\n"; + if(is_null($body)) $this->tag_body_start = "\n"; + + CTag::AddItem($body); + + } + function SetMaxLength($value) + { + if(!is_int($value)) + return $this->error("Incorrect value for SetMaxLength [$value]"); + + $this->items_max_count = $value; + return 0; } function Show() { @@ -129,6 +143,10 @@ { $this->items = array(); } + function GetItemsCount() + { + return count($this->items); + } function AddItem($value) { if(is_null($value)) @@ -138,10 +156,19 @@ elseif(is_array($value)) { foreach($value as $item) + { + if($this->items_max_count > 0) + if(count($this->items) >= $this->items_max_count) + return $this->error("Maximal tag lenght '".$this->items_max_count."' is achived"); array_push($this->items,$item); + } } else { + if($this->items_max_count > 0) + if(count($this->items) >= $this->items_max_count) + return $this->error("Maximal tag lenght '".$this->items_max_count."' is achived"); + array_push($this->items,$value); } return 0; diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php index 3a8fde1e..3380c9a3 100644 --- a/frontends/php/include/config.inc.php +++ b/frontends/php/include/config.inc.php @@ -1326,40 +1326,6 @@ function SDI($msg="SDI") { echo "DEBUG INFO: $msg ".BR; } // DEBUG INFO!!! return $table; } - # Show values in plain text - - function show_plaintext($itemid, $from, $till) - { - $item=get_item_by_itemid($itemid); - if($item["value_type"]==ITEM_VALUE_TYPE_FLOAT) - { - $sql="select clock,value from history where itemid=$itemid and clock>$from and clock<$till order by clock"; - } - else if($item["value_type"]==ITEM_VALUE_TYPE_UINT64) - { - $sql="select clock,value from history_uint where itemid=$itemid and clock>$from and clock<$till order by clock"; - } - else if($item["value_type"]==ITEM_VALUE_TYPE_LOG) - { - $sql="select clock,value from history_log where itemid=$itemid and clock>$from and clock<$till order by clock"; - } - else - { - $sql="select clock,value from history_str where itemid=$itemid and clock>$from and clock<$till order by clock"; - } - $result=DBselect($sql); - - echo "<PRE>\n"; - while($row=DBfetch($result)) - { - $clock=$row["clock"]; - $value=$row["value"]; - echo date("Y-m-d H:i:s",$clock); - echo "\t$clock\t$value\n"; - } - } - - # Translate {10}>10 to something like localhost:procload.last(0)>10 function explode_exp ($expression, $html) @@ -1392,7 +1358,7 @@ function SDI($msg="SDI") { echo "DEBUG INFO: $msg ".BR; } // DEBUG INFO!!! $item=get_item_by_itemid($row1["itemid"]); if($item["value_type"] ==0) { - $exp=$exp."{<A HREF=\"history.php?action=showhistory&itemid=".$row1["itemid"]."\">".$row1["host"].":".$row1["key_"]."</A>.<B>".$row1["function"]."(</B>".$row1["parameter"]."<B>)</B>}"; + $exp=$exp."{<A HREF=\"history.php?action=showgraph&itemid=".$row1["itemid"]."\">".$row1["host"].":".$row1["key_"]."</A>.<B>".$row1["function"]."(</B>".$row1["parameter"]."<B>)</B>}"; } else { @@ -1889,152 +1855,6 @@ function SDI($msg="SDI") { echo "DEBUG INFO: $msg ".BR; } // DEBUG INFO!!! return DBexecute($sql); } - function show_table_h_delimiter() - { -// echo "</font>"; - cr(); - echo "</td>"; - cr(); - echo "<td colspan=1 bgcolor=FFFFFF align=center valign=\"top\">"; - cr(); -// echo " <font size=2>"; - cr(); - } - - function show_table2_h_delimiter() - { -// echo "</font>"; - cr(); - echo "</td>"; - cr(); -// echo "<td colspan=1 bgcolor=CCCCCC align=left valign=\"top\">"; - echo "<td class=\"form_row_r\" height=24>"; - cr(); -// echo " <font size=-1>"; - cr(); - } - - function show_table3_h_delimiter($width=10) - { -?> - </td><td class="sub_menu" height=24 colspan=9 nowrap="nowrap" width="<?php echo $width;?>%"> -<?php -/* - cr(); - echo "</td>"; - cr(); - echo "<td width=$width% colspan=1 bgcolor=6d88ad align=right valign=\"top\">"; - cr(); - cr(); -*/ - } - - - function show_table_v_delimiter($colspan=1) - { -// echo "</font>"; - cr(); - echo "</td>"; - cr(); - echo "</tr>"; - cr(); - echo "<tr>"; - cr(); - echo "<td colspan=$colspan bgcolor=FFFFFF align=center valign=\"top\">"; - cr(); -// echo "<font size=2>"; - cr(); - } - - function show_table2_v_delimiter($rownum=0) - { -// echo "</font>"; - cr(); - echo "</td>"; - cr(); - echo "</tr>"; - cr(); - if($rownum%2 == 1) { echo "<TR BGCOLOR=\"#DFDFDF\">"; } - else { echo "<TR BGCOLOR=\"#D8D8D8\">"; } - cr(); -// echo "<td colspan=1 bgcolor=CCCCCC align=left valign=\"top\">"; - echo "<td class=\"form_row_l\" height=24>"; - cr(); -// echo "<font size=-1>"; - cr(); - } - - function show_table3_v_delimiter() - { -?> - </td><td class="sub_nemu" height=24 colspan=9> - -<?php -/* cr(); - echo "</td>"; - cr(); - echo "</tr>"; - cr(); - echo "<tr>"; - cr(); - echo "<td colspan=1 bgcolor=#6d88ad align=left valign=\"top\">"; - cr(); - cr();*/ - } - - - function show_table2_v_delimiter2() - { -// echo "</font>"; - cr(); - echo "</td>"; - cr(); - echo "</tr>"; - cr(); - echo "<tr>"; - cr(); -// echo "<td colspan=2 bgcolor=\"99AABB\" align=right valign=\"top\">"; - echo "<td class=\"form_row_last\" colspan=2 align=right>"; - cr(); -// echo "<font size=-1>"; - cr(); - } - - -// function show_table2_header_begin() - function show_form_begin($help="") - { -?> -<p align=center> -<table class="form" width="50%" cellspacing=0 cellpadding=1> -<tr> -<td class="form_row_first" height=24 colspan=2> -<?php - if($help!="") - { - echo "<a style=\"float:right\" href=\"http://www.zabbix.com/manual/v1.1/web.$help.php\"><img src=\"images/general/help.gif\" border=0 alt=\"?\"></a>"; - } - } - - function show_table_header_begin() - { - echo "<table border=0 align=center cellspacing=0 cellpadding=0 width=100% bgcolor=000000>"; - cr(); - echo "<tr>"; - cr(); - echo "<td valign=\"top\">"; - cr(); - echo "<table width=100% border=0 cellspacing=1 cellpadding=3>"; - cr(); - echo "<tr>"; - cr(); -// echo "<td colspan=1 bgcolor=99AABB align=center valign=\"top\">"; - echo "<td colspan=1 bgcolor=6d88ad align=center valign=\"top\">"; - cr(); -// echo " <font size=+1>"; - cr(); - } - function show_header2($col1, $col2=SPACE, $before="", $after="") { echo $before; @@ -2042,48 +1862,6 @@ function SDI($msg="SDI") { echo "DEBUG INFO: $msg ".BR; } // DEBUG INFO!!! echo $after; } - function show_table3_header_begin() - { -?> - <table class="menu" cellspacing=0 cellpadding=1 width="100%"> - <tr> -<?php - echo "<td class=\"sub_menu\" height=24 colspan=9 nowrap=\"nowrap\">"; - } - - - function show_table2_header_end() - { -// cr(); -// echo "</td>"; -// cr(); -// echo "</tr>"; -// cr(); -// echo "</table>"; - cr(); - echo "</td>"; - cr(); - echo "</tr>"; - cr(); - echo "</table>"; -// echo "</p>"; - cr(); - } - - function show_table_header_end() - { -/* cr(); - echo "</td>"; - cr(); - echo "</tr>"; - cr(); - echo "</table>"; - cr();*/ - echo "</td>"; - echo "</tr>"; - echo "</table>"; - } - function show_table_header($col1, $col2=SPACE) { $table = new CTable(NULL,"header"); @@ -2124,7 +1902,7 @@ function SDI($msg="SDI") { echo "DEBUG INFO: $msg ".BR; } // DEBUG INFO!!! echo "<form method=\"put\" action=\"history.php\">"; echo "<input name=\"itemid\" type=\"hidden\" value=$itemid size=8>"; - echo "<input name=\"action\" type=\"hidden\" value=\"showhistory\" size=8>"; + echo "<input name=\"action\" type=\"hidden\" value=\"showgraph\" size=8>"; echo "Year"; echo "<select name=\"year\">"; @@ -2238,7 +2016,7 @@ function SDI($msg="SDI") { echo "DEBUG INFO: $msg ".BR; } // DEBUG INFO!!! } echo "</select>"; - echo "<input class=\"button\" type=\"submit\" name=\"action\" value=\"showhistory\">"; + echo "<input class=\"button\" type=\"submit\" name=\"action\" value=\"showgraph\">"; echo "</form>"; } @@ -2247,31 +2025,11 @@ function SDI($msg="SDI") { echo "DEBUG INFO: $msg ".BR; } // DEBUG INFO!!! function show_history($itemid,$from,$period) { - if (!isset($from)) - { - $from=0; - $till="NOW"; - } - else - { - $till=time(NULL)-$from*3600; - $till=date(S_DATE_FORMAT_YMDHMS,$till); - } + $till=date(S_DATE_FORMAT_YMDHMS,time(NULL)-$from*3600); + show_table_header("TILL $till (".($period/3600)." HOURs)"); - if (!isset($period)) - { - $period=3600; - show_table_header("TILL $till (LAST HOUR)"); - } - else - { - $tmp=$period/3600; - show_table_header("TILL $till ($tmp HOURs)"); - } -// echo("<hr>"); echo "<center>"; echo "<TABLE BORDER=0 WIDTH=100% BGCOLOR=\"#CCCCCC\" cellspacing=1 cellpadding=3>"; - echo "<TR BGCOLOR=#EEEEEE>"; echo "<TR BGCOLOR=#DDDDDD>"; echo "<TD ALIGN=CENTER>"; @@ -2294,71 +2052,6 @@ function SDI($msg="SDI") { echo "DEBUG INFO: $msg ".BR; } // DEBUG INFO!!! echo "</TR>"; echo "</TABLE>"; echo "</center>"; - - navigation_bar("history.php"); - } - - # Show history - function show_freehist($itemid,$period) - { - show_form_begin("history.period"); - echo "Choose period"; - - show_table2_v_delimiter(); - echo "<form method=\"get\" action=\"history.php\">"; - echo "<input name=\"itemid\" type=\"hidden\" value=$itemid size=8>"; - echo "Period in seconds"; - show_table2_h_delimiter(); - echo "<input name=\"period\" value=\"7200\" size=8>"; - - show_table2_v_delimiter(); - echo "From (in hours)"; - show_table2_h_delimiter(); - echo "<input name=\"from\" value=\"24\" size=8>"; - - show_table2_v_delimiter2(); - echo "Press "; - echo "<input class=\"button\" type=\"submit\" name=\"action\" value=\"showvalues\"> to see values in plain text"; - - show_table2_header_end(); - - show_page_footer(); - } - - # Show in plain text - function show_plaintxt($itemid,$period) - { - show_form_begin("history.plaim"); - echo "Data in plain text format"; - - show_table2_v_delimiter(); - echo "<form method=\"get\" action=\"history.php\">"; - echo "<input name=\"itemid\" type=\"Hidden\" value=$itemid size=8>"; - echo "<input name=\"itemid\" type=\"Hidden\" value=$itemid size=8>"; - echo "From: (yyyy/mm/dd - HH:MM)"; - show_table2_h_delimiter(); - echo "<input name=\"fromyear\" value=\"",date("Y"),"\" size=5>/"; - echo "<input name=\"frommonth\" value=\"",date("m"),"\" size=3>/"; - echo "<input name=\"fromday\" value=\"",date("d"),"\" size=3> - "; - echo "<input name=\"fromhour\" value=\"0\" size=3>:"; - echo "<input name=\"frommin\" value=\"00\" size=3>"; - - show_table2_v_delimiter(); - echo "Till: (yyyy/mm/dd - HH:MM)"; - show_table2_h_delimiter(); - echo "<input name=\"tillyear\" value=\"",date("Y"),"\" size=5>/"; - echo "<input name=\"tillmonth\" value=\"",date("m"),"\" size=3>/"; - echo "<input name=\"tillday\" value=\"",date("d"),"\" size=3> - "; - echo "<input name=\"tillhour\" value=\"23\" size=3>:"; - echo "<input name=\"tillmin\" value=\"59\" size=3>"; - - show_table2_v_delimiter2(); - echo "Press to see data in "; - echo "<input class=\"button\" type=\"submit\" name=\"action\" value=\"plaintext\">"; - - show_table2_header_end(); - - show_page_footer(); } function show_page_footer() diff --git a/frontends/php/include/db.inc.php b/frontends/php/include/db.inc.php index fa0f1607..6b6df889 100644 --- a/frontends/php/include/db.inc.php +++ b/frontends/php/include/db.inc.php @@ -25,8 +25,8 @@ // $DB_TYPE ="POSTGRESQL"; $DB_TYPE ="MYSQL"; $DB_SERVER ="localhost"; - $DB_DATABASE ="zabbix"; -// $DB_DATABASE ="osmiy"; +// $DB_DATABASE ="zabbix"; + $DB_DATABASE ="osmiy"; $DB_USER ="root"; $DB_PASSWORD =""; // END OF DATABASE CONFIGURATION diff --git a/frontends/php/include/defines.inc.php b/frontends/php/include/defines.inc.php index 0bdf2d0a..e696d580 100644 --- a/frontends/php/include/defines.inc.php +++ b/frontends/php/include/defines.inc.php @@ -194,6 +194,15 @@ define("TIME_TYPE_LOCAL", 0); define("TIME_TYPE_SERVER", 1); + define("FILTER_TAST_SHOW", 0); + define("FILTER_TAST_HIDE", 1); + define("FILTER_TAST_MARK", 2); + define("FILTER_TAST_INVERT_MARK", 3); + + define("MARK_COLOR_RED", 1); + define("MARK_COLOR_GREEN", 2); + define("MARK_COLOR_BLUE", 3); + /* Support for PHP5. PHP5 does not have $HTTP_..._VARS */ if (!function_exists('version_compare')) { diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php index f3dc8ee7..4a9b883e 100644 --- a/frontends/php/include/forms.inc.php +++ b/frontends/php/include/forms.inc.php @@ -251,6 +251,7 @@ $frmItem = new CFormTable(S_ITEM,"items.php"); $frmItem->SetHelp("web.items.item.php"); + $frmItem->AddVar("config",get_request("config",0)); if(isset($_REQUEST["groupid"])) $frmItem->AddVar("groupid",$_REQUEST["groupid"]); @@ -504,13 +505,13 @@ array_push($frmRow, SPACE, new CButtonDelete("Delete selected item?", - url_param("form").url_param("groupid").url_param("hostid"). + url_param("form").url_param("groupid").url_param("hostid").url_param("config"). url_param("itemid")) ); } array_push($frmRow, SPACE, - new CButtonCancel(url_param("groupid").url_param("hostid"))); + new CButtonCancel(url_param("groupid").url_param("hostid").url_param("config"))); $frmItem->AddSpanRow($frmRow,"form_row_last"); @@ -560,54 +561,6 @@ SetFocus($frmLogin->GetName(),"name"); } -/* - # Insert form for Problem - function insert_problem_form($problemid) - { - show_form_begin(); - echo "Problem definition"; - show_table2_v_delimiter(); - echo "<form method=\"post\" action=\"helpdesk.php\">"; - echo "<input name=\"problemid\" type=hidden value=$problemid size=8>"; - echo "Description"; - show_table2_h_delimiter(); - echo "<input name=\"description\" value=\"$description\" size=70>"; - - show_table2_v_delimiter(); - echo "Severity"; - show_table2_h_delimiter(); - echo "<SELECT NAME=\"priority\" size=\"1\">"; - echo "<OPTION VALUE=\"0\" "; if($priority==0) echo "SELECTED"; echo ">Not classified"; - echo "<OPTION VALUE=\"1\" "; if($priority==1) echo "SELECTED"; echo ">Information"; - echo "<OPTION VALUE=\"2\" "; if($priority==2) echo "SELECTED"; echo ">Warning"; - echo "<OPTION VALUE=\"3\" "; if($priority==3) echo "SELECTED"; echo ">Average"; - echo "<OPTION VALUE=\"4\" "; if($priority==4) echo "SELECTED"; echo ">High"; - echo "<OPTION VALUE=\"5\" "; if($priority==5) echo "SELECTED"; echo ">Disaster"; - echo "</SELECT>"; - - show_table2_v_delimiter(); - echo "Status"; - show_table2_h_delimiter(); - echo "<SELECT NAME=\"status\" value=\"$status\" size=\"1\">"; - echo "<OPTION VALUE=\"0\""; - if($status==0) echo "SELECTED"; - echo ">Opened"; - echo "<OPTION VALUE=\"1\""; - if($status==1) echo "SELECTED"; - echo ">Closed"; - echo "</SELECT>"; - - show_table2_v_delimiter2(); - echo "<input class=\"button\" type=\"submit\" name=\"register\" value=\"add\">"; - if(isset($problemid)) - { - echo "<input class=\"button\" type=\"submit\" name=\"register\" value=\"update\">"; - echo "<input class=\"button\" type=\"submit\" name=\"register\" value=\"delete\">"; - } - - show_table2_header_end(); - } -*/ # Insert form for Trigger function insert_trigger_form() { @@ -709,7 +662,7 @@ $frmTrig->AddRow(S_COMMENTS,new CTextArea("comments",$comments,70,7)); $frmTrig->AddRow(S_URL,new CTextBox("url",$url,70)); - $frmTrig->AddRow(S_DISABLED,new CCheckBox("disabled",$status)); + $frmTrig->AddRow(S_DISABLED,new CCheckBox("status",$status)); $frmTrig->AddItemToBottomRow(new CButton("save",S_SAVE)); if(isset($_REQUEST["triggerid"])) @@ -724,6 +677,20 @@ $frmTrig->Show(); } + function insert_trigger_comment_form($triggerid) + { + $trigger=get_trigger_by_triggerid($triggerid); + $comments=stripslashes($trigger["comments"]); + + $frmComent = new CFormTable(S_COMMENTS." for \"".expand_trigger_description_simple($triggerid)."\""); + $frmComent->SetHelp("web.tr_comments.comments.php"); + $frmComent->AddVar("triggerid",$triggerid); + $frmComent->AddRow(S_COMMENTS,new CTextArea("comments",$comments,100,25)); + $frmComent->AddItemToBottomRow(new CButton("register","update")); + + $frmComent->Show(); + } + function insert_graph_form() { global $_REQUEST; @@ -900,103 +867,7 @@ $frmGItem->AddItemToBottomRow(new CButtonCancel(url_param("graphid"))); $frmGItem->Show(); } -/* - # Insert escalation form - function insert_escalation_form($escalationid) - { - if(isset($escalationid)) - { - $result=DBselect("select * from escalations where escalationid=$escalationid"); - - $row=DBfetch($result); - - $name=$row["name"]; - $dflt=$row["dflt"]; - } - else - { - $name=""; - $dflt=0; - } - - $frmEscal = new CFormTable(S_ESCALATION,"config.php"); - $frmEscal->SetHelp("web.escalations.php"); - - $frmEscal->AddVar("config",$_REQUEST["config"]); - - if(isset($escalationid)) - { - $frmEscal->AddVar("escalationid",$escalationid); - } - $frmEscal->AddRow(S_NAME,new CTextBox("name",$name,32)); - $frmEscal->AddRow(S_IS_DEFAULT,new CCheckBox("dflt",$dflt)); - - $frmEscal->AddItemToBottomRow(new CButton("register","add escalation")); - if(isset($escalationid)) - { - $frmEscal->AddItemToBottomRow(SPACE); - $frmEscal->AddItemToBottomRow(new CButton("register","update escalation")); - $frmEscal->AddItemToBottomRow(SPACE); - $frmEscal->AddItemToBottomRow(new CButton("register","delete escalation", - "return Confirm('Delete selected escalation?');")); - } - $frmEscal->Show(); - } - - # Insert escalation rule form - function insert_escalation_rule_form($escalationid,$escalationruleid) - { - if(isset($escalationruleid)) - { - $result=DBselect("select * from escalation_rules where escalationruleid=$escalationruleid"); - - $row=DBfetch($result); - - $level=$row["level"]; - $period=$row["period"]; - $delay=$row["delay"]; - $actiontype=$row["actiontype"]; - } - else - { - $level=1; - $period="1-7,00:00-23:59"; - $delay=0; - $actiontype=0; - } - - $frmEacalRul = new CFormTable(S_ESCALATION_RULE,"config.php"); - $frmEacalRul->SetHelp("web.escalationrule.php"); - $frmEacalRul->AddVar("config",$_REQUEST["config"]); - $frmEacalRul->AddVar("escalationid",$escalationid); - if(isset($escalationruleid)) - { - $frmEacalRul->AddVar("calationruleid",$escalationruleid); - } - - $frmEacalRul->AddRow(S_LEVEL,new CTextBox("level",$level,2)); - $frmEacalRul->AddRow(S_PERIOD,new CTextBox("period",$period,32)); - $frmEacalRul->AddRow(S_DELAY,new CTextBox("delay",$delay,32)); - - $cmbAction = new CComboBox("actiontype",$actiontype); - $cmbAction->AddItem(0,"Do nothing"); - $cmbAction->AddItem(1,"Execute actions"); - $cmbAction->AddItem(2,"Increase severity"); - $cmbAction->AddItem(3,"Increase administrative hierarcy"); - $frmEacalRul->AddRow(S_DO,$cmbAction); - - $frmEacalRul->AddItemToBottomRow(new CButton("register","add rule")); - if(isset($escalationid)) - { - $frmEacalRul->AddItemToBottomRow(SPACE); - $frmEacalRul->AddItemToBottomRow(new CButton("register","update rule")); - $frmEacalRul->AddItemToBottomRow(SPACE); - $frmEacalRul->AddItemToBottomRow(new CButton("register","delete rule","return Confirm('Delete selected escalation rule?');")); - } - $frmEacalRul->Show(); - } -*/ # Insert autoregistration form function insert_autoregistration_form() { diff --git a/frontends/php/include/graphs.inc.php b/frontends/php/include/graphs.inc.php index 6775cdd0..98eb8462 100644 --- a/frontends/php/include/graphs.inc.php +++ b/frontends/php/include/graphs.inc.php @@ -491,253 +491,124 @@ function navigation_bar_calc() { - $workingperiod = 3600; +// $workingperiod = 3600; if(!isset($_REQUEST["period"])) $_REQUEST["period"]=3600; if(!isset($_REQUEST["from"])) $_REQUEST["from"]=0; - if(isset($_REQUEST["inc"])) $workingperiod= $_REQUEST["period"]+$_REQUEST["inc"]; - if(isset($_REQUEST["dec"])) $workingperiod= $workingperiod-$_REQUEST["dec"]; - //if(isset($_REQUEST["inc"])) $_REQUEST["period"]= $_REQUEST["period"]+$_REQUEST["inc"]; - //if(isset($_REQUEST["dec"])) $_REQUEST["period"]= $_REQUEST["period"]-$_REQUEST["dec"]; +// if(isset($_REQUEST["inc"])) $workingperiod= $_REQUEST["period"]+$_REQUEST["inc"]; +// if(isset($_REQUEST["dec"])) $workingperiod= $workingperiod-$_REQUEST["dec"]; + if(isset($_REQUEST["inc"])) $_REQUEST["period"] += $_REQUEST["inc"]; + if(isset($_REQUEST["dec"])) $_REQUEST["period"] -= $_REQUEST["dec"]; - if(isset($_REQUEST["left"])) $_REQUEST["from"]= $_REQUEST["from"]+$_REQUEST["left"]; - if(isset($_REQUEST["right"])) $_REQUEST["from"]= $_REQUEST["from"]-$_REQUEST["right"]; + if(isset($_REQUEST["left"])) $_REQUEST["from"] += $_REQUEST["left"]; + if(isset($_REQUEST["right"])) $_REQUEST["from"] -= $_REQUEST["right"]; //unset($_REQUEST["inc"]); //unset($_REQUEST["dec"]); unset($_REQUEST["left"]); unset($_REQUEST["right"]); - if($_REQUEST["from"]<=0) $_REQUEST["from"]=0; - if($_REQUEST["period"]<=0) $_REQUEST["period"]=3600; + if($_REQUEST["from"] <= 0) $_REQUEST["from"] = 0; + if($_REQUEST["period"] <= 3600) $_REQUEST["period"] = 3600; if(isset($_REQUEST["reset"])) { - $_REQUEST["period"]=3600; - $_REQUEST["from"]=0; - $workingperiod=3600; + $_REQUEST["period"] = 3600; + $_REQUEST["from"] = 0; +// $workingperiod = 3600; } - return $workingperiod; + + return $_REQUEST["period"]; +// return $workingperiod; } - function navigation_bar($url) + function navigation_bar($url,$ext_saved_request=NULL) { - $h1=S_NAVIGATE; - $h2=S_PERIOD.SPACE; - $h2=$h2."<select class=\"biginput\" name=\"period\" onChange=\"submit()\">"; - $h2=$h2.form_select("period",3600,"1h"); - $h2=$h2.form_select("period",2*3600,"2h"); - $h2=$h2.form_select("period",4*3600,"4h"); - $h2=$h2.form_select("period",8*3600,"8h"); - $h2=$h2.form_select("period",12*3600,"12h"); - $h2=$h2.form_select("period",24*3600,"24h"); - $h2=$h2.form_select("period",7*24*3600,"week"); - $h2=$h2.form_select("period",31*24*3600,"month"); - $h2=$h2.form_select("period",365*24*3600,"year"); - $h2=$h2."</select>"; - $h2=$h2."<select class=\"biginput\" name=\"dec\" onChange=\"submit()\">"; - $h2=$h2.form_select(NULL,0,S_DECREASE); - $h2=$h2.form_select(NULL,3600,"-1h"); - $h2=$h2.form_select(NULL,4*3600,"-4h"); - $h2=$h2.form_select(NULL,24*3600,"-24h"); - $h2=$h2.form_select(NULL,7*24*3600,"-week"); - $h2=$h2.form_select(NULL,31*24*3600,"-month"); - $h2=$h2.form_select(NULL,365*24*3600,"-year"); - $h2=$h2."</select>"; - $h2=$h2."<select class=\"biginput\" name=\"inc\" onChange=\"submit()\">"; - $h2=$h2.form_select(NULL,0,S_INCREASE); - $h2=$h2.form_select(NULL,3600,"+1h"); - $h2=$h2.form_select(NULL,4*3600,"+4h"); - $h2=$h2.form_select(NULL,24*3600,"+24h"); - $h2=$h2.form_select(NULL,7*24*3600,"+week"); - $h2=$h2.form_select(NULL,31*24*3600,"+month"); - $h2=$h2.form_select(NULL,365*24*3600,"+year"); - $h2=$h2."</select>"; - $h2=$h2.SPACE.S_MOVE.SPACE; - $h2=$h2."<select class=\"biginput\" name=\"left\" onChange=\"submit()\">"; - $h2=$h2.form_select(NULL,0,S_LEFT_DIR); - $h2=$h2.form_select(NULL,1,"-1h"); - $h2=$h2.form_select(NULL,4,"-4h"); - $h2=$h2.form_select(NULL,24,"-24h"); - $h2=$h2.form_select(NULL,7*24,"-week"); - $h2=$h2.form_select(NULL,31*24,"-month"); - $h2=$h2.form_select(NULL,365*24,"-year"); - $h2=$h2."</select>"; - $h2=$h2."<select class=\"biginput\" name=\"right\" onChange=\"submit()\">"; - $h2=$h2.form_select(NULL,0,S_RIGHT_DIR); - $h2=$h2.form_select(NULL,1,"+1h"); - $h2=$h2.form_select(NULL,4,"+4h"); - $h2=$h2.form_select(NULL,24,"+24h"); - $h2=$h2.form_select(NULL,7*24,"+week"); - $h2=$h2.form_select(NULL,31*24,"+month"); - $h2=$h2.form_select(NULL,365*24,"+year"); - $h2=$h2."</select>"; - $h2=$h2.SPACE; - $h2=$h2."<input name=\"stime\" size=18 class=\"biginput\" value=\"yyyymmddhhmm\" size=12>"; - $h2=$h2.SPACE; - $h2=$h2."<input class=\"button\" type=\"submit\" name=\"action\" value=\"go\">"; - $h2=$h2."<input class=\"button\" type=\"submit\" name=\"reset\" value=\"reset\">"; - - if(isset($_REQUEST["graphid"])&&($_REQUEST["graphid"]!=0)) - { - $h2=$h2."<input name=\"graphid\" type=\"hidden\" value=\"".$_REQUEST["graphid"]."\" size=12>"; - } - if(isset($_REQUEST["screenid"])&&($_REQUEST["screenid"]!=0)) - { - $h2=$h2."<input name=\"screenid\" type=\"hidden\" value=\"".$_REQUEST["screenid"]."\" size=12>"; - } - if(isset($_REQUEST["itemid"])&&($_REQUEST["itemid"]!=0)) - { - $h2=$h2."<input name=\"itemid\" type=\"hidden\" value=\"".$_REQUEST["itemid"]."\" size=12>"; - } - if(isset($_REQUEST["action"])) - { - $h2=$h2."<input name=\"action\" type=\"hidden\" value=\"".$_REQUEST["action"]."\" size=22>"; - } - if(isset($_REQUEST["from"])) - { - $h2=$h2."<input name=\"from\" type=\"hidden\" value=\"".$_REQUEST["from"]."\" size=22>"; - } - if(isset($_REQUEST["fullscreen"])) - { - $h2=$h2."<input name=\"fullscreen\" type=\"hidden\" value=\"".$_REQUEST["fullscreen"]."\" size=22>"; - } - - show_header2($h1,$h2,"<form name=\"form2\" method=\"get\" action=\"$url\">","</form>"); + $saved_request = array("graphid","screenid","itemid","action","from","fullscreen"); - return; - - echo "<TABLE BORDER=0 align=center COLS=2 WIDTH=100% BGCOLOR=\"#CCCCCC\" cellspacing=1 cellpadding=1>"; - echo "<TR BGCOLOR=#FFFFFF>"; - echo "<TD ALIGN=LEFT>"; - - echo "<div align=left>"; - echo "<b>".S_PERIOD.":</b>".SPACE; - - $hour=3600; - - $a=array(S_1H=>3600,S_2H=>2*3600,S_4H=>4*3600,S_8H=>8*3600,S_12H=>12*3600, - S_24H=>24*3600,S_WEEK_SMALL=>7*24*3600,S_MONTH_SMALL=>31*24*3600,S_YEAR_SMALL=>365*24*3600); - foreach($a as $label=>$sec) - { - echo "["; - if($_REQUEST["period"]>$sec) - { - $tmp=$_REQUEST["period"]-$sec; - echo("<A HREF=\"$url&period=$tmp".url_param("graphid").url_param("stime").url_param("from").url_param("keep").url_param("fullscreen")."\">-</A>"); - } - else - { - echo "-"; - } - - echo("<A HREF=\"$url?period=$sec".url_param("graphid").url_param("stime").url_param("from").url_param("keep").url_param("fullscreen")."\">"); - echo($label."</A>"); - - $tmp=$_REQUEST["period"]+$sec; - echo("<A HREF=\"$url?period=$tmp".url_param("graphid").url_param("stime").url_param("from").url_param("keep").url_param("fullscreen")."\">+</A>"); - - echo "]".SPACE; - } + if(is_array($ext_saved_request)) + $saved_request = array_merge($saved_request, $ext_saved_request); + elseif(is_string($ext_saved_request)) + array_push($saved_request,$ext_saved_request); - echo("</div>"); + $form = new CForm($url); - echo "</TD>"; - echo "<TD BGCOLOR=#FFFFFF WIDTH=15% ALIGN=RIGHT>"; - echo "<b>".nbsp(S_KEEP_PERIOD).":</b>".SPACE; - if($_REQUEST["keep"] == 1) - { - echo("[<A HREF=\"$url?keep=0".url_param("graphid").url_param("from").url_param("period").url_param("fullscreen")."\">".S_ON_C."</a>]"); - } - else - { - echo("[<A HREF=\"$url?keep=1".url_param("graphid").url_param("from").url_param("period").url_param("fullscreen")."\">".S_OFF_C."</a>]"); - } - echo "</TD>"; - echo "</TR>"; - echo "<TR BGCOLOR=#FFFFFF>"; - echo "<TD>"; - if(isset($_REQUEST["stime"])) - { - echo "<div align=left>" ; - echo "<b>".S_MOVE.":</b>".SPACE; - - $day=24; -// $a already defined - $a=array("1h"=>1,"2h"=>2,"4h"=>4,"8h"=>8,"12h"=>12, - "24h"=>24,"week"=>7*24,"month"=>31*24,"year"=>365*24); - foreach($a as $label=>$hours) - { - echo "["; + $form->AddItem(S_PERIOD.SPACE); - $stime=$_REQUEST["stime"]; - $tmp=mktime(substr($stime,8,2),substr($stime,10,2),0,substr($stime,4,2),substr($stime,6,2),substr($stime,0,4)); - $tmp=$tmp-3600*$hours; - $tmp=date("YmdHi",$tmp); - echo("<A HREF=\"$url?stime=$tmp".url_param("graphid").url_param("period").url_param("keep").url_param("fullscreen")."\">-</A>"); - - echo($label); - - $stime=$_REQUEST["stime"]; - $tmp=mktime(substr($stime,8,2),substr($stime,10,2),0,substr($stime,4,2),substr($stime,6,2),substr($stime,0,4)); - $tmp=$tmp+3600*$hours; - $tmp=date("YmdHi",$tmp); - echo("<A HREF=\"$url?stime=$tmp".url_param("graphid").url_param("period").url_param("keep").url_param("fullscreen")."\">+</A>"); - - echo "]".SPACE; - } - echo("</div>"); - } + if(in_array($_REQUEST["period"],array(3600,2*3600,4*3600,8*3600,12*3600,24*3600,7*24*3600,31*24*3600,365*24*3600))) + $custom_per = 3*3600; else - { - echo "<div align=left>"; - echo "<b>".S_MOVE.":</b>".SPACE; - - $day=24; -// $a already defined - $a=array("1h"=>1,"2h"=>2,"4h"=>4,"8h"=>8,"12h"=>12, - "24h"=>24,"week"=>7*24,"month"=>31*24,"year"=>365*24); - foreach($a as $label=>$hours) - { - echo "["; - $tmp=$_REQUEST["from"]+$hours; - echo("<A HREF=\"$url?from=$tmp".url_param("graphid").url_param("period").url_param("keep").url_param("fullscreen")."\">-</A>"); + $custom_per = $_REQUEST["period"]; + + $cmbPeriod = new CComboBox("period",$_REQUEST["period"],"submit()"); + $cmbPeriod->AddItem($custom_per,"custom"); + $cmbPeriod->AddItem(3600,"1h"); + $cmbPeriod->AddItem(2*3600,"2h"); + $cmbPeriod->AddItem(4*3600,"4h"); + $cmbPeriod->AddItem(8*3600,"8h"); + $cmbPeriod->AddItem(12*3600,"12h"); + $cmbPeriod->AddItem(24*3600,"24h"); + $cmbPeriod->AddItem(7*24*3600,"week"); + $cmbPeriod->AddItem(31*24*3600,"month"); + $cmbPeriod->AddItem(365*24*3600,"year"); + $form->AddItem($cmbPeriod); + + $cmbDec = new CComboBox("dec",0,"submit()"); + $cmbDec->AddItem(0,S_DECREASE); + $cmbDec->AddItem(3600,"-1h"); + $cmbDec->AddItem(4*3600,"-4h"); + $cmbDec->AddItem(24*3600,"-24h"); + $cmbDec->AddItem(7*24*3600,"-week"); + $cmbDec->AddItem(31*24*3600,"-month"); + $cmbDec->AddItem(365*24*3600,"-year"); + $form->AddItem($cmbDec); + + $cmbInc = new CComboBox("inc",0,"submit()"); + $cmbInc->AddItem(0,S_INCREASE); + $cmbInc->AddItem(3600,"+1h"); + $cmbInc->AddItem(4*3600,"+4h"); + $cmbInc->AddItem(24*3600,"+24h"); + $cmbInc->AddItem(7*24*3600,"+week"); + $cmbInc->AddItem(31*24*3600,"+month"); + $cmbInc->AddItem(365*24*3600,"+year"); + $form->AddItem($cmbInc); + + $form->AddItem(SPACE.S_MOVE.SPACE); + + $cmbLeft = new CComboBox("left",0,"submit()"); + $cmbLeft->AddItem(0,S_LEFT_DIR); + $cmbLeft->AddItem(1,"-1h"); + $cmbLeft->AddItem(4,"-4h"); + $cmbLeft->AddItem(24,"-24h"); + $cmbLeft->AddItem(7*24,"-week"); + $cmbLeft->AddItem(31*24,"-month"); + $cmbLeft->AddItem(365*24,"-year"); + $form->AddItem($cmbLeft); + + $cmbRight = new CComboBox("right",0,"submit()"); + $cmbRight->AddItem(0,S_RIGHT_DIR); + $cmbRight->AddItem(1,"+1h"); + $cmbRight->AddItem(4,"+4h"); + $cmbRight->AddItem(24,"+24h"); + $cmbRight->AddItem(7*24,"+week"); + $cmbRight->AddItem(31*24,"+month"); + $cmbRight->AddItem(365*24,"+year"); + $form->AddItem($cmbRight); + + $form->AddItem(array(SPACE, + new CTextBox("stime","yyyymmddhhmm",12),SPACE, + new CButton("action","go"), + new CButton("reset","reset"))); + + foreach($saved_request as $item) + if(isset($_REQUEST[$item])) + $form->AddVar($item,$_REQUEST[$item]); + + show_header2( + S_NAVIGATE, + $form); - echo($label); - - if($_REQUEST["from"]>=$hours) - { - $tmp=$_REQUEST["from"]-$hours; - echo("<A HREF=\"$url?from=$tmp".url_param("graphid").url_param("period").url_param("keep").url_param("fullscreen")."\">+</A>"); - } - else - { - echo "+"; - } - - echo "]".SPACE; - } - echo("</div>"); - } - echo "</TD>"; - echo "<TD BGCOLOR=#FFFFFF WIDTH=15% ALIGN=RIGHT>"; - echo "<form method=\"put\" action=\"$url\">"; - echo "<input name=\"graphid\" type=\"hidden\" value=\"".$_REQUEST["graphid"]."\" size=12>"; - echo "<input name=\"period\" type=\"hidden\" value=\"".(9*3600)."\" size=12>"; - if(isset($_REQUEST["stime"])) - { - echo "<input name=\"stime\" class=\"biginput\" value=\"".$_REQUEST["stime"]."\" size=12>"; - } - else - { - echo "<input name=\"stime\" class=\"biginput\" value=\"yyyymmddhhmm\" size=12>"; - } - echo SPACE; - echo "<input class=\"button\" type=\"submit\" name=\"action\" value=\"go\">"; - echo "</form>"; - echo "</TD>"; - echo "</TR>"; - echo "</TABLE>"; + return; } ?> diff --git a/frontends/php/include/locales/en_gb.inc.php b/frontends/php/include/locales/en_gb.inc.php index e3a425e8..e1e4d6a0 100644 --- a/frontends/php/include/locales/en_gb.inc.php +++ b/frontends/php/include/locales/en_gb.inc.php @@ -37,6 +37,8 @@ "S_ALARM_ACKNOWLEDGES_BIG"=> "ALARM ACKNOWLEDGES", // actionconf.php + "S_CONFIGURATION_OF_ACTIONS"=> "Configuration of actions", + "S_CONFIGURATION_OF_ACTIONS_BIG"=> "CONFIGURATION OF ACTIONS", "S_FILTER_HOST_GROUP"=> "Filter: Host group", "S_FILTER_HOST"=> "Filter: Host", "S_FILTER_TRIGGER"=> "Filter: Trigger", @@ -61,6 +63,7 @@ // actions.php "S_ACTIONS"=> "Actions", + "S_ACTIONS_BIG"=> "ACTIONS", "S_ACTION_ADDED"=> "Action added", "S_CANNOT_ADD_ACTION"=> "Cannot add action", "S_ACTION_UPDATED"=> "Action updated", @@ -319,12 +322,22 @@ "S_LAST_HOUR_GRAPH"=> "Last hour graph", "S_VALUES_OF_LAST_HOUR"=> "Values of last hour", "S_500_LATEST_VALUES"=> "500 latest values", + "S_GRAPH_OF_SPECIFIED_PERIOD"=> "Graph of specified period", "S_VALUES_OF_SPECIFIED_PERIOD"=> "Values of specified period", "S_VALUES_IN_PLAIN_TEXT_FORMAT"=> "Values in plain text format", "S_TIMESTAMP"=> "Timestamp", "S_LOCAL"=> "Local", "S_SOURCE"=> "Source", + "S_SHOW_SELECTED"=> "Show selected", + "S_HIDE_SELECTED"=> "Hide selectede", + "S_MARK_SELECTED"=> "Mark selected", + "S_MARK_OTHERS"=> "Mark others", + + "S_AS_RED"=> "as Red", + "S_AS_GREEN"=> "as Green", + "S_AS_BLUE"=> "as Blue", + // hosts.php "S_HOSTS"=> "Hosts", "S_ITEMS"=> "Items", @@ -417,6 +430,7 @@ "S_HOSTS"=> "Hosts", // items.php + "S_NO_ITEMS_DEFINED"=> "No itemss defined", "S_HISTORY_CLEANED"=> "History cleaned", "S_CANNOT_CLEAN_HISTORY"=> "Cannot clean history", "S_CONFIGURATION_OF_ITEMS"=> "Configuration of items", @@ -512,6 +526,7 @@ "S_CONFIGURATION_OF_NETWORK_MAPS"=> "Configuration of network maps", // sysmaps.php + "S_MAPS_BIG"=> "MAPS", "S_NO_MAPS_DEFINED"=> "No maps defined", "S_CONFIGURATION_OF_NETWORK_MAPS"=> "CONFIGURATION OF NETWORK MAPS", "S_CREATE_MAP"=> "Create Map", @@ -677,7 +692,7 @@ // screenedit.php "S_MAP"=> "Map", - "S_PLAIN_TEXT"=> "Plain text", + "S_AS_PLAIN_TEXT"=> "As plain text", "S_COLUMN_SPAN"=> "Column span", "S_ROW_SPAN"=> "Row span", "S_SHOW_LINES"=> "Show lines", diff --git a/frontends/php/include/screens.inc.php b/frontends/php/include/screens.inc.php index 30698be7..cde92b41 100644 --- a/frontends/php/include/screens.inc.php +++ b/frontends/php/include/screens.inc.php @@ -225,7 +225,7 @@ elseif( ($screenitemid!=0) && ($resource==SCREEN_RESOURCE_SIMPLE_GRAPH) ) { if($editmode == 0) - $action = "history.php?action=showhistory&itemid=$resourceid". + $action = "history.php?action=showgraph&itemid=$resourceid". url_param("period").url_param("inc").url_param("dec"); $item = new CLink( |
