array(T_ZBX_INT, O_OPT, P_SYS, DB_ID,NULL), "group_serviceid"=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID,NULL), 'name'=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, 'isset({save_service})'), 'algorithm'=> array(T_ZBX_INT, O_OPT, NULL, IN('0,1,2'), 'isset({save_service})'), 'showsla'=> array(T_ZBX_INT, O_OPT, NULL, IN('0,1'),null), 'goodsla'=> array(T_ZBX_INT, O_OPT, NULL, BETWEEN(0,100), null), 'sortorder'=> array(T_ZBX_INT, O_OPT, NULL, BETWEEN(0,65535), null), 'service_times'=> array(T_ZBX_STR, O_OPT, null, null, null), 'linktrigger'=> array(T_ZBX_INT, O_OPT, NULL, IN('0,1'),null), 'triggerid'=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, NULL), 'trigger'=> array(T_ZBX_STR, O_OPT, null, null, null), //?? 'serverid'=> array(T_ZBX_INT, O_OPT, null, DB_ID, 'isset({add_server})'), 'new_service_time'=> array(T_ZBX_STR, O_OPT, null, null, null), 'rem_service_times'=> array(T_ZBX_STR, O_OPT, null, null, null), 'childs'=> array(T_ZBX_STR, O_OPT, P_SYS, DB_ID,NULL), 'parentid'=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID,NULL), 'parentname'=> array(T_ZBX_STR, O_OPT, null, null, null), /* actions */ 'saction'=> array(T_ZBX_INT, O_OPT, P_ACT, IN('0,1'), null), 'save_service'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), 'add_server'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), 'add_service_time'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), 'del_service_times'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), 'delete'=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), 'cancel'=> array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL), /* other */ 'form'=> array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL), 'form_copy_to'=> array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL), 'form_refresh'=> array(T_ZBX_INT, O_OPT, NULL, NULL, NULL), 'sform'=> array(T_ZBX_INT, O_OPT, NULL, IN('0,1'), null), 'pservices'=> array(T_ZBX_INT, O_OPT, NULL, IN('0,1'), null), 'cservices'=> array(T_ZBX_INT, O_OPT, NULL, IN('0,1'), null), 'slink'=> array(T_ZBX_INT, O_OPT, NULL, IN('0,1'), null) ); check_fields($fields); //---------------------------------------------------------------------- $available_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY,PERM_RES_IDS_ARRAY); $available_triggers = get_accessible_triggers(PERM_READ_ONLY,PERM_RES_IDS_ARRAY); if(isset($_REQUEST['serviceid']) && $_REQUEST['serviceid'] > 0){ $sql = 'SELECT s.* '. ' FROM services s '. ' WHERE (s.triggerid IS NULL OR '.DBcondition('s.triggerid',$available_triggers).') '. ' AND s.serviceid='.$_REQUEST['serviceid']; if(!$service = DBfetch(DBselect($sql))){ access_deny(); } } /*-------------------------------------------- ACTIONS --------------------------------------------*/ if(isset($_REQUEST['saction'])){ $_REQUEST["showsla"] = get_request("showsla",0); $_REQUEST["soft"] = get_request("soft", 0); if(isset($_REQUEST["delete"]) && isset($_REQUEST["serviceid"])){ $result = delete_service($service["serviceid"]); show_messages($result, S_SERVICE_DELETED, S_CANNOT_DELETE_SERVICE); add_audit_if($result,AUDIT_ACTION_DELETE,AUDIT_RESOURCE_IT_SERVICE,' Name ['.$service["name"].'] id ['.$service['serviceid'].']'); unset($service); } else if(isset($_REQUEST["save_service"])){ $service_times = get_request('service_times',array()); $childs = get_request('childs',array()); $triggerid = (isset($_REQUEST["linktrigger"]))?($_REQUEST["triggerid"]):(null); DBstart(); if(isset($service["serviceid"])){ $result = update_service($service["serviceid"], $_REQUEST["name"],$triggerid,$_REQUEST["algorithm"], $_REQUEST["showsla"],$_REQUEST["goodsla"],$_REQUEST["sortorder"], $service_times,$_REQUEST['parentid'],$childs); } else { $result = add_service( $_REQUEST["name"],$triggerid,$_REQUEST["algorithm"], $_REQUEST["showsla"],$_REQUEST["goodsla"],$_REQUEST["sortorder"], $service_times,$_REQUEST['parentid'],$childs); } $result = DBend()?$result:false; if(isset($serrvice['serviceid'])){ show_messages($result, S_SERVICE_UPDATED, S_CANNOT_UPDATE_SERVICE); $serviceid = $service["serviceid"]; $audit_acrion = AUDIT_ACTION_UPDATE; } else{ show_messages($result, S_SERVICE_ADDED, S_CANNOT_ADD_SERVICE); $serviceid = $result; $audit_acrion = AUDIT_ACTION_ADD; } add_audit_if($result,$audit_acrion,AUDIT_RESOURCE_IT_SERVICE,' Name ['.$_REQUEST["name"].'] id ['.$serviceid.']'); } else if(isset($_REQUEST["add_server"])){ $sql = 'SELECT h.* '. ' FROM hosts h '. ' WHERE '.DBin_node('h.hostid'). ' AND '.DBcondition('h.hostid',$available_hosts). ' AND h.hostid='.$_REQUEST["serverid"]; if(!$host_data = DBfetch(DBselect($sql))){ access_deny(); } $result = add_host_to_services($_REQUEST["serverid"], $service["serviceid"]); add_audit_if($result,AUDIT_ACTION_ADD,AUDIT_RESOURCE_IT_SERVICE,' Host ['.$host_data["host"].'] id ['.$_REQUEST["serverid"].']'); show_messages($result, S_TRIGGER_ADDED, S_CANNOT_ADD_TRIGGER); } if($result){ zbx_add_post_js('closeform("services.php");'); include_once "include/page_footer.php"; } } //-------------------------------------------- -------------------------------------------- //----------------------------------------- ------------------------------------------ if(isset($_REQUEST['pservices'])){ if(isset($service)) $service = get_service_by_serviceid($service['serviceid']); // update date after ACTIONS show_table_header(S_IT_SERVICES_BIG); $form = new CForm(); $form->SetName("services"); if(isset($service)) $form->AddVar("serviceid", $service['serviceid']); $table = new CTableInfo(); $table->SetHeader(array( S_SERVICE, S_STATUS_CALCULATION, S_TRIGGER )); //root $prefix = null; $trigger = "-"; $description = S_ROOT_SMALL; $description = new CLink($description,'#','action'); $description->SetAction('javascript: window.opener.document.forms[0].elements[\'parent_name\'].value = '.zbx_jsvalue(S_ROOT_SMALL).'; window.opener.document.forms[0].elements[\'parentname\'].value = '.zbx_jsvalue(S_ROOT_SMALL).'; window.opener.document.forms[0].elements[\'parentid\'].value = '.zbx_jsvalue(0).'; self.close(); return false;'); $table->AddRow(array(array($prefix,$description),S_NONE,$trigger)); //----- if(isset($service)){ $childs = get_service_childs($service['serviceid'],1); $childs_str = implode(',',$childs); (!empty($childs_str))?($childs_str.=','):(''); $query = 'SELECT DISTINCT s.* '. ' FROM services s '. ' WHERE '.DBin_node('s.serviceid'). ' AND (s.triggerid IS NULL OR '.DBcondition('s.triggerid',$available_triggers).') '. ' AND s.serviceid NOT IN ('.$childs_str.$service['serviceid'].') '. ' ORDER BY s.sortorder,s.name'; } else { $query = 'SELECT DISTINCT s.* '. ' FROM services s '. ' WHERE '.DBin_node('s.serviceid'). ' AND (s.triggerid IS NULL OR '.DBcondition('s.triggerid',$available_triggers).') '. ' ORDER BY s.sortorder,s.name'; } $db_services = DBselect($query); while($db_service_data = DBfetch($db_services)){ $prefix = null; $trigger = "-"; $description = $db_service_data["name"]; $description = new CLink($description,'#','action'); $description->SetAction('javascript: window.opener.document.forms[0].elements[\'parent_name\'].value = '.zbx_jsvalue($db_service_data["name"]).'; window.opener.document.forms[0].elements[\'parentname\'].value = '.zbx_jsvalue($db_service_data["name"]).'; window.opener.document.forms[0].elements[\'parentid\'].value = '.zbx_jsvalue($db_service_data["serviceid"]).'; self.close(); return false;'); if(isset($db_service_data["triggerid"])){ $trigger = expand_trigger_description($db_service_data["triggerid"]); } $table->AddRow(array(array($prefix,$description),algorithm2str($db_service_data["algorithm"]),$trigger)); } $cb = new CButton('cancel',S_CANCEL); $cb->SetType('button'); $cb->SetAction('javascript: self.close();'); $td = new CCol($cb); $td->AddOption('style','text-align:right;'); $table->SetFooter($td); $form->AddItem($table); $form->Show(); } //-------------------------------------------- -------------------------------------------- //---------------------------------------------- -------------------------------------------- if(isset($_REQUEST['cservices'])){ if(isset($service)) $service = get_service_by_serviceid($service['serviceid']); // update date after ACTIONS show_table_header(S_IT_SERVICES_BIG); $form = new CForm(); $form->SetName("services"); if(isset($service)) $form->AddVar("serviceid", $service['serviceid']); $table = new CTableInfo(); $table->SetHeader(array(S_SERVICE,S_STATUS_CALCULATION,S_TRIGGER)); if(isset($service)){ $childs = get_service_childs($service['serviceid'],1); $childs_str = implode(',',$childs); (!empty($childs_str))?($childs_str.=','):(''); $query = 'SELECT DISTINCT s.* '. ' FROM services s '. ' WHERE '.DBin_node('s.serviceid'). ' AND (s.triggerid IS NULL OR '.DBcondition('s.triggerid',$available_triggers).') '. ' AND s.serviceid NOT IN ('.$childs_str.$service['serviceid'].') '. ' ORDER BY s.sortorder,s.name'; } else { $query = 'SELECT DISTINCT s.* '. ' FROM services s '. ' WHERE '.DBin_node('s.serviceid'). ' AND (s.triggerid IS NULL OR '.DBcondition('s.triggerid',$available_triggers).') '. ' ORDER BY s.sortorder,s.name'; } $db_services = DBselect($query); while($db_service_data = DBfetch($db_services)){ $prefix = null; $trigger = "-"; $description = $db_service_data["name"]; if(isset($db_service_data["triggerid"])){ $trigger = expand_trigger_description($db_service_data["triggerid"]); } $description = new CLink($description,'#','action'); $description->SetAction('window.opener.add_child_service('.zbx_jsvalue($db_service_data["name"]).','.zbx_jsvalue($db_service_data["serviceid"]).','.zbx_jsvalue($trigger).','.zbx_jsvalue($db_service_data["triggerid"]).'); self.close(); return false;'); $table->AddRow(array(array($prefix,$description),algorithm2str($db_service_data["algorithm"]),$trigger)); } $cb = new CButton('cancel',S_CANCEL); $cb->SetType('button'); $cb->SetAction('javascript: self.close();'); $td = new CCol($cb); $td->AddOption('style','text-align:right;'); $table->SetFooter($td); $form->AddItem($table); $form->Show(); } //-------------------------------------------- -------------------------------------------- //--------------------------------------------
-------------------------------------------- if(isset($_REQUEST['sform'])){ $frmService = new CFormTable(S_SERVICE,'services_form.php','POST',null,'sform'); $frmService->SetHelp("web.services.service.php"); $frmService->SetTableClass('formlongtable'); //service times if(isset($_REQUEST["add_service_time"]) && isset($_REQUEST["new_service_time"])){ $_REQUEST['service_times'] = get_request('service_times',array()); $new_service_time['type'] = $_REQUEST["new_service_time"]['type']; if($_REQUEST["new_service_time"]['type'] == SERVICE_TIME_TYPE_ONETIME_DOWNTIME){ $new_service_time['from'] = strtotime($_REQUEST["new_service_time"]['from']); $new_service_time['to'] = strtotime($_REQUEST["new_service_time"]['to']); $new_service_time['note'] = $_REQUEST["new_service_time"]['note']; }else{ $new_service_time['from'] = strtotime( $_REQUEST["new_service_time"]['from_week'].' '.$_REQUEST["new_service_time"]['from'] ); $new_service_time['to'] = strtotime( $_REQUEST["new_service_time"]['to_week'].' '.$_REQUEST["new_service_time"]['to'] ); $new_service_time['note'] = $_REQUEST["new_service_time"]['note']; } while($new_service_time['to'] && ($new_service_time['to'] <= $new_service_time['from'])) $new_service_time['to'] += 7*24*3600; if($new_service_time['to'] && !str_in_array($_REQUEST['service_times'], $new_service_time)) array_push($_REQUEST['service_times'],$new_service_time); } elseif(isset($_REQUEST["del_service_times"]) && isset($_REQUEST["rem_service_times"])){ $_REQUEST["service_times"] = get_request("service_times",array()); foreach($_REQUEST["rem_service_times"] as $val){ unset($_REQUEST["service_times"][$val]); } } $service_times = get_request('service_times',array()); $new_service_time = get_request('new_service_time',array('type' => SERVICE_TIME_TYPE_UPTIME)); //---------- if(isset($service["serviceid"])){ $frmService->SetTitle(S_SERVICE." \"".$service["name"]."\""); } if(isset($service["serviceid"]) && !isset($_REQUEST["form_refresh"])){ $name = $service["name"]; $algorithm = $service["algorithm"]; $showsla = $service["showsla"]; $goodsla = $service["goodsla"]; $sortorder = $service["sortorder"]; $triggerid = $service["triggerid"]; $linktrigger = isset($triggerid) ? 1 : 0; if(!isset($triggerid)) $triggerid = 0; $result = DBselect('select * from services_times where serviceid='.$service['serviceid']); while($db_stime = DBfetch($result)){ $stime = array( 'type'=> $db_stime['type'], 'from'=> $db_stime['ts_from'], 'to'=> $db_stime['ts_to'], 'note'=> $db_stime['note'] ); if(str_in_array($stime, $service_times)){ continue; } array_push($service_times, $stime); } //links $query = 'SELECT DISTINCT sl.linkid, sl.soft, sl.serviceupid, sl.servicedownid, '. ' s1.name as serviceupname, s2.name as servicedownname '. ' FROM services s1, services s2, services_links sl '. ' WHERE sl.serviceupid=s1.serviceid '. ' AND sl.servicedownid=s2.serviceid '. ' AND NOT(sl.soft=1) '. ' AND sl.servicedownid='.$service['serviceid']; if($link=DBFetch(DBSelect($query))){ $parentid = $link["serviceupid"]; $parentname = $link["serviceupname"]; } else { $parentid = 0; $parentname = 'root'; } $query = 'SELECT DISTINCT s.*, sl.soft '. ' FROM services s1, services s2, services_links sl, services s '. ' WHERE (s.triggerid IS NULL OR '.DBcondition('s.triggerid',$available_triggers).') '. ' AND '.DBin_node('s.serviceid'). ' AND sl.serviceupid=s1.serviceid '. ' AND sl.servicedownid=s2.serviceid '. ' AND sl.serviceupid='.$service['serviceid']. ' AND s.serviceid=sl.servicedownid'; $db_services = DBselect($query); $childs = array(); while($db_service_data = DBfetch($db_services)){ $child = array( 'name' => $db_service_data["name"], 'serviceid' => $db_service_data["serviceid"], 'triggerid' => $db_service_data["triggerid"], 'soft' => $db_service_data['soft'] ); if(str_in_array($child, $childs)){ continue; } array_push($childs,$child); } //--- } else{ $name = get_request("name",""); $showsla = get_request("showsla",0); $goodsla = get_request("goodsla",99.05); $sortorder = get_request("sortorder",0); $algorithm = get_request("algorithm",0); $triggerid = get_request("triggerid",0); $linktrigger = get_request("linktrigger",0); //links $parentid = get_request("parentid",0); $parentname = get_request("parentname",''); $childs = get_request('childs',array()); //----- } if(isset($service)){ $frmService->AddVar("serviceid",$service["serviceid"]); } $frmService->AddRow(S_NAME,new CTextBox("name",$name,60)); //link //-------------------------------------------- -------------------------------------------- //parent link $ctb = new CTextBox("parent_name",$parentname,60); $ctb->Addoption('disabled','disabled'); $frmService->AddVar("parentname",$parentname); $frmService->AddVar("parentid",$parentid); $cb = new CButton('select_parent',S_CHANGE); $cb->SetType('button'); $cb->SetAction("javascript: openWinCentered('services_form.php?pservices=1".url_param('serviceid')."','ZBX_Services_List',740,420,'scrollbars=1, toolbar=0, menubar=0, resizable=1, dialog=0');"); $frmService->AddRow('Parent Service',array($ctb,$cb)); //---------- //child links $table = new CTable(); $table->SetClass('tableinfo'); $table->oddRowClass = 'even_row'; $table->evenRowClass = 'even_row'; $table->options['cellpadding'] = 3; $table->options['cellspacing'] = 1; $table->headerClass = 'header'; $table->footerClass = 'footer'; $table->SetHeader(array(new CCheckBox("all_child_services",null,"check_childs('".$frmService->GetName()."','childs','all_child_services');"),S_SERVICES,S_SOFT,S_TRIGGER)); $table->AddOption('id','service_childs'); foreach($childs as $id => $child){ $prefix = null; $trigger = "-"; $description = new CLink($child['name'],'services_form.php?sform=1&serviceid='.$child['serviceid'],'action'); if(isset($child["triggerid"]) && !empty($child["triggerid"])){ $trigger = expand_trigger_description($child["triggerid"]); } $table->AddRow(array( array( new CCheckBox('childs_to_del['.$child['serviceid'].'][serviceid]',null,null,$child['serviceid']), new CVar('childs['.$child['serviceid'].'][serviceid]', $child['serviceid']) ), array( $description, new CVar('childs['.$child['serviceid'].'][name]', $child['name']) ), new CCheckBox( 'childs['.$child["serviceid"].'][soft]', (isset($child['soft']) && !empty($child['soft']))?('checked'):('no'),null, (isset($child['soft']) && !empty($child['soft']))?(1):(0) ), array( $trigger, new CVar('childs['.$child['serviceid'].'][triggerid]', (isset($child['triggerid']))?($child['triggerid']):('')) ) )); } $cb = new CButton('add_child_service',S_ADD); $cb->SetType('button'); $cb->SetAction("javascript: openWinCentered('services_form.php?cservices=1".url_param('serviceid')."','ZBX_Services_List',640,520,'scrollbars=1, toolbar=0, menubar=0, resizable=0');"); $cb2 = new CButton('del_child_service',S_REMOVE); $cb2->SetType('button'); $cb2->SetAction("javascript: remove_childs('".$frmService->GetName()."','childs_to_del','tr');"); $frmService->AddRow(S_DEPENDS_ON,array($table,BR(),$cb,$cb2)); //---------- //--------------------------------------------- ------------------------------------------- //algorithm $cmbAlg = new CComboBox("algorithm",$algorithm); foreach(array(SERVICE_ALGORITHM_NONE, SERVICE_ALGORITHM_MAX, SERVICE_ALGORITHM_MIN) as $val) $cmbAlg->AddItem($val,algorithm2str($val)); $frmService->AddRow(S_STATUS_CALCULATION_ALGORITHM, $cmbAlg); //------- //SLA $frmService->AddRow(S_SHOW_SLA, new CCheckBox("showsla",$showsla,"javascript: display_element('sla_row');",1)); $row = new CRow(array( new CCol(S_ACCEPTABLE_SLA_IN_PERCENT,'form_row_l'), new CCol(new CTextBox("goodsla",$goodsla,6),'form_row_r') ) ); $row->AddOption('style',($linktrigger == 1)?(''):('display: none;')); $row->AddOption('id','sla_row'); $row->AddOption('style',($showsla)?(''):('display: none;')); $frmService->AddRow($row); //------ //times $stime_el = array(); $i = 0; foreach($service_times as $val){ switch($val['type']){ case SERVICE_TIME_TYPE_UPTIME: $type = new CSpan(S_UPTIME,'enabled'); $from = date('l H:i', $val['from']); $to = date('l H:i', $val['to']); break; case SERVICE_TIME_TYPE_DOWNTIME: $type = new CSpan(S_DOWNTIME,'disabled'); $from = date('l H:i', $val['from']); $to = date('l H:i', $val['to']); break; case SERVICE_TIME_TYPE_ONETIME_DOWNTIME: $type = new CSpan(S_ONE_TIME_DOWNTIME,'disabled'); $from = date('d M Y H:i', $val['from']); $to = date('d M Y H:i', $val['to']); break; } array_push($stime_el, array(new CCheckBox("rem_service_times[]", 'no', null,$i), $type,':'.SPACE, $from, SPACE.'-'.SPACE, $to, (!empty($val['note'])?(array(BR(),'['.htmlspecialchars($val['note']).']')):('')),BR())); $frmService->AddVar('service_times['.$i.'][type]', $val['type']); $frmService->AddVar('service_times['.$i.'][from]', $val['from']); $frmService->AddVar('service_times['.$i.'][to]', $val['to']); $frmService->AddVar('service_times['.$i.'][note]', $val['note']); $i++; } // print_r($stime_el); if(count($stime_el)==0) array_push($stime_el, S_NO_TIMES_DEFINED); else array_push($stime_el, new CButton('del_service_times',S_DELETE_SELECTED)); $frmService->AddRow(S_SERVICE_TIMES, $stime_el); $cmbTimeType = new CComboBox("new_service_time[type]",$new_service_time['type'],'javascript: document.forms[0].action += \'?sform=1\'; submit();'); $cmbTimeType->AddItem(SERVICE_TIME_TYPE_UPTIME, S_UPTIME); $cmbTimeType->AddItem(SERVICE_TIME_TYPE_DOWNTIME, S_DOWNTIME); $cmbTimeType->AddItem(SERVICE_TIME_TYPE_ONETIME_DOWNTIME, S_ONE_TIME_DOWNTIME); $time_param = new CTable(); $div = new Ctag('div','yes'); if($new_service_time['type'] == SERVICE_TIME_TYPE_ONETIME_DOWNTIME){ $time_param->AddRow(array(S_NOTE, new CTextBox('new_service_time[note]','',40))); $time_param->AddRow(array(S_FROM, new CTextBox('new_service_time[from]','d M Y H:i',20))); $time_param->AddRow(array(S_TILL, new CTextBox('new_service_time[to]','d M Y H:i',20))); }else{ $cmbWeekFrom = new CComboBox('new_service_time[from_week]','Sunday'); $cmbWeekTo = new CComboBox('new_service_time[to_week]','Sunday'); foreach(array( 'Sunday' =>S_SUNDAY, 'Monday' =>S_MONDAY, 'Tuesday' =>S_TUESDAY, 'Wednesday'=>S_WEDNESDAY, 'Thursday'=>S_THURSDAY, 'Friday' =>S_FRIDAY, 'Saturday' =>S_SATURDAY ) as $day_num => $day_str) { $cmbWeekFrom->AddItem($day_num, $day_str); $cmbWeekTo->AddItem($day_num, $day_str); } $time_param->AddRow(array(S_FROM, $cmbWeekFrom, new CTextBox('new_service_time[from]','H:i',9))); $time_param->AddRow(array(S_TILL, $cmbWeekTo, new CTextBox('new_service_time[to]','H:i',9))); $frmService->AddVar('new_service_time[note]',''); } $frmService->AddRow(S_NEW_SERVICE_TIME, array( $cmbTimeType, BR(), $time_param, BR(), new CButton('add_service_time','add','javascript: document.forms[0].action += \'?sform=1\'; submit();') )); //trigger $frmService->AddRow(S_LINK_TO_TRIGGER_Q, new CCheckBox("linktrigger",$linktrigger,"javascript: display_element('trigger_name');",1)); if($triggerid > 0){ $trigger = expand_trigger_description($triggerid); } else{ $trigger = ""; } $row = new CRow(array( new CCol(S_TRIGGER,'form_row_l'), new CCol(array( new CTextBox("trigger",$trigger,64,'yes'), new CButton("btn1",S_SELECT,"return PopUp('popup.php?"."dstfrm=".$frmService->GetName()."&dstfld1=triggerid&dstfld2=trigger"."&srctbl=triggers&srcfld1=triggerid&srcfld2=description&real_hosts=1');",'T') ),'form_row_r') )); $row->AddOption('id','trigger_name'); $row->AddOption('style',($linktrigger == 1)?(''):('display: none;')); $frmService->AddRow($row); $frmService->AddVar("triggerid",$triggerid); //--------- //sortorder $frmService->AddRow(S_SORT_ORDER_0_999, new CTextBox("sortorder",$sortorder,3)); //--------- $frmService->AddItemToBottomRow(new CButton("save_service",S_SAVE,'javascript: document.forms[0].action += \'?saction=1\';')); if(isset($service["serviceid"])){ $frmService->AddItemToBottomRow(SPACE); $frmService->AddItemToBottomRow(new CButtonDelete( "Delete selected service?", url_param("form").url_param("serviceid").'&saction=1' )); } $frmService->AddItemToBottomRow(SPACE); $cb = new CButton('cancel',S_CANCEL); $cb->SetType('button'); $cb->SetAction('javascript: self.close();'); $frmService->AddItemToBottomRow($cb); $frmService->Show(); } //--------------------------------------------- -------------------------------------------- ?>