summaryrefslogtreecommitdiffstats
path: root/frontends/php
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-05-26 12:13:17 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-05-26 12:13:17 +0000
commit965c7db318bb52f6d92f02dd3934e1c01249bdf2 (patch)
treef42a7118db71c40119c583162479b4fda2e525b1 /frontends/php
parent60acf9d39e2337ffe440ab1f24cddd6a2fc24577 (diff)
- added support of value type Text (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@2911 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php')
-rw-r--r--frontends/php/history.php1
-rw-r--r--frontends/php/include/config.inc.php26
-rw-r--r--frontends/php/latest.php71
3 files changed, 62 insertions, 36 deletions
diff --git a/frontends/php/history.php b/frontends/php/history.php
index 22a611f7..0b598c4d 100644
--- a/frontends/php/history.php
+++ b/frontends/php/history.php
@@ -453,6 +453,7 @@
{
case ITEM_VALUE_TYPE_FLOAT: $h_table = "history"; break;
case ITEM_VALUE_TYPE_UINT64: $h_table = "history_uint"; break;
+ case ITEM_VALUE_TYPE_TEXT: $h_table = "history_text"; break;
default: $h_table = "history_str";
}
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php
index 3da498c3..0ab61d3a 100644
--- a/frontends/php/include/config.inc.php
+++ b/frontends/php/include/config.inc.php
@@ -1070,11 +1070,21 @@ COpt::profiling_start("page");
function& get_screen_plaintext($itemid,$elements)
{
$item=get_item_by_itemid($itemid);
- if($item["value_type"]==0)
+ if($item["value_type"]==ITEM_VALUE_TYPE_FLOAT)
{
$sql="select clock,value from history where itemid=$itemid".
" order by clock desc";
}
+ else if($item["value_type"]==ITEM_VALUE_TYPE_UINT64)
+ {
+ $sql="select clock,value from history_uint where itemid=$itemid".
+ " order by clock desc";
+ }
+ else if($item["value_type"]==ITEM_VALUE_TYPE_TEXT)
+ {
+ $sql="select clock,value from history_text where itemid=$itemid".
+ " order by clock desc";
+ }
else
{
$sql="select clock,value from history_str where itemid=$itemid".
@@ -1086,7 +1096,19 @@ COpt::profiling_start("page");
$table->SetHeader(array(S_TIMESTAMP,item_description($item["description"],$item["key_"])));
while($row=DBfetch($result))
{
- $table->AddRow(array(date(S_DATE_FORMAT_YMDHMS,$row["clock"]), $row["value"]));
+ if($item["value_type"]==ITEM_VALUE_TYPE_TEXT)
+ {
+ $value = nbsp(htmlspecialchars($row["value"]));
+ }
+ else if($item["value_type"]==ITEM_VALUE_TYPE_STRING)
+ {
+ $value = nbsp(htmlspecialchars($row["value"]));
+ }
+ else
+ {
+ $value = $row["value"];
+ }
+ $table->AddRow(array(date(S_DATE_FORMAT_YMDHMS,$row["clock"]), $value));
}
return $table;
}
diff --git a/frontends/php/latest.php b/frontends/php/latest.php
index 4361ea81..574ea325 100644
--- a/frontends/php/latest.php
+++ b/frontends/php/latest.php
@@ -64,6 +64,39 @@
}
update_profile("web.menu.view.last",$page["file"]);
?>
+
+<?php
+ // Misc functions
+ function format_lastvalue($db_item)
+ {
+ if(isset($db_item["lastvalue"]))
+ {
+ if($db_item["value_type"] == ITEM_VALUE_TYPE_FLOAT)
+ {
+ $lastvalue=convert_units($db_item["lastvalue"],$db_item["units"]);
+ }
+ else if($db_item["value_type"] == ITEM_VALUE_TYPE_UINT64)
+ {
+ $lastvalue=convert_units($db_item["lastvalue"],$db_item["units"]);
+ $lastvalue = replace_value_by_map($lastvalue, $db_item["valuemapid"]);
+ }
+ else if($db_item["value_type"] == ITEM_VALUE_TYPE_TEXT)
+ {
+// $lastvalue=nbsp(htmlspecialchars(substr($db_item["lastvalue"],0,20)." ..."));
+ $lastvalue="...";
+ }
+ else
+ {
+ $lastvalue=nbsp(htmlspecialchars(substr($db_item["lastvalue"],0,20)." ..."));
+ }
+ }
+ else
+ {
+ $lastvalue=new CCol("-","center");
+ }
+ return $lastvalue;
+ }
+?>
<?php
$_REQUEST["select"] = get_request("select","");
@@ -217,23 +250,8 @@
else
$lastclock="-";
- if(isset($db_item["lastvalue"]))
- {
- if(($db_item["value_type"] == ITEM_VALUE_TYPE_FLOAT) ||
- ($db_item["value_type"] == ITEM_VALUE_TYPE_UINT64))
- {
- $lastvalue=convert_units($db_item["lastvalue"],$db_item["units"]);
- }
- else
- {
- $lastvalue=nbsp(htmlspecialchars(substr($db_item["lastvalue"],0,20)." ..."));
- }
- $lastvalue = replace_value_by_map($lastvalue, $db_item["valuemapid"]);
- }
- else
- {
- $lastvalue=new CCol("-","center");
- }
+ $lastvalue=format_lastvalue($db_item);
+
if( isset($db_item["lastvalue"]) && isset($db_item["prevvalue"]) &&
($db_item["value_type"] == 0) && ($db_item["lastvalue"]-$db_item["prevvalue"] != 0) )
{
@@ -323,23 +341,8 @@
else
$lastclock="-";
- if(isset($db_item["lastvalue"]))
- {
- if(($db_item["value_type"] == ITEM_VALUE_TYPE_FLOAT) ||
- ($db_item["value_type"] == ITEM_VALUE_TYPE_UINT64))
- {
- $lastvalue=convert_units($db_item["lastvalue"],$db_item["units"]);
- }
- else
- {
- $lastvalue=nbsp(htmlspecialchars(substr($db_item["lastvalue"],0,20)." ..."));
- }
- $lastvalue = replace_value_by_map($lastvalue, $db_item["valuemapid"]);
- }
- else
- {
- $lastvalue=new CCol("-","center");
- }
+ $lastvalue=format_lastvalue($db_item);
+
if( isset($db_item["lastvalue"]) && isset($db_item["prevvalue"]) &&
($db_item["value_type"] == 0) && ($db_item["lastvalue"]-$db_item["prevvalue"] != 0) )
{