diff options
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | frontends/php/exp_imp.php | 11 | ||||
-rw-r--r-- | frontends/php/hosts.php | 9 | ||||
-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 | ||||
-rw-r--r-- | frontends/php/items.php | 31 | ||||
-rw-r--r-- | frontends/php/js/common.js | 4 | ||||
-rw-r--r-- | frontends/php/services.php | 9 | ||||
-rw-r--r-- | frontends/php/styles/css_bb.css | 20 | ||||
-rw-r--r-- | frontends/php/styles/p.css | 22 | ||||
-rw-r--r-- | frontends/php/styles/table.css | 61 | ||||
-rw-r--r-- | frontends/php/styles/ul.css | 13 | ||||
-rw-r--r-- | frontends/php/triggers.php | 10 |
16 files changed, 289 insertions, 271 deletions
@@ -1,5 +1,6 @@ Changes for 1.5.3 + - [DEV-169] improved msg functionality in GUI (Artem) - [DEV-149] added hosts masss update functionality (Artem) - [DEV-167] added support of Host Template=<template> in actions (Sasha) - [DEV-168] added more supported items in FreeBSD, NetBSD and OpenBSD (Sasha) diff --git a/frontends/php/exp_imp.php b/frontends/php/exp_imp.php index 028b2d5f..27255442 100644 --- a/frontends/php/exp_imp.php +++ b/frontends/php/exp_imp.php @@ -137,19 +137,22 @@ include_once "include/page_header.php"; $form->AddItem($cmbConfig); show_table_header($title, $form); - echo SBR; - if($config == 1){ if(isset($_FILES['import_file'])){ include_once "include/import.inc.php"; + DBstart(); + $importer = new CZabbixXMLImport(); $importer->SetRules($rules['host'],$rules['template'],$rules['item'],$rules['trigger'],$rules['graph']); $importer->Parse($_FILES['import_file']['tmp_name']); unset($importer); + + $result = DBend(); + + show_messages($result, S_IMPORTED.SPACE.S_SUCCESSEFULLY_SMALL, S_IMPORT.SPACE.S_FAILED_SMALL); } - show_messages(); $form = new CFormTable($frm_title,null,"post","multipart/form-data"); $form->AddVar('config', $config); @@ -182,7 +185,7 @@ include_once "include/page_header.php"; $form->Show(); } else{ - + echo SBR; if($preview){ $table = new CTableInfo(S_NO_DATA_FOR_EXPORT); $table->SetHeader(array(S_HOST, S_ELEMENTS)); diff --git a/frontends/php/hosts.php b/frontends/php/hosts.php index 59484d54..d14f46c3 100644 --- a/frontends/php/hosts.php +++ b/frontends/php/hosts.php @@ -287,10 +287,7 @@ include_once 'include/page_header.php'; $db_host['host'],$db_host['port'],$db_host['status'],$useip,$db_host['dns'], $db_host['ip'],$db_host['proxy_hostid'],$db_host['templates'],$_REQUEST['newgroup'],$db_host['groups']); - $msg_ok = S_HOST_UPDATED; - $msg_fail = S_CANNOT_UPDATE_HOST; - $audit_action = AUDIT_ACTION_UPDATE; - + if($update && isset($visible['useprofile'])){ $host_profile=DBfetch(DBselect('SELECT * FROM hosts_profiles WHERE hostid='.$hostid)); @@ -314,6 +311,10 @@ include_once 'include/page_header.php'; } $result = DBend(); + + $msg_ok = S_HOSTS.SPACE.S_UPDATED; + $msg_fail = S_CANNOT_UPDATE.SPACE.S_HOSTS; + $audit_action = AUDIT_ACTION_UPDATE; show_messages($result, $msg_ok, $msg_fail); if($result){ 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 ...', diff --git a/frontends/php/items.php b/frontends/php/items.php index e4919679..117f77b1 100644 --- a/frontends/php/items.php +++ b/frontends/php/items.php @@ -237,16 +237,16 @@ include_once "include/page_header.php"; $_REQUEST['filter_snmpv3_securitylevel'] = get_request('filter_snmpv3_securitylevel' ,get_profile('web.items.filter.snmpv3_securitylevel', -1)); $_REQUEST['filter_snmpv3_authpassphrase'] = empty2null(get_request('filter_snmpv3_authpassphrase',get_profile('web.items.filter.snmpv3_authpassphrase'))); $_REQUEST['filter_snmpv3_privpassphrase'] = empty2null(get_request('filter_snmpv3_privpassphrase',get_profile('web.items.filter.snmpv3_privpassphrase'))); - $_REQUEST['filter_value_type'] = get_request('filter_value_type' ,get_profile('web.items.filter.value_type', -1)); - $_REQUEST['filter_units'] = empty2null(get_request('filter_units' ,get_profile('web.items.filter.units'))); - $_REQUEST['filter_formula'] = empty2null(get_request('filter_formula' ,get_profile('web.items.filter.formula'))); - $_REQUEST['filter_delay'] = empty2null(get_request('filter_delay' ,get_profile('web.items.filter.delay'))); - $_REQUEST['filter_history'] = empty2null(get_request('filter_history' ,get_profile('web.items.filter.history'))); - $_REQUEST['filter_trends'] = empty2null(get_request('filter_trends' ,get_profile('web.items.filter.trends'))); - $_REQUEST['filter_status'] = empty2null(get_request('filter_status' ,get_profile('web.items.filter.status'))); - $_REQUEST['filter_logtimefmt'] = empty2null(get_request('filter_logtimefmt' ,get_profile('web.items.filter.logtimefmt'))); - $_REQUEST['filter_delta'] = empty2null(get_request('filter_delta' ,get_profile('web.items.filter.delta'))); - $_REQUEST['filter_trapper_hosts'] = empty2null(get_request('filter_trapper_hosts' ,get_profile('web.items.filter.trapper_hosts'))); + $_REQUEST['filter_value_type'] = get_request('filter_value_type' ,get_profile('web.items.filter.value_type', -1)); + $_REQUEST['filter_units'] = empty2null(get_request('filter_units' ,get_profile('web.items.filter.units'))); + $_REQUEST['filter_formula'] = empty2null(get_request('filter_formula' ,get_profile('web.items.filter.formula'))); + $_REQUEST['filter_delay'] = empty2null(get_request('filter_delay' ,get_profile('web.items.filter.delay'))); + $_REQUEST['filter_history'] = empty2null(get_request('filter_history' ,get_profile('web.items.filter.history'))); + $_REQUEST['filter_trends'] = empty2null(get_request('filter_trends' ,get_profile('web.items.filter.trends'))); + $_REQUEST['filter_status'] = empty2null(get_request('filter_status' ,get_profile('web.items.filter.status'))); + $_REQUEST['filter_logtimefmt'] = empty2null(get_request('filter_logtimefmt' ,get_profile('web.items.filter.logtimefmt'))); + $_REQUEST['filter_delta'] = empty2null(get_request('filter_delta' ,get_profile('web.items.filter.delta'))); + $_REQUEST['filter_trapper_hosts'] = empty2null(get_request('filter_trapper_hosts' ,get_profile('web.items.filter.trapper_hosts'))); } if(isset($_REQUEST['filter_rst'])){ @@ -255,9 +255,9 @@ include_once "include/page_header.php"; $_REQUEST['filter_key'] = null; } else{ - $_REQUEST['filter_host'] = empty2null(get_request('filter_host' ,get_profile('web.items.filter.host'))); - $_REQUEST['filter_description'] = empty2null(get_request('filter_description' ,get_profile('web.items.filter.description'))); - $_REQUEST['filter_key'] = empty2null(get_request('filter_key' ,get_profile('web.items.filter.key'))); + $_REQUEST['filter_host'] = empty2null(get_request('filter_host' ,get_profile('web.items.filter.host'))); + $_REQUEST['filter_description'] = empty2null(get_request('filter_description' ,get_profile('web.items.filter.description'))); + $_REQUEST['filter_key'] = empty2null(get_request('filter_key' ,get_profile('web.items.filter.key'))); } if(isset($_REQUEST['filter_set']) || isset($_REQUEST['filter_rst']) || ($prev_selection_mode != $_REQUEST['selection_mode'])){ @@ -638,13 +638,12 @@ include_once "include/page_header.php"; $form->AddItem(new CButton("form",S_CREATE_ITEM)); show_table_header(S_CONFIGURATION_OF_ITEMS_BIG, $form); - + echo SBR; + if(isset($_REQUEST["form_mass_update"]) && isset($_REQUEST["group_itemid"])){ - echo SBR; insert_mass_update_item_form("group_itemid"); } else if(isset($_REQUEST["form_copy_to"]) && isset($_REQUEST["group_itemid"])){ - echo SBR; insert_copy_elements_to_forms("group_itemid"); } else if (!isset($_REQUEST["form"]) || !str_in_array($_REQUEST["form"],array(S_CREATE_ITEM,"update","clone"))) { diff --git a/frontends/php/js/common.js b/frontends/php/js/common.js index ba8663fd..63286e1b 100644 --- a/frontends/php/js/common.js +++ b/frontends/php/js/common.js @@ -95,8 +95,8 @@ function SDI(msg){ div_help.appendChild(document.createElement("br")); } -function close_window() -{ +function close_window(){ + window.setTimeout("window.close()", 500); /* Solve bug for Internet Explorer */ return false; } diff --git a/frontends/php/services.php b/frontends/php/services.php index cab259fd..ab9bcd13 100644 --- a/frontends/php/services.php +++ b/frontends/php/services.php @@ -119,19 +119,12 @@ $treeServ = del_empty_nodes($treeServ); //---- if(isset($_REQUEST['msg']) && !empty($_REQUEST['msg'])){ - $p = new Ctag('p','yes'); - $p->AddOption('align','center'); - $p->AddOption('id','message'); - $p->AddOption('class','textcolorstyles'); - $p->AddItem(bold($_REQUEST['msg'])); - $p->Show(); + show_messages(true,$_REQUEST['msg']); } - //show_table_header(S_IT_SERVICES_BIG); $tree = new CTree($treeServ,array('caption' => bold(S_SERVICE),'algorithm' => bold(S_STATUS_CALCULATION), 'description' => bold(S_TRIGGER))); - if($tree){ $tab = create_hat( diff --git a/frontends/php/styles/css_bb.css b/frontends/php/styles/css_bb.css index 2e0b0090..2d8c8fb7 100644 --- a/frontends/php/styles/css_bb.css +++ b/frontends/php/styles/css_bb.css @@ -247,6 +247,20 @@ table.history td.caption{ color:#0AF; } +/* MESSAGES */ +table.msgok{ + border: 1px #0088FF solid; +} + +table.msgok td.clr{ + background-color:#0088FF; +} + +table.msgok td.msg{ + background-color:#BBBBFF; +} +/*----------*/ + /*//////////////// DIVS ////////////////////*/ div.zabbix_logo{ @@ -296,12 +310,6 @@ span.green{ color: #0088FF; } -/*//////////////// PARAGRAPHS ////////////////////*/ - -p.msgerror { color: #FF2222; } -p.msgok { color: #0088FF; } - - /*//////////////// FORMS ////////////////////*/ .button:hover { diff --git a/frontends/php/styles/p.css b/frontends/php/styles/p.css index f2982bd4..309ed3eb 100644 --- a/frontends/php/styles/p.css +++ b/frontends/php/styles/p.css @@ -1,20 +1,19 @@ /* CSS Document */ -P {font-family:Verdana, Arial, Helvetica, sans-serif;font-size:8pt; } -P:link {color:black; text-decoration: underline; } -P:visited {color:black; text-decoration: none; } -P:hover {color:black; text-decoration: none;} -P:active {color:black; text-decoration: none;} +P { font-family:Verdana, Arial, Helvetica, sans-serif;font-size:8pt; } +P:link { color:black; text-decoration: underline; } +P:visited { color:black; text-decoration: none; } +P:hover { color:black; text-decoration: none;} +P:active { color:black; text-decoration: none;} -p.uppercase {text-transform: uppercase} -p.margin {margin-left: 10pt} +p.uppercase { text-transform: uppercase;} +p.margin { margin-left: 10pt;} p.msgerror { color: #CC0000; } -p.msgok { color: #223344; } +p.msgok { color: #22AA44; } -p.info -{ +p.info{ font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt; border: 1px dashed #000000; @@ -22,8 +21,7 @@ p.info background-color: #FFFFFF; } -p.error -{ +p.error{ font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt; border: 1px dashed #000000; diff --git a/frontends/php/styles/table.css b/frontends/php/styles/table.css index 6ebedc7d..7a336ee9 100644 --- a/frontends/php/styles/table.css +++ b/frontends/php/styles/table.css @@ -1120,4 +1120,63 @@ table.history td.caption{ text-align:left; } -/**************** </HISTORY> *****************/
\ No newline at end of file +/**************** </HISTORY> *****************/ + + +/***************** <MESSAGE> *****************/ +table.msgok{ + width: 100%; + border: 1px #44CC44 solid; + margin-bottom: 2px; +} + +table.msgok tr{ + height: 26px; +} + +table.msgok td{ + color:#333; + font-family: Verdana, Helvetica, Geneva; + font-size:11px; + text-align:center; +} + +table.msgok td.clr{ + width: 60px; + background-color:#44CC44; + font-size:10px; + font-weight: bold; +} + +table.msgok td.msg{ + background-color:#BBFFBB; +} + +table.msgerr{ + width: 100%; + border: 1px #CC4444 solid; + margin-bottom: 2px; +} + +table.msgerr tr{ + height: 26px; +} + +table.msgerr td{ + color:#333; + font-family: Verdana, Helvetica, Geneva; + font-size:11px; + text-align:center; +} + +table.msgerr td.clr{ + width: 60px; + background-color:#CC4444; + font-size:10px; + font-weight: bold; +} + +table.msgerr td.msg{ + background-color:#FFBBBB; +} +/**************** </MESSAGE> *****************/
\ No newline at end of file diff --git a/frontends/php/styles/ul.css b/frontends/php/styles/ul.css index 24f7acea..8b27ca99 100644 --- a/frontends/php/styles/ul.css +++ b/frontends/php/styles/ul.css @@ -1,6 +1,5 @@ /* CSS Document */ -ul -{ +ul{ margin-left: 0px; padding-left: 1em; } @@ -14,19 +13,17 @@ ul.itservices{ ul.messages{ overflow:auto; vertical-align: top; - border: 1px dashed #000000; background-color: #FFFFFF; - margin: 5px; + margin: 1px; + text-align:left; } -ul.messages li -{ +ul.messages li{ font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt; } -ul.messages li.info -{ +ul.messages li.info{ color:#000000; list-style: url("../images/general/warning_small.gif") inside; } diff --git a/frontends/php/triggers.php b/frontends/php/triggers.php index e53b2599..6a23df77 100644 --- a/frontends/php/triggers.php +++ b/frontends/php/triggers.php @@ -99,6 +99,7 @@ include_once "include/page_header.php"; $available_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_RES_IDS_ARRAY); /* FORM ACTIONS */ + if(isset($_REQUEST['clone']) && isset($_REQUEST['triggerid'])){ unset($_REQUEST['triggerid']); $_REQUEST['form'] = 'clone'; @@ -299,6 +300,13 @@ include_once "include/page_header.php"; } ?> <?php + $form = new CForm(); + $form->SetMethod('get'); + $form->AddItem(new CButton("form",S_CREATE_TRIGGER)); + + show_table_header(S_CONFIGURATION_OF_TRIGGERS_BIG,$form); + echo SBR; + $r_form = new CForm(); $r_form->SetMethod('get'); $r_form->AddItem(array('[', @@ -350,8 +358,6 @@ include_once "include/page_header.php"; $r_form->AddItem(array(SPACE.S_HOST.SPACE,$cmbHosts)); - $r_form->AddItem(array(SPACE, new CButton("form", S_CREATE_TRIGGER))); - show_table_header(S_TRIGGERS_BIG, $r_form); ?> <?php |