summaryrefslogtreecommitdiffstats
path: root/frontends/php/screens.php
diff options
context:
space:
mode:
authorosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-01-30 16:16:29 +0000
committerosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-01-30 16:16:29 +0000
commitf002fe92ed3ffa6815e148fdbba1dacc9ceed168 (patch)
tree833edf74e3802e0e05b65b3d215193dfe3e0bc0d /frontends/php/screens.php
parent46a1314b99cca5eac01908ca75e819a690f09620 (diff)
downloadzabbix-f002fe92ed3ffa6815e148fdbba1dacc9ceed168.tar.gz
zabbix-f002fe92ed3ffa6815e148fdbba1dacc9ceed168.tar.xz
zabbix-f002fe92ed3ffa6815e148fdbba1dacc9ceed168.zip
- Frontend improvements (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@2579 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/screens.php')
-rw-r--r--frontends/php/screens.php176
1 files changed, 95 insertions, 81 deletions
diff --git a/frontends/php/screens.php b/frontends/php/screens.php
index 4ff461a1..252cb5ec 100644
--- a/frontends/php/screens.php
+++ b/frontends/php/screens.php
@@ -108,104 +108,115 @@
$map="<a href=\"screens.php?screenid=".$_REQUEST["screenid"]."&fullscreen=1\">".$row["name"]."</a>";
}
show_table_header($map);*/
- for($r=0;$r<$row["rows"];$r++)
- {
- for($c=0;$c<$row["cols"];$c++)
- {
- $spancheck[$r][$c]=1;
- }
- }
- for($r=0;$r<$row["rows"];$r++)
- {
- for($c=0;$c<$row["cols"];$c++)
+
+ for($r=0;$r<$row["rows"];$r++)
{
- $sql="select * from screens_items where screenid=$screenid and x=$c and y=$r";
- $iresult=DBSelect($sql);
- $colspan=0;
- $rowspan=0;
- if(DBnum_rows($iresult)>0)
+ for($c=0;$c<$row["cols"];$c++)
{
- $irow=DBfetch($iresult);
- $colspan=$irow["colspan"];
- $rowspan=$irow["rowspan"];
+ if(isset($skip_field[$r][$c])) continue;
+
+ $sql="select * from screens_items where screenid=$screenid and x=$c and y=$r";
+ $iresult=DBSelect($sql);
+ if(DBnum_rows($iresult)>0)
+ {
+ $irow=DBfetch($iresult);
+ $colspan=$irow["colspan"];
+ $rowspan=$irow["rowspan"];
+ } else {
+ $colspan=0;
+ $rowspan=0;
+ }
+ for($i=0; $i < $rowspan || $i==0; $i++){
+ for($j=0; $j < $colspan || $j==0; $j++){
+ if($i!=0 || $j!=0)
+ $skip_field[$r+$i][$c+$j]=1;
+ }
+ }
}
- for($i=0;$i<$rowspan;$i++)
- for($j=0;$j<$colspan;$j++)
- if(($i!=0)||($j!=0)) $spancheck[$r+$i][$c+$j]=0;
-
- }
- }
-
- echo "<TABLE COLS=".$row["cols"]." align=center WIDTH=100% BGCOLOR=\"#FFFFFF\">\n";
- for($r=0;$r<$row["rows"];$r++)
- {
- echo "<TR>\n";
- for($c=0;$c<$row["cols"];$c++)
- {
- if($spancheck[$r][$c]==0) continue;
-
- $sql="select * from screens_items where screenid=$screenid and x=$c and y=$r";
- $iresult=DBSelect($sql);
- $colspan=0;
- $rowspan=0;
- if(DBnum_rows($iresult)>0)
- {
- $irow=DBfetch($iresult);
- $screenitemid=$irow["screenitemid"];
- $resource=$irow["resource"];
- $resourceid=$irow["resourceid"];
- $width=$irow["width"];
- $height=$irow["height"];
- $colspan=$irow["colspan"];
- $rowspan=$irow["rowspan"];
- $elements=$irow["elements"];
}
-
- $tmp="";
- if($colspan!=0)
+ $table = new CTable(
+ new CLink("No rows in screen ".$row["name"],"screenconf.php?form=0&screenid=".$screenid),
+ "screen_view");
+
+ for($r=0;$r<$row["rows"];$r++)
{
- $tmp=$tmp." colspan=\"$colspan\" ";
- $c=$c+$colspan-1;
- }
- if($rowspan!=0)
+ $new_cols = array();
+ for($c=0;$c<$row["cols"];$c++)
{
- $tmp=$tmp." rowspan=\"$rowspan\" ";
- }
+ if(isset($skip_field[$r][$c])) continue;
+
+ $iresult=DBSelect("select * from screens_items".
+ " where screenid=$screenid and x=$c and y=$r");
- echo "<TD align=\"center\" valign=\"top\" $tmp>\n";
- if(DBnum_rows($iresult)>0)
- {
- if($resource == 0)
+ if(DBnum_rows($iresult)>0)
+ {
+ $irow = DBfetch($iresult);
+ $screenitemid = $irow["screenitemid"];
+ $resource = $irow["resource"];
+ $resourceid = $irow["resourceid"];
+ $width = $irow["width"];
+ $height = $irow["height"];
+ $colspan = $irow["colspan"];
+ $rowspan = $irow["rowspan"];
+ $elements = $irow["elements"];
+ }
+ else
+ {
+ $screenitemid = 0;
+ $screenitemid = 0;
+ $resource = 0;
+ $resourceid = 0;
+ $width = 0;
+ $height = 0;
+ $colspan = 0;
+ $rowspan = 0;
+ $elements = 0;
+ }
+
+ if( ($screenitemid!=0) && ($resource==0) )
{
- echo "<a href=charts.php?graphid=$resourceid".url_param("period").url_param("inc").url_param("dec")."><img src='chart2.php?graphid=$resourceid&width=$width&height=$height&period=$effectiveperiod".url_param("from")."border=0' border=0></a>";
- //echo "<a href=charts.php?graphid=$resourceid><img src='chart2.php?graphid=$resourceid&width=$width&height=$height&".url_param("period").url_param("from")."border=0' border=0></a>";
+ $item = new CLink(
+ new CImg("chart2.php?graphid=$resourceid&width=$width&height=$height".
+ "&period=3600' border=0"),
+ "charts.php?graphid=$resourceid".url_param("period").
+ url_param("inc").url_param("dec")
+ );
}
- else if($resource == 1)
+ else if( ($screenitemid!=0) && ($resource==1) )
{
- echo "<a href=history.php?action=showhistory&itemid=$resourceid".url_param("period").url_param("inc").url_param("dec")."><img src='chart.php?itemid=$resourceid&width=$width&height=$height&period=$effectiveperiod".url_param("from")."border=0' border=0></a>";
- //echo "<a href=history.php?action=showhistory&itemid=$resourceid><img src='chart.php?itemid=$resourceid&width=$width&height=$height&".url_param("period").url_param("from")."border=0' border=0></a>";
+ $item = new CLink(
+ new CImg("chart.php?itemid=$resourceid&width=$width&height=$height".
+ "&period=3600"),
+ "history.php?action=showhistory&itemid=$resourceid".
+ url_param("period").url_param("inc").url_param("dec")
+ );
}
- else if($resource == 2)
+ else if( ($screenitemid!=0) && ($resource==2) )
{
- echo get_map_imagemap($resourceid);
- echo "<img src='map.php?sysmapid=$resourceid&noedit=true&border=1' border=0 usemap=#links$resourceid>";
+ $item = new CImg("map.php?noedit=1&sysmapid=$resourceid".
+ "&width=$width&height=$height&period=3600");
}
- else if($resource == 3)
+ else if( ($screenitemid!=0) && ($resource==3) )
{
- $ptext =& get_screen_plaintext($resourceid,$elements);
- $ptext->Show();
+ $item = array(get_screen_plaintext($resourceid,$elements));
}
+ else
+ {
+ $item = SPACE;
+ }
+ $new_col = new CCol($item,"screen_view");
+
+ if($colspan) $new_col->SetColSpan($colspan);
+ if($rowspan) $new_col->SetRowSpan($rowspan);
+
+ array_push($new_cols, $new_col);
}
- else
- {
- echo "&nbsp;";
+ $table->AddRow(new CRow($new_cols));
}
- echo "</TD>\n";
- }
- echo "</TR>\n";
- }
- echo "</TABLE>\n";
+
+ $table->Show();
+
navigation_bar("screens.php");
}
else
@@ -222,5 +233,8 @@
?>
<?php
- show_page_footer();
+ if(!isset($_REQUEST["fullscreen"]))
+ {
+ show_page_footer();
+ }
?>