summaryrefslogtreecommitdiffstats
path: root/frontends/php/screens.php
diff options
context:
space:
mode:
authorartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-08-05 14:25:48 +0000
committerartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-08-05 14:25:48 +0000
commitd1eb7d75f8caecbc8ca72210e3c6f0bfb9dec6a6 (patch)
treef18f050c04221aa5814641e2cd8f455fb10786d5 /frontends/php/screens.php
parente33e68fccdfdabd17ff8ce5f818dbed7f58e301e (diff)
downloadzabbix-d1eb7d75f8caecbc8ca72210e3c6f0bfb9dec6a6.tar.gz
zabbix-d1eb7d75f8caecbc8ca72210e3c6f0bfb9dec6a6.tar.xz
zabbix-d1eb7d75f8caecbc8ca72210e3c6f0bfb9dec6a6.zip
- [DEV-137] changed trigger values definitions (Artem)
- [DEV-191] latest data reverted to standart refresh (Artem) - [DEV-191] added hats to graphs, screens pages (Artem) git-svn-id: svn://svn.zabbix.com/trunk@5873 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/screens.php')
-rw-r--r--frontends/php/screens.php188
1 files changed, 100 insertions, 88 deletions
diff --git a/frontends/php/screens.php b/frontends/php/screens.php
index bed79eb8..94a172c5 100644
--- a/frontends/php/screens.php
+++ b/frontends/php/screens.php
@@ -19,14 +19,14 @@
**/
?>
<?php
- require_once "include/config.inc.php";
- require_once "include/graphs.inc.php";
- require_once "include/screens.inc.php";
+ require_once 'include/config.inc.php';
+ require_once 'include/graphs.inc.php';
+ require_once 'include/screens.inc.php';
require_once 'include/nodes.inc.php';
- $page["title"] = "S_CUSTOM_SCREENS";
- $page["file"] = "screens.php";
+ $page['title'] = "S_CUSTOM_SCREENS";
+ $page['file'] = 'screens.php';
$page['hist_arg'] = array('config','elementid');
$page['scripts'] = array('gmenu.js','scrollbar.js','sbox.js','sbinit.js'); //do not change order!!!
@@ -38,37 +38,40 @@
define('ZBX_PAGE_DO_REFRESH', 1);
}
-include_once "include/page_header.php";
+include_once 'include/page_header.php';
?>
<?php
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields=array(
- "config"=> array(T_ZBX_INT, O_OPT, P_SYS, IN("0,1"), null), // 0 - screens, 1 - slides
+ 'config'=> array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1'), null), // 0 - screens, 1 - slides
- "groupid"=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null),
- "hostid"=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null),
+ 'groupid'=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null),
+ 'hostid'=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null),
- "elementid"=> array(T_ZBX_INT, O_OPT, P_SYS|P_NZERO, DB_ID,NULL),
- "step"=> array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0,65535),NULL),
- "from"=> array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0,65535*65535),NULL),
- "period"=> array(T_ZBX_INT, O_OPT, P_SYS, null,NULL),
- "stime"=> array(T_ZBX_STR, O_OPT, P_SYS, NULL,NULL),
+ 'elementid'=> array(T_ZBX_INT, O_OPT, P_SYS|P_NZERO, DB_ID,NULL),
+ 'step'=> array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0,65535),NULL),
+ 'from'=> array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0,65535*65535),NULL),
+ 'period'=> array(T_ZBX_INT, O_OPT, P_SYS, null,NULL),
+ 'stime'=> array(T_ZBX_STR, O_OPT, P_SYS, NULL,NULL),
- "reset"=> array(T_ZBX_STR, O_OPT, P_SYS, IN("'reset'"),NULL),
- "fullscreen"=> array(T_ZBX_INT, O_OPT, P_SYS, IN("0,1,2"), NULL),
+ 'reset'=> array(T_ZBX_STR, O_OPT, P_SYS, IN("'reset'"),NULL),
+ 'fullscreen'=> array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1,2'), NULL),
//ajax
'favobj'=> array(T_ZBX_STR, O_OPT, P_ACT, NULL, NULL),
'favid'=> array(T_ZBX_STR, O_OPT, P_ACT, NOT_EMPTY, 'isset({favobj})'),
- 'action'=> array(T_ZBX_STR, O_OPT, P_SYS, IN("'go','add','remove'"),NULL)
-
+ 'state'=> array(T_ZBX_INT, O_OPT, P_ACT, NOT_EMPTY, 'isset({favobj})'),
+ 'action'=> array(T_ZBX_STR, O_OPT, P_ACT, IN("'add','remove'"),NULL)
);
check_fields($fields);
if(isset($_REQUEST['favobj'])){
+ if('hat' == $_REQUEST['favobj']){
+ update_profile('web.screens.hats.'.$_REQUEST['favid'].'.state',$_REQUEST['state'], PROFILE_TYPE_INT);
+ }
if(in_array($_REQUEST['favobj'],array('screenid','slideshowid'))){
$result = false;
if('add' == $_REQUEST['action']){
@@ -100,30 +103,32 @@ include_once "include/page_header.php";
<?php
$config = $_REQUEST['config'] = get_request('config', 0);
- if( 2 != $_REQUEST["fullscreen"] )
+ if( 2 != $_REQUEST['fullscreen'] )
update_profile('web.screens.config', $_REQUEST['config'],PROFILE_TYPE_INT);
- $_REQUEST["elementid"] = get_request("elementid",get_profile("web.screens.elementid", null));
+ $_REQUEST['elementid'] = get_request('elementid',get_profile('web.screens.elementid', null));
- if( 2 != $_REQUEST["fullscreen"] )
- update_profile("web.screens.elementid",$_REQUEST["elementid"]);
+ if( 2 != $_REQUEST['fullscreen'] )
+ update_profile('web.screens.elementid',$_REQUEST['elementid']);
- $_REQUEST["period"] = get_request('period',get_profile('web.screens.period', ZBX_PERIOD_DEFAULT, null, $_REQUEST['elementid']));
- if($_REQUEST["period"] >= ZBX_MIN_PERIOD){
+ $_REQUEST['period'] = get_request('period',get_profile('web.screens.period', ZBX_PERIOD_DEFAULT, null, $_REQUEST['elementid']));
+ if($_REQUEST['period'] >= ZBX_MIN_PERIOD){
update_profile('web.screens.period',$_REQUEST['period'], PROFILE_TYPE_INT, $_REQUEST['elementid']);
}
?>
<?php
- $text = array(S_SCREENS_BIG);
-
$elementid = get_request('elementid', null);
if($elementid <= 0) $elementid = null;
+ $p_elements = array();
+
+ $text = null;
+
$form = new CForm();
$form->SetMethod('get');
- $form->AddVar("fullscreen",$_REQUEST["fullscreen"]);
+ $form->AddVar('fullscreen',$_REQUEST['fullscreen']);
$cmbConfig = new CComboBox('config', $config, 'submit()');
$cmbConfig->AddItem(0, S_SCREENS);
@@ -131,7 +136,7 @@ include_once "include/page_header.php";
$form->AddItem($cmbConfig);
- $cmbElements = new CComboBox("elementid",$elementid,"submit()");
+ $cmbElements = new CComboBox('elementid',$elementid,'submit()');
unset($screen_correct);
unset($first_screen);
@@ -142,15 +147,15 @@ include_once "include/page_header.php";
' order by name'
);
while($row=DBfetch($result)){
- if(!screen_accessible($row["elementid"], PERM_READ_ONLY))
+ if(!screen_accessible($row['elementid'], PERM_READ_ONLY))
continue;
$cmbElements->AddItem(
$row['elementid'],
- get_node_name_by_elid($row['elementid']).$row["name"]
+ get_node_name_by_elid($row['elementid']).$row['name']
);
- if((bccomp($elementid , $row["elementid"]) == 0)) $element_correct = 1;
- if(!isset($first_element)) $first_element = $row["elementid"];
+ if((bccomp($elementid , $row['elementid']) == 0)) $element_correct = 1;
+ if(!isset($first_element)) $first_element = $row['elementid'];
}
}
else{
@@ -160,15 +165,15 @@ include_once "include/page_header.php";
' order by name'
);
while($row=DBfetch($result)){
- if(!slideshow_accessible($row["elementid"], PERM_READ_ONLY))
+ if(!slideshow_accessible($row['elementid'], PERM_READ_ONLY))
continue;
$cmbElements->AddItem(
$row['elementid'],
get_node_name_by_elid($row['elementid']).$row['name']
);
- if((bccomp($elementid , $row["elementid"]) == 0)) $element_correct = 1;
- if(!isset($first_element)) $first_element = $row["elementid"];
+ if((bccomp($elementid , $row['elementid']) == 0)) $element_correct = 1;
+ if(!isset($first_element)) $first_element = $row['elementid'];
}
}
@@ -187,49 +192,22 @@ include_once "include/page_header.php";
access_deny();
$element = get_slideshow_by_slideshowid($elementid);
}
-
- if( $element ){
- $text = array(nbsp(' / '),$element["name"]);
-
- if(infavorites('web.favorite.screenids',$elementid,(0 == $config)?'screenid':'slideshowid')){
- $icon = new CDiv(SPACE,'iconminus');
- $icon->AddOption('title',S_REMOVE_FROM.' '.S_FAVORITES);
- $icon->AddAction('onclick',new CScript("javascript: rm4favorites('".((0 == $config)?'screenid':'slideshowid')."','".$elementid."',0);"));
- }
- else{
- $icon = new CDiv(SPACE,'iconplus');
- $icon->AddOption('title',S_ADD_TO.' '.S_FAVORITES);
- $icon->AddAction('onclick',new CScript("javascript: add2favorites('".((0 == $config)?'screenid':'slideshowid')."','".$elementid."');"));
- }
- $icon->AddOption('id','addrm_fav');
-
- $url = '?elementid='.$elementid.($_REQUEST['fullscreen']?'':'&fullscreen=1');
-
- $fs_icon = new CDiv(SPACE,'fullscreen');
- $fs_icon->AddOption('title',$_REQUEST['fullscreen']?S_NORMAL.' '.S_VIEW:S_FULLSCREEN);
- $fs_icon->AddAction('onclick',new CScript("javascript: document.location = '".$url."';"));
- $icon_tab = new CTable();
- $icon_tab->AddRow(array($fs_icon,$icon,SPACE,$text));
-
- $text = $icon_tab;
- }
- else{
- $elementid = null;
- update_profile("web.screens.elementid",0);
+ if($element ){
+ $text = $element['name'];
}
}
if($cmbElements->ItemsCount() > 0)
$form->AddItem($cmbElements);
-
- if((2 != $_REQUEST["fullscreen"]) && (0 == $config) && (!empty($elementid)) && (check_dynamic_items($elementid))){
- if(!isset($_REQUEST["hostid"])){
- $_REQUEST["groupid"] = $_REQUEST["hostid"] = 0;
+
+ if((2 != $_REQUEST['fullscreen']) && (0 == $config) && !empty($elementid) && check_dynamic_items($elementid)){
+ if(!isset($_REQUEST['hostid'])){
+ $_REQUEST['groupid'] = $_REQUEST['hostid'] = 0;
}
- $options = array("allow_all_hosts","monitored_hosts","with_items");//, "always_select_first_host");
- if(!$ZBX_WITH_SUBNODES) array_push($options,"only_current_node");
+ $options = array('allow_all_hosts','monitored_hosts','with_items');//, 'always_select_first_host');
+ if(!$ZBX_WITH_SUBNODES) array_push($options,'only_current_node');
validate_group_with_host(PERM_READ_ONLY,$options);
@@ -261,7 +239,7 @@ include_once "include/page_header.php";
while($row=DBfetch($result)){
$cmbGroup->AddItem(
$row['groupid'],
- get_node_name_by_elid($row['groupid']).$row["name"]
+ get_node_name_by_elid($row['groupid']).$row['name']
);
}
@@ -296,16 +274,16 @@ include_once "include/page_header.php";
}
$r_form->AddItem(array(SPACE.S_HOST.SPACE,$cmbHosts));
- show_table_header($text,$form);
- show_table_header(null,$r_form);
+ $p_elements[] = get_table_header($text,array($form,$r_form));
}
- else if(2 != $_REQUEST["fullscreen"]){
- show_table_header($text,$form);
+ else if(2 != $_REQUEST['fullscreen']){
+ $p_elements[] = get_table_header($text,$form);
}
?>
<?php
if(isset($elementid)){
$effectiveperiod = navigation_bar_calc();
+
if( 0 == $config ){
$element = get_screen($elementid, 0, $effectiveperiod);
}
@@ -314,13 +292,14 @@ include_once "include/page_header.php";
zbx_add_post_js('if(typeof(parent) != "undefined") parent.resizeiframe("iframe");
else resizeiframe("iframe");'."\n");
}
+
if($element){
- $element->Show();
+ $p_elements[] = $element;
}
$_REQUEST['elementid'] = $elementid;
- if( 2 != $_REQUEST["fullscreen"] ){
+ if( 2 != $_REQUEST['fullscreen'] ){
$stime = time() - (31536000); // ~1year
$bstime = time()-$effectiveperiod;
@@ -335,22 +314,55 @@ include_once "include/page_header.php";
zbx_add_post_js($script);
$img = new CImg('images/general/tree/zero.gif','space','20','20');
- $img->Show();
- echo SBR;
-// navigation_bar("screens.php",array('config','elementid'));
+
+ $p_elements[] = $img;
+ $p_elements[] = BR();
+// navigation_bar('screens.php',array('config','elementid'));
+ }
+ }
+ else{
+ $p_elements[] = new CTableInfo((0 == $config)?S_NO_SCREENS_DEFINED:S_NO_SLIDESHOWS_DEFINED);
+ }
+
+ $icon = null;
+ $fs_icon = null;
+ if(isset($elementid) && $element ){
+ if(infavorites('web.favorite.screenids',$elementid,(0 == $config)?'screenid':'slideshowid')){
+ $icon = new CDiv(SPACE,'iconminus');
+ $icon->AddOption('title',S_REMOVE_FROM.' '.S_FAVORITES);
+ $icon->AddAction('onclick',new CScript("javascript: rm4favorites('".((0 == $config)?'screenid':'slideshowid')."','".$elementid."',0);"));
}
+ else{
+ $icon = new CDiv(SPACE,'iconplus');
+ $icon->AddOption('title',S_ADD_TO.' '.S_FAVORITES);
+ $icon->AddAction('onclick',new CScript("javascript: add2favorites('".((0 == $config)?'screenid':'slideshowid')."','".$elementid."');"));
+ }
+ $icon->AddOption('id','addrm_fav');
+
+ $url = '?elementid='.$elementid.($_REQUEST['fullscreen']?'':'&fullscreen=1');
+
+ $fs_icon = new CDiv(SPACE,'fullscreen');
+ $fs_icon->AddOption('title',$_REQUEST['fullscreen']?S_NORMAL.' '.S_VIEW:S_FULLSCREEN);
+ $fs_icon->AddAction('onclick',new CScript("javascript: document.location = '".$url."';"));
}
- else
- {
- echo unpack_object(new CTableInfo(
- 0 == $config ?
- S_NO_SCREENS_DEFINED :
- S_NO_SLIDESHOWS_DEFINED
- ));
+
+ if( 2 == $_REQUEST['fullscreen']){
+ echo unpack_object($p_elements);
+ }
+ else{
+ $screens_hat = create_hat(
+ (0 == $config)?S_SCREENS_BIG:S_SLIDESHOWS_BIG,
+ $p_elements,
+ array($icon,$fs_icon),
+ 'hat_screens',
+ get_profile('web.charts.hats.hat_screens.state',1)
+ );
+
+ $screens_hat->Show();
}
?>
<?php
-include_once "include/page_footer.php";
+include_once 'include/page_footer.php';
?>