diff options
| author | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-05-10 10:55:37 +0000 |
|---|---|---|
| committer | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-05-10 10:55:37 +0000 |
| commit | 20d8801440d4dc03c213e59cd278183bb37f24b2 (patch) | |
| tree | e0acb0ec925da22ed6b1fab81b2d547670bbf050 /frontends/php/include | |
| parent | 8bfb00dbb5a1c423236630cddfeaa5ee74ab9659 (diff) | |
| download | zabbix-20d8801440d4dc03c213e59cd278183bb37f24b2.tar.gz zabbix-20d8801440d4dc03c213e59cd278183bb37f24b2.tar.xz zabbix-20d8801440d4dc03c213e59cd278183bb37f24b2.zip | |
- [DEV-169] improved msg functionality in GUI (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5694 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include')
| -rw-r--r-- | frontends/php/include/config.inc.php | 210 | ||||
| -rw-r--r-- | frontends/php/include/db.inc.php | 11 | ||||
| -rw-r--r-- | frontends/php/include/hosts.inc.php | 112 | ||||
| -rw-r--r-- | frontends/php/include/html.inc.php | 2 | ||||
| -rw-r--r-- | frontends/php/include/locales/en_gb.inc.php | 34 |
5 files changed, 161 insertions, 208 deletions
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php index 5ae59406..f4e2793b 100644 --- a/frontends/php/include/config.inc.php +++ b/frontends/php/include/config.inc.php @@ -310,7 +310,7 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! return $forse_with_subnodes; } - function access_deny(){ + function access_deny(){ include_once "include/page_header.php"; show_error_message(S_NO_PERMISSIONS); @@ -463,32 +463,27 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! return $val; } - function mem2str($size) - { + function mem2str($size){ $prefix = 'B'; if($size > 1048576) { $size = $size/1048576; $prefix = 'M'; } elseif($size > 1024) { $size = $size/1024; $prefix = 'K'; } return round($size, 6).$prefix; } - function getmicrotime() - { + function getmicrotime(){ list($usec, $sec) = explode(" ",microtime()); return ((float)$usec + (float)$sec); } /* Do not forget to sync it with add_value_suffix in evalfunc.c! */ - function convert_units($value,$units) - { + function convert_units($value,$units){ // Special processing for unix timestamps - if($units=="unixtime") - { + if($units=="unixtime"){ $ret=date("Y.m.d H:i:s",$value); return $ret; } //Special processing of uptime - if($units=="uptime") - { + if($units=="uptime"){ $ret=""; $days=floor($value/(24*3600)); if($days>0) @@ -516,8 +511,7 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! return $ret; } // Special processing for seconds - if($units=="s") - { + if($units=="s"){ $ret=""; $t=floor($value/(365*24*3600)); @@ -558,8 +552,7 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! $u=""; // Special processing for bits (kilo=1000, not 1024 for bits) - if( ($units=="b") || ($units=="bps")) - { + if( ($units=="b") || ($units=="bps")){ $abs=abs($value); if($abs<1000) @@ -595,8 +588,7 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! } - if($units=="") - { + if($units==""){ if(round($value) == round($value,2)) { return sprintf("%.0f",$value); @@ -609,37 +601,30 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! $abs=abs($value); - if($abs<1024) - { + if($abs<1024){ $u=""; } - else if($abs<1024*1024) - { + else if($abs<1024*1024){ $u="K"; $value=$value/1024; } - else if($abs<1024*1024*1024) - { + else if($abs<1024*1024*1024){ $u="M"; $value=$value/(1024*1024); } - else if($abs<1024*1024*1024*1024) - { + else if($abs<1024*1024*1024*1024){ $u="G"; $value=$value/(1024*1024*1024); } - else - { + else{ $u="T"; $value=$value/(1024*1024*1024*1024); } - if(round($value) == round($value,2)) - { + if(round($value) == round($value,2)){ $s=sprintf("%.0f",$value); } - else - { + else{ $s=sprintf("%.2f",$value); } @@ -648,8 +633,7 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! // The hash has form <md5sum of triggerid>,<sum of priorities> - function calc_trigger_hash() - { + function calc_trigger_hash(){ $priority = array(0=>0, 1=>0, 2=>0, 3=>0, 4=>0, 5=>0); $triggerids=""; @@ -657,8 +641,7 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! $result=DBselect('select t.triggerid,t.priority from triggers t,hosts h,items i,functions f'. ' where t.value=1 and f.itemid=i.itemid and h.hostid=i.hostid and t.triggerid=f.triggerid and i.status=0'); - while($row=DBfetch($result)) - { + while($row=DBfetch($result)){ $ack = get_last_event_by_triggerid($row["triggerid"]); if($ack["acknowledged"] == 1) continue; @@ -674,22 +657,18 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! return "$priorities,$md5sum"; } - function select_config() - { + function select_config(){ $row=DBfetch(DBselect("select * from config where ".DBin_node("configid", get_current_nodeid(false)))); - if($row) - { + if($row){ return $row; } - else - { + else{ error("Unable to select configuration"); } return $row; } - function show_messages($bool=TRUE,$okmsg=NULL,$errmsg=NULL) - { + function show_messages($bool=TRUE,$okmsg=NULL,$errmsg=NULL){ global $page, $ZBX_MESSAGES; if (! defined('PAGE_HEADER_LOADED')) return; @@ -703,10 +682,8 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! if(!$bool && !is_null($errmsg)) $msg="ERROR: ".$errmsg; else if($bool && !is_null($okmsg)) $msg=$okmsg; - if(isset($msg)) - { - switch($page["type"]) - { + if(isset($msg)){ + switch($page["type"]){ case PAGE_TYPE_IMAGE: array_push($message, array( 'text' => $msg, @@ -720,32 +697,37 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! break; case PAGE_TYPE_HTML: default: - $p = new CTag('p','yes'); - $p->AddOption('align','center'); - $p->AddOption('class',((!$bool)?'msgerror':'msgok')); - $p->AddItem(bold('['.$msg.']')); - $p->Show(); + $msg_tab = new CTable($msg,($bool?'msgok':'msgerr')); + $msg_tab->SetCellPadding(0); + $msg_tab->SetCellSpacing(0); + + $msg_col = new CCol(bold($msg),'msg'); + + $msg_details = SPACE; + if(isset($ZBX_MESSAGES) && !empty($ZBX_MESSAGES)){ + $msg_details = new CDiv(S_DETAILS,'pointer'); + $msg_details->AddAction('onclick',new CScript("javascript: ShowHide('msg_messages', IE?'block':'table');")); + $msg_details->AddOption('title',S_MAXIMIZE.'/'.S_MINIMIZE); + } + + $msg_tab->AddRow(array(new CCol($msg_details,'clr'),$msg_col)); + $msg_tab->Show(); break; } } - if(isset($ZBX_MESSAGES)) - { - if($page["type"] == PAGE_TYPE_IMAGE) - { + if(isset($ZBX_MESSAGES)){ + if($page["type"] == PAGE_TYPE_IMAGE){ $msg_font = 2; - foreach($ZBX_MESSAGES as $msg) - { - if($msg['type'] == 'error') - { + foreach($ZBX_MESSAGES as $msg){ + if($msg['type'] == 'error'){ array_push($message, array( 'text' => $msg['message'], 'color' => array('R'=>255,'G'=>55,'B'=>55), 'font' => $msg_font)); } - else - { + else{ array_push($message, array( 'text' => $msg['message'], 'color' => array('R'=>155,'G'=>155,'B'=>55), @@ -755,44 +737,52 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! $height += imagefontheight($msg_font) + 1; } } - elseif($page["type"] == PAGE_TYPE_XML) - { - foreach($ZBX_MESSAGES as $msg) - { + else if($page["type"] == PAGE_TYPE_XML){ + foreach($ZBX_MESSAGES as $msg){ echo '['.$msg['type'].'] '.$msg['message']."\n"; } } - else - { + else{ $lst_error = new CList(null,'messages'); - foreach($ZBX_MESSAGES as $msg) + + foreach($ZBX_MESSAGES as $msg){ $lst_error->AddItem($msg['message'], $msg['type']); + $bool &= ('error' != strtolower($msg['type'])); + } //message scroll if needed $msg_show = 6; - $msg_font_size = 7; + $msg_font_size = 6; $msg_count = count($ZBX_MESSAGES); if($msg_count > $msg_show) $msg_count = $msg_show; $msg_count = ($msg_count * $msg_font_size * 4) + 2; $lst_error->AddOption('style','font-size: '.$msg_font_size.'pt; height: '.$msg_count.'px;'); -//--- - $lst_error->Show(); - unset($lst_error); + + $tab = new CTable(null,($bool?'msgok':'msgerr')); + + $tab->SetCellPadding(0); + $tab->SetCellSpacing(0); + + $tab->AddOption('id','msg_messages'); + $tab->AddOption('style','display: none; width: 100%;'); + + $tab->AddRow(new CCol($lst_error,'msg')); + $tab->Show(); +//--- } $ZBX_MESSAGES = null; } - - if($page["type"] == PAGE_TYPE_IMAGE && count($message) > 0) - { + + if($page["type"] == PAGE_TYPE_IMAGE && count($message) > 0){ $width += 2; $height += 2; $canvas = imagecreate($width, $height); ImageFilledRectangle($canvas,0,0,$width,$height, ImageColorAllocate($canvas, 255, 255, 255)); - foreach($message as $id => $msg) - { + foreach($message as $id => $msg){ + $message[$id]['y'] = 1 + (isset($previd) ? $message[$previd]['y'] + $message[$previd]['h'] : 0 ); $message[$id]['h'] = imagefontheight($msg['font']); @@ -812,23 +802,19 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! } } - function show_message($msg) - { + function show_message($msg){ show_messages(TRUE,$msg,''); } - function show_error_message($msg) - { + function show_error_message($msg){ show_messages(FALSE,'',$msg); } - function parse_period($str) - { + function parse_period($str){ $out = NULL; $str = trim($str,';'); $periods = split(';',$str); - foreach($periods as $preiod) - { + foreach($periods as $preiod){ if(!ereg('^([1-7])-([1-7]),([0-9]{1,2}):([0-9]{1,2})-([0-9]{1,2}):([0-9]{1,2})$', $preiod, $arr)) return NULL; for($i = $arr[1]; $i <= $arr[2]; $i++) @@ -846,14 +832,12 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! return $out; } - function find_period_start($periods,$time) - { + function find_period_start($periods,$time){ $date = getdate($time); $wday = $date['wday'] == 0 ? 7 : $date['wday']; $curr = $date['hours']*100+$date['minutes']; - if(isset($periods[$wday])) - { + if(isset($periods[$wday])){ $next_h = -1; $next_m = -1; foreach($periods[$wday] as $period) @@ -877,8 +861,7 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! return mktime($next_h, $next_m, 0, $date['mon'], $date['mday'], $date['year']); } } - for($days=1; $days < 7 ; ++$days) - { + for($days=1; $days < 7 ; ++$days){ $new_wday = (($wday + $days - 1)%7 + 1); if(isset($periods[$new_wday ])) { @@ -902,14 +885,12 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! return -1; } - function find_period_end($periods,$time,$max_time) - { + function find_period_end($periods,$time,$max_time){ $date = getdate($time); $wday = $date['wday'] == 0 ? 7 : $date['wday']; $curr = $date['hours']*100+$date['minutes']; - if(isset($periods[$wday])) - { + if(isset($periods[$wday])){ $next_h = -1; $next_m = -1; foreach($periods[$wday] as $period) @@ -944,13 +925,11 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! return -1; } - function validate_period(&$str) - { + function validate_period(&$str){ $str = trim($str,';'); $out = ""; $periods = split(';',$str); - foreach($periods as $preiod) - { + foreach($periods as $preiod){ // arr[idx] 1 2 3 4 5 6 if(!ereg('^([1-7])-([1-7]),([0-9]{1,2}):([0-9]{1,2})-([0-9]{1,2}):([0-9]{1,2})$', $preiod, $arr)) return false; @@ -973,25 +952,20 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! return true; } - function validate_float($str) - { + function validate_float($str){ // echo "Validating float:$str<br>"; - if (eregi('^[ ]*([0-9]+)((\.)?)([0-9]*[KMG]{0,1})[ ]*$', $str, $arr)) - { + if (eregi('^[ ]*([0-9]+)((\.)?)([0-9]*[KMG]{0,1})[ ]*$', $str, $arr)) { return 0; } - else - { + else{ return -1; } } // Check if str has format #<float> or <float> - function validate_ticks($str) - { + function validate_ticks($str){ // echo "Validating float:$str<br>"; - if (eregi('^[ ]*#([0-9]+)((\.)?)([0-9]*)[ ]*$', $str, $arr)) - { + if (eregi('^[ ]*#([0-9]+)((\.)?)([0-9]*)[ ]*$', $str, $arr)) { return 0; } else return validate_float($str); @@ -999,8 +973,7 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! # Add event - function get_event_by_eventid($eventid) - { + function get_event_by_eventid($eventid){ $db_events = DBselect("select * from events where eventid=$eventid"); return DBfetch($db_events); } @@ -1016,8 +989,7 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! function reset_items_nextcheck($triggerid){ $sql="select itemid from functions where triggerid=$triggerid"; $result=DBselect($sql); - while($row=DBfetch($result)) - { + while($row=DBfetch($result)){ $sql="update items set nextcheck=0 where itemid=".$row["itemid"]; DBexecute($sql); } @@ -1092,8 +1064,7 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! $status["zabbix_server"] = S_NO; } // history & trends -/* if ($DB['DB_TYPE'] == "MYSQL") - { +/* if ($DB['DB_TYPE'] == "MYSQL"){ $row=DBfetch(DBselect("show table status like 'history'")); $status["history_count"] = $row["Rows"]; $row=DBfetch(DBselect("show table status like 'history_log'")); @@ -1106,8 +1077,7 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! $row=DBfetch(DBselect("show table status like 'trends'")); $status["trends_count"] = $row["Rows"]; } - else - { + else{ $row=DBfetch(DBselect("select count(itemid) as cnt from history")); $status["history_count"] = $row["cnt"]; $row=DBfetch(DBselect("select count(itemid) as cnt from history_log")); @@ -1508,13 +1478,13 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!! * * author: Eugene Grigorjev */ - function zbx_set_post_cookie($name, $value, $time=null){ + function zbx_set_post_cookie($name, $value, $time=null){ global $ZBX_PAGE_COOKIES; $ZBX_PAGE_COOKIES[] = array($name, $value, isset($time) ? $time : (0)); } - function inarr_isset($keys, $array=null){ + function inarr_isset($keys, $array=null){ if(is_null($array)) $array =& $_REQUEST; if(is_array($keys)){ diff --git a/frontends/php/include/db.inc.php b/frontends/php/include/db.inc.php index e7d4b644..9656de35 100644 --- a/frontends/php/include/db.inc.php +++ b/frontends/php/include/db.inc.php @@ -270,6 +270,8 @@ if(empty($result)) $result = $DB['TRANSACTION_STATE']; + +//SDI('Result: '.$result); if($result){ // OK $result = DBcommit(); @@ -415,6 +417,12 @@ break; } + if($DB['TRANSACTIONS'] && !$result){ + $DB['TRANSACTION_STATE'] &= $result; +// SDI($query); +// SDI($DB['TRANSACTION_STATE']); + } + return $result; } @@ -470,7 +478,8 @@ } break; } - if($DB['TRANSACTIONS']){ + + if($DB['TRANSACTIONS'] && !$result){ $DB['TRANSACTION_STATE'] &= $result; // SDI($query); // SDI($DB['TRANSACTION_STATE']); diff --git a/frontends/php/include/hosts.inc.php b/frontends/php/include/hosts.inc.php index b69d986b..5f7340f2 100644 --- a/frontends/php/include/hosts.inc.php +++ b/frontends/php/include/hosts.inc.php @@ -24,8 +24,7 @@ require_once "include/triggers.inc.php"; require_once "include/items.inc.php"; /* HOST GROUP functions */ - function add_host_to_group($hostid, $groupid) - { + function add_host_to_group($hostid, $groupid){ if(!is_numeric($hostid) || !is_numeric($groupid)){ error("incorrect parameters for 'add_host_to_group' [hostid:".$hostid."][groupid:".$groupid."]"); return false; @@ -37,8 +36,7 @@ require_once "include/items.inc.php"; return $hostgroupid; } - function delete_host_from_group($hostid, $groupid) - { + function delete_host_from_group($hostid, $groupid){ if(!is_numeric($hostid) || !is_numeric($groupid)){ error("incorrect parameters for 'add_host_to_group' [hostid:".$hostid."][groupid:".$groupid."]"); return false; @@ -58,8 +56,7 @@ require_once "include/items.inc.php"; * Comments: * */ - function db_save_group($name,$groupid=null) - { + function db_save_group($name,$groupid=null){ if(!is_string($name)){ error("incorrect parameters for 'db_save_group'"); return false; @@ -87,8 +84,7 @@ require_once "include/items.inc.php"; return DBexecute("update groups set name=".zbx_dbstr($name)." where groupid=$groupid"); } - function add_group_to_host($hostid,$newgroup="") - { + function add_group_to_host($hostid,$newgroup=""){ if(empty($newgroup)) return true; @@ -99,8 +95,7 @@ require_once "include/items.inc.php"; return add_host_to_group($hostid, $groupid); } - function update_host_groups_by_groupid($groupid,$hosts=array()) - { + function update_host_groups_by_groupid($groupid,$hosts=array()){ DBexecute("delete from hosts_groups where groupid=$groupid"); foreach($hosts as $hostid) @@ -109,8 +104,7 @@ require_once "include/items.inc.php"; } } - function update_host_groups($hostid,$groups=array()) - { + function update_host_groups($hostid,$groups=array()){ DBexecute("delete from hosts_groups where hostid=$hostid"); foreach($groups as $groupid) @@ -119,8 +113,7 @@ require_once "include/items.inc.php"; } } - function add_host_group($name,$hosts=array()) - { + function add_host_group($name,$hosts=array()){ $groupid = db_save_group($name); if(!$groupid) return $groupid; @@ -130,8 +123,7 @@ require_once "include/items.inc.php"; return $groupid; } - function update_host_group($groupid,$name,$hosts) - { + function update_host_group($groupid,$name,$hosts){ $result = db_save_group($name,$groupid); if(!$result) return $result; @@ -155,8 +147,7 @@ require_once "include/items.inc.php"; * NOTE: templates = array(id => name, id2 => name2, ...) * */ - function check_circle_host_link($hostid, $templates) - { + function check_circle_host_link($hostid, $templates){ if(count($templates) == 0) return false; if(isset($templates[$hostid])) return true; foreach($templates as $id => $name) @@ -180,8 +171,7 @@ require_once "include/items.inc.php"; * * NOTE: templates = array(id => name, id2 => name2, ...) */ - function db_save_host($host,$port,$status,$useip,$dns,$ip,$proxy_hostid,$templates,$hostid=null) - { + function db_save_host($host,$port,$status,$useip,$dns,$ip,$proxy_hostid,$templates,$hostid=null){ if( !eregi('^'.ZBX_EREG_HOST_FORMAT.'$', $host) ) { error("Incorrect characters used for Hostname"); @@ -254,8 +244,7 @@ require_once "include/items.inc.php"; * * NOTE: templates = array(id => name, id2 => name2, ...) */ - function add_host($host,$port,$status,$useip,$dns,$ip,$proxy_hostid,$templates,$newgroup,$groups) - { + function add_host($host,$port,$status,$useip,$dns,$ip,$proxy_hostid,$templates,$newgroup,$groups){ $hostid = db_save_host($host,$port,$status,$useip,$dns,$ip,$proxy_hostid,$templates); if(!$hostid) return $hostid; @@ -344,8 +333,7 @@ require_once "include/items.inc.php"; * Comments: !!! Don't forget sync code with C !!! * */ - function delete_template_elements($hostid, $templateid = null, $unlink_mode = false) - { + function delete_template_elements($hostid, $templateid = null, $unlink_mode = false){ delete_template_graphs($hostid, $templateid, $unlink_mode); delete_template_triggers($hostid, $templateid, $unlink_mode); delete_template_items($hostid, $templateid, $unlink_mode); @@ -365,8 +353,7 @@ require_once "include/items.inc.php"; * Comments: !!! Don't forget sync code with C !!! * */ - function copy_template_elements($hostid, $templateid = null, $copy_mode = false) - { + function copy_template_elements($hostid, $templateid = null, $copy_mode = false){ copy_template_applications($hostid, $templateid, $copy_mode); copy_template_items($hostid, $templateid, $copy_mode); copy_template_triggers($hostid, $templateid, $copy_mode); @@ -385,14 +372,12 @@ require_once "include/items.inc.php"; * Comments: !!! Don't forget sync code with C !!! * */ - function sync_host_with_templates($hostid, $templateid = null) - { + function sync_host_with_templates($hostid, $templateid = null){ delete_template_elements($hostid, $templateid); copy_template_elements($hostid, $templateid); } - function delete_groups_by_hostid($hostid) - { + function delete_groups_by_hostid($hostid){ $sql="select groupid from hosts_groups where hostid=$hostid"; $result=DBselect($sql); while($row=DBfetch($result)) @@ -464,8 +449,7 @@ require_once "include/items.inc.php"; return DBexecute("delete from hosts where hostid=$hostid"); } - function delete_host_group($groupid) - { + function delete_host_group($groupid){ if(!delete_sysmaps_elements_with_groupid($groupid)) return false; @@ -629,15 +613,16 @@ require_once "include/items.inc.php"; */ function get_templates_by_hostid($hostid){ $result = array(); - $db_templates = DBselect('select distinct h.hostid,h.host '. - ' from hosts_templates ht '. - ' left join hosts h on h.hostid=ht.templateid '. - ' where ht.hostid='.$hostid); + $db_templates = DBselect('SELECT DISTINCT h.hostid,h.host '. + ' FROM hosts_templates ht '. + ' LEFT JOIN hosts h ON h.hostid=ht.templateid '. + ' WHERE ht.hostid='.$hostid); while($template_data = DBfetch($db_templates)){ $result[$template_data['hostid']] = $template_data['host']; } - return $result; + + return $result; } /* @@ -653,23 +638,20 @@ require_once "include/items.inc.php"; * Comments: * */ - function validate_group_with_templates($perm, $options = array(),$group_var=null,$host_var=null) - { + function validate_group_with_templates($perm, $options = array(),$group_var=null,$host_var=null){ if(is_null($group_var)) $group_var = "web.latest.groupid"; if(is_null($host_var)) $host_var = "web.latest.hostid"; $_REQUEST["groupid"] = get_request("groupid", -1 ); $_REQUEST["hostid"] = get_request("hostid", get_profile($host_var,0)); - if($_REQUEST["groupid"] == -1) - { + if($_REQUEST["groupid"] == -1){ $_REQUEST["groupid"] = get_profile($group_var,0); if(!in_node($_REQUEST["groupid"])) $_REQUEST["groupid"] = 0; - if ($_REQUEST["hostid"] > 0 && !DBfetch(DBselect('select groupid from hosts_groups '. - ' where hostid='.$_REQUEST["hostid"].' and groupid='.$_REQUEST["groupid"]))) - { + if ($_REQUEST["hostid"] > 0 && !DBfetch(DBselect('SELECT groupid FROM hosts_groups '. + ' WHERE hostid='.$_REQUEST["hostid"].' and groupid='.$_REQUEST["groupid"]))){ $_REQUEST["groupid"] = 0; } } @@ -854,8 +836,7 @@ require_once "include/items.inc.php"; * Comments: * */ - function validate_group_with_host($perm, $options = array(),$group_var=null,$host_var=null) - { + function validate_group_with_host($perm, $options = array(),$group_var=null,$host_var=null){ if(is_null($group_var)) $group_var = "web.latest.groupid"; if(is_null($host_var)) $host_var = "web.latest.hostid"; @@ -925,8 +906,7 @@ require_once "include/items.inc.php"; * Comments: !!! Don't forget sync code with C !!! * If applicationid is NULL add application, in other cases update */ - function db_save_application($name,$hostid,$applicationid=null,$templateid=0) - { + function db_save_application($name,$hostid,$applicationid=null,$templateid=0){ if(!is_string($name)){ error("incorrect parameters for 'db_save_application'"); return false; @@ -1014,8 +994,7 @@ require_once "include/items.inc.php"; * Eugene Grigorjev (eugene.grigorjev@zabbix.com) * */ - function add_application($name,$hostid,$templateid=0) - { + function add_application($name,$hostid,$templateid=0){ return db_save_application($name,$hostid,null,$templateid); } @@ -1029,8 +1008,7 @@ require_once "include/items.inc.php"; * Eugene Grigorjev (eugene.grigorjev@zabbix.com) * */ - function update_application($applicationid,$name,$hostid,$templateid=0) - { + function update_application($applicationid,$name,$hostid,$templateid=0){ return db_save_application($name,$hostid,$applicationid,$templateid); } @@ -1046,8 +1024,7 @@ require_once "include/items.inc.php"; * Comments: !!! Don't forget sync code with C !!! * */ - function delete_application($applicationid) - { + function delete_application($applicationid){ $app = get_application_by_applicationid($applicationid); $host = get_host_by_hostid($app["hostid"]); @@ -1083,8 +1060,7 @@ require_once "include/items.inc.php"; return $result; } - function get_application_by_applicationid($applicationid,$no_error_message=0) - { + function get_application_by_applicationid($applicationid,$no_error_message=0){ $result = DBselect("select * from applications where applicationid=".$applicationid); $row=DBfetch($result); if($row) @@ -1097,13 +1073,11 @@ require_once "include/items.inc.php"; } - function get_applications_by_templateid($applicationid) - { + function get_applications_by_templateid($applicationid){ return DBselect("select * from applications where templateid=".$applicationid); } - function get_realhost_by_applicationid($applicationid) - { + function get_realhost_by_applicationid($applicationid){ $application = get_application_by_applicationid($applicationid); if($application["templateid"] > 0) return get_realhost_by_applicationid($application["templateid"]); @@ -1111,8 +1085,7 @@ require_once "include/items.inc.php"; return get_host_by_applicationid($applicationid); } - function get_host_by_applicationid($applicationid) - { + function get_host_by_applicationid($applicationid){ $sql="select h.* from hosts h, applications a where a.hostid=h.hostid and a.applicationid=$applicationid"; $result=DBselect($sql); $row=DBfetch($result); @@ -1124,13 +1097,11 @@ require_once "include/items.inc.php"; return false; } - function get_items_by_applicationid($applicationid) - { + function get_items_by_applicationid($applicationid){ return DBselect("select i.* from items i,items_applications ia where i.itemid=ia.itemid and ia.applicationid=$applicationid"); } - function get_applications_by_hostid($hostid) - { + function get_applications_by_hostid($hostid){ return DBselect('select * from applications where hostid='.$hostid); } @@ -1148,8 +1119,7 @@ require_once "include/items.inc.php"; * $templateid can be numeric or numeric array * */ - function delete_template_applications($hostid, $templateid = null, $unlink_mode = false) - { + function delete_template_applications($hostid, $templateid = null, $unlink_mode = false){ $db_apps = get_applications_by_hostid($hostid); while($db_app = DBfetch($db_apps)){ if($db_app["templateid"] == 0) @@ -1201,8 +1171,7 @@ require_once "include/items.inc.php"; * $templateid can be numeric or numeric array * */ - function copy_template_applications($hostid, $templateid = null, $copy_mode = false) - { + function copy_template_applications($hostid, $templateid = null, $copy_mode = false){ if(null == $templateid) { $templateid = array_keys(get_templates_by_hostid($hostid)); @@ -1239,8 +1208,7 @@ require_once "include/items.inc.php"; * $templateid_list can be numeric or numeric array * */ - function validate_templates($templateid_list) - { + function validate_templates($templateid_list){ if(is_numeric($templateid_list))return true; if(!is_array($templateid_list)) return false; if(count($templateid_list)<2) return true; diff --git a/frontends/php/include/html.inc.php b/frontends/php/include/html.inc.php index a84b2139..5771e868 100644 --- a/frontends/php/include/html.inc.php +++ b/frontends/php/include/html.inc.php @@ -157,7 +157,7 @@ $icon = new CDiv(SPACE,($state)?'filteropened':'filterclosed'); $icon->AddAction('onclick',new CScript("javascript: change_filter_state(this,'".$id."');")); - $icon->AddOption('title',S_SHOW.'/'.S_HIDE.' '.S_FILTER); + $icon->AddOption('title',S_MAXIMIZE.'/'.S_MINIMIZE); $icon->AddAction('id','filter_icon'); $td_icon = new CCol($icon); diff --git a/frontends/php/include/locales/en_gb.inc.php b/frontends/php/include/locales/en_gb.inc.php index 1da40e20..98cfb807 100644 --- a/frontends/php/include/locales/en_gb.inc.php +++ b/frontends/php/include/locales/en_gb.inc.php @@ -164,6 +164,9 @@ 'S_EXISTING'=> 'Existing', 'S_MISSING'=> 'Missing', 'S_REFRESH'=> 'Refresh', + 'S_IMPORTED'=> 'Imported', + 'S_SUCCESSEFULLY_SMALL'=> 'successfuly', + 'S_FAILED_SMALL'=> 'failed', // admin.php 'S_PREVIOUS'=> '<< Previous', @@ -652,6 +655,7 @@ 'S_CANNOT_ADD_ITEMS'=> 'Cannot add items', 'S_HOST_UPDATED'=> 'Host updated', 'S_CANNOT_UPDATE_HOST'=> 'Cannot update host', + 'S_CANNOT_UPDATE'=> 'Cannot update', 'S_HOST_STATUS_UPDATED'=> 'Host status updated', 'S_CANNOT_UPDATE_HOST_STATUS'=> 'Cannot update host status', 'S_HOST_DELETED'=> 'Host deleted', @@ -961,20 +965,22 @@ 'S_SWITCH_NODE'=> 'Switch node', // dashbord.php - 'S_DASHBOARD'=> 'Dashboard', - 'S_DASHBOARD_BIG'=> 'PERSONAL DASHBOARD', - 'S_SWITCH_VIEW'=> 'Switch view', - 'S_AGE'=> 'Age', - 'S_ISSUE'=> 'Issue', - 'S_ISSUES'=> 'Issues', - 'S_SYSTEM_STATUS'=> 'System status', - 'S_LATEST_ISSUES'=> 'Latest issues', - 'S_FAVORITE'=> 'Favorite', - 'S_FAVORITES'=> 'Favorites', - 'S_EVERY'=> 'Every', - 'S_REFRESHED'=> 'Refreshed', - 'S_MENU'=> 'Menu', - 'S_RESET'=> 'Reset', + 'S_DASHBOARD'=> 'Dashboard', + 'S_DASHBOARD_BIG'=> 'PERSONAL DASHBOARD', + 'S_SWITCH_VIEW'=> 'Switch view', + 'S_AGE'=> 'Age', + 'S_ISSUE'=> 'Issue', + 'S_ISSUES'=> 'Issues', + 'S_SYSTEM_STATUS'=> 'System status', + 'S_LATEST_ISSUES'=> 'Latest issues', + 'S_FAVORITE'=> 'Favorite', + 'S_FAVORITES'=> 'Favorites', + 'S_EVERY'=> 'Every', + 'S_REFRESHED'=> 'Refreshed', + 'S_MENU'=> 'Menu', + 'S_RESET'=> 'Reset', + 'S_MAXIMIZE'=> 'Maximize', + 'S_MINIMIZE'=> 'Minimize', // overview.php 'S_SELECT_GROUP_DOT_DOT_DOT'=> 'Select group ...', |
