diff options
author | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-06-18 14:01:43 +0000 |
---|---|---|
committer | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-06-18 14:01:43 +0000 |
commit | 3a568d3f5e674426fe907fbfb81721994b4fe3db (patch) | |
tree | f06a46552fddf5896be28fb1d1f56fc582c05820 | |
parent | 47df95b3d1a6669b988604a364c341b4094d1525 (diff) | |
download | zabbix-3a568d3f5e674426fe907fbfb81721994b4fe3db.tar.gz zabbix-3a568d3f5e674426fe907fbfb81721994b4fe3db.tar.xz zabbix-3a568d3f5e674426fe907fbfb81721994b4fe3db.zip |
- [DEV-137] fixes & improvements to favorites (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5780 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r-- | frontends/php/charts.php | 8 | ||||
-rw-r--r-- | frontends/php/include/blocks.inc.php | 10 | ||||
-rw-r--r-- | frontends/php/include/db.inc.php | 2 | ||||
-rw-r--r-- | frontends/php/include/defines.inc.php | 2 | ||||
-rw-r--r-- | frontends/php/include/profiles.inc.php | 36 |
5 files changed, 44 insertions, 14 deletions
diff --git a/frontends/php/charts.php b/frontends/php/charts.php index 191e0856..7970bf50 100644 --- a/frontends/php/charts.php +++ b/frontends/php/charts.php @@ -92,7 +92,9 @@ include_once 'include/page_header.php'; $_REQUEST["groupid"] = $_REQUEST["hostid"] = 0; } - $_REQUEST["graphid"] = get_request("graphid", get_profile("web.charts.graphid", 0)); + $_REQUEST["graphid"] = get_request("graphid", get_node_profile("web.charts.graphid", 0));//get_profile("web.charts.graphid", 0)); + if(!in_node($_REQUEST["graphid"])) $_REQUEST["graphid"] = 0; + $_REQUEST["keep"] = get_request("keep", 1); // possible excessed REQUEST variable !!! $_REQUEST["period"] = get_request("period",get_profile("web.graph[".$_REQUEST["graphid"]."].period", ZBX_PERIOD_DEFAULT)); @@ -123,13 +125,13 @@ include_once 'include/page_header.php'; update_profile('web.charts.graphid',$_REQUEST['graphid']); - $h1 = array(S_GRAPHS_BIG.SPACE."/".SPACE); + $h1 = array(S_GRAPHS_BIG.SPACE.'/'.SPACE); $available_groups = get_accessible_groups_by_user($USER_DETAILS,PERM_READ_LIST); $available_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_LIST); $available_graphs = get_accessible_graphs(PERM_READ_LIST, PERM_RES_IDS_ARRAY, get_current_nodeid()); - + if(($_REQUEST['graphid']>0) && ($row=DBfetch(DBselect('SELECT DISTINCT graphid, name FROM graphs WHERE graphid='.$_REQUEST['graphid'])))){ if(!graph_accessible($_REQUEST['graphid'])){ update_profile('web.charts.graphid',0); diff --git a/frontends/php/include/blocks.inc.php b/frontends/php/include/blocks.inc.php index a63dce73..641cb7b1 100644 --- a/frontends/php/include/blocks.inc.php +++ b/frontends/php/include/blocks.inc.php @@ -40,7 +40,7 @@ function make_favorite_graphs(){ $host = get_host_by_itemid($sourceid); $item["description"] = item_description($item["description"],$item["key_"]); - $link = new CLink($host['host'].':'.$item['description'],'history.php?action=showgraph&itemid='.$sourceid); + $link = new CLink(get_node_name_by_elid($sourceid).':'.$host['host'].':'.$item['description'],'history.php?action=showgraph&itemid='.$sourceid); $link->SetTarget('blank'); $capt = new CSpan($link); @@ -56,7 +56,7 @@ function make_favorite_graphs(){ $result = get_hosts_by_graphid($sourceid); $ghost = DBFetch($result); - $link = new CLink($ghost['host'].':'.$graph['name'],'charts.php?graphid='.$sourceid); + $link = new CLink(get_node_name_by_elid($sourceid).$ghost['host'].':'.$graph['name'],'charts.php?graphid='.$sourceid); $link->SetTarget('blank'); $capt = new CSpan($link); @@ -94,7 +94,7 @@ function make_favorite_screens(){ if(!$slide = get_slideshow_by_slideshowid($sourceid)) continue; if(!slideshow_accessible($sourceid, PERM_READ_ONLY)) continue; - $link = new CLink($slide['name'],'screens.php?config=1&elementid='.$sourceid); + $link = new CLink(get_node_name_by_elid($sourceid).$slide['name'],'screens.php?config=1&elementid='.$sourceid); $link->SetTarget('blank'); $capt = new CSpan($link); @@ -107,7 +107,7 @@ function make_favorite_screens(){ if(!$screen = get_screen_by_screenid($sourceid)) continue; if(!screen_accessible($sourceid, PERM_READ_ONLY)) continue; - $link = new CLink($screen['name'],'screens.php?config=0&elementid='.$sourceid); + $link = new CLink(get_node_name_by_elid($sourceid).$screen['name'],'screens.php?config=0&elementid='.$sourceid); $link->SetTarget('blank'); $capt = new CSpan($link); @@ -146,7 +146,7 @@ function make_favorite_maps(){ if(!$sysmap = get_sysmap_by_sysmapid($sourceid)) continue; if(!sysmap_accessible($sourceid,PERM_READ_ONLY)) continue; - $link = new CLink($sysmap['name'],'maps.php?sysmapid='.$sourceid); + $link = new CLink(get_node_name_by_elid($sourceid).$sysmap['name'],'maps.php?sysmapid='.$sourceid); $link->SetTarget('blank'); $capt = new CSpan($link); diff --git a/frontends/php/include/db.inc.php b/frontends/php/include/db.inc.php index 49f52478..38e412c4 100644 --- a/frontends/php/include/db.inc.php +++ b/frontends/php/include/db.inc.php @@ -654,7 +654,7 @@ else { $nodes = explode(',', $nodes); } - else if (!is_array($nodes)){ + else if(!is_array($nodes)){ fatal_error('Incorrect type of "nodes" for "in_node". Passed ['.gettype($nodes).']'); } diff --git a/frontends/php/include/defines.inc.php b/frontends/php/include/defines.inc.php index e90f817a..0e7024a8 100644 --- a/frontends/php/include/defines.inc.php +++ b/frontends/php/include/defines.inc.php @@ -19,7 +19,7 @@ **/ ?> <?php - define('ZABBIX_VERSION','1.5.3'); + define('ZABBIX_VERSION','1.5.4'); define('ZBX_AUTH_INTERNAL', 0); define('ZBX_AUTH_LDAP', 1); diff --git a/frontends/php/include/profiles.inc.php b/frontends/php/include/profiles.inc.php index 668e7ce6..c2be5fc3 100644 --- a/frontends/php/include/profiles.inc.php +++ b/frontends/php/include/profiles.inc.php @@ -90,6 +90,11 @@ function get_multi_profile($idx,$default_value=array(),$type=PROFILE_TYPE_UNKNOW return $result; } +function get_node_profile($idx,$default_value=null,$nodeid=null){ + $profile = profiles_in_node(get_profile($idx,$default_value),$nodeid); +return (zbx_empty($profile))?$default_value:$profile; +} + //----------- ADD/EDIT USERPROFILE ------------- function update_profile($idx,$value,$type=PROFILE_TYPE_UNKNOWN,$source=null){ global $USER_DETAILS; @@ -328,11 +333,10 @@ return $result; /********* END USER HISTORY **********/ /********** USER FAVORITES ***********/ -/********** USER FAVORITES ***********/ // Author: Aly function get_favorites($favobj,$nodeid=null){ $fav = get_multi_profile($favobj); - + if(is_null($nodeid)) $nodeid = get_current_nodeid(); @@ -347,7 +351,7 @@ return $fav; } // Author: Aly function add2favorites($favobj,$favid,$source=null){ - $favorites = get_favorites($favobj); + $favorites = get_favorites($favobj,get_current_nodeid(true)); $favorites[] = array('value' => $favid); @@ -357,7 +361,7 @@ return $result; // Author: Aly function rm4favorites($favobj,$favid,$favcnt=null,$source=null){ - $favorites = get_favorites($favobj); + $favorites = get_favorites($favobj,get_current_nodeid(true)); $favcnt = (is_null($favcnt))?0:$favcnt; if($favid == 0) $favcnt = ZBX_FAVORITES_ALL; @@ -391,4 +395,28 @@ function infavorites($favobj,$favid,$source=null){ return false; } /********** END USER FAVORITES ***********/ + +/********** MISC ***********/ + +function profiles_in_node($profile, $nodeid=null){ + if(is_null($nodeid)) + $nodeid = get_current_nodeid(); + + if(!is_array($nodeid)) + $nodeid = array($nodeid); + + if(is_array($profile)){ + foreach($profile as $key => $value){ + $value = profiles_in_node($value,$nodeid); + if(!zbx_empty($value)) $profile[$key] = $value; + else unset($profile[$key]); + } + } + else if(is_numeric($profile)){ + if(!uint_in_array(id2nodeid($profile),$nodeid)) $profile = null;; + } + +return $profile; +} +/********** END MISC ***********/ ?>
\ No newline at end of file |