diff options
author | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-01-20 11:55:57 +0000 |
---|---|---|
committer | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-01-20 11:55:57 +0000 |
commit | d8f01baf1d0e053dc44f90ef5eff77028edb4225 (patch) | |
tree | db9e0fa4d930d483bf6dc24a9fe73ed4856e72d9 /frontends/php | |
parent | d57d1c42166cd82e6fb91bd0371b077e9e9f381b (diff) | |
download | zabbix-d8f01baf1d0e053dc44f90ef5eff77028edb4225.tar.gz zabbix-d8f01baf1d0e053dc44f90ef5eff77028edb4225.tar.xz zabbix-d8f01baf1d0e053dc44f90ef5eff77028edb4225.zip |
- Minor changes.
git-svn-id: svn://svn.zabbix.com/trunk@2548 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php')
-rw-r--r-- | frontends/php/include/forms.inc.php | 259 |
1 files changed, 131 insertions, 128 deletions
diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php index a2c799c9..2a48d08e 100644 --- a/frontends/php/include/forms.inc.php +++ b/frontends/php/include/forms.inc.php @@ -177,6 +177,73 @@ $frmUser->Show(); } + # Insert form for User Groups + function insert_usergroups_form($usrgrpid) + { + global $_REQUEST; + + $frm_title = S_USER_GROUP; + if(isset($usrgrpid)) + { + $usrgrp=get_usergroup_by_usrgrpid($usrgrpid); + $frm_title = S_USER_GROUP." \"".$usrgrp["name"]."\""; + } + + if(isset($usrgrpid)&&$_REQUEST["form"]!=1) + { + $name = $usrgrp["name"]; + } + else + { + $name = get_request("name",""); + } + + $frmUserG = new CFormTable($frm_title,"users.php"); + $frmUserG->SetHelp("web.users.groups.php"); + $frmUserG->AddVar("config",get_request("config",2)); + if(isset($usrgrpid)) + { + $frmUserG->AddVar("usrgrpid",$usrgrpid); + } + $frmUserG->AddRow(S_GROUP_NAME,new CTextBox("name",$name,30)); + + $form_row = array(); + $users=DBselect("select distinct userid,alias from users order by alias"); + while($user=DBfetch($users)) + { + if(isset($_REQUEST["usrgrpid"])) + { + $sql="select count(*) as count from users_groups where userid=". + $user["userid"]." and usrgrpid=".$_REQUEST["usrgrpid"]; + $result=DBselect($sql); + $res_row=DBfetch($result); + array_push($form_row, + new CCheckBox($user["userid"],$res_row["count"], $user["alias"]), + BR); + } + else + { + array_push($form_row, + new CCheckBox($user["userid"], + isset($_REQUEST[$user["userid"]]),$user["alias"]), + BR); + } + } + $frmUserG->AddRow(S_USERS,$form_row); + + $frmUserG->AddItemToBottomRow(new CButton("save",S_SAVE)); + if(isset($_REQUEST["usrgrpid"])) + { + $frmUserG->AddItemToBottomRow(SPACE); + $frmUserG->AddItemToBottomRow(new CButtonDelete( + "Delete selected group?",url_param("config").url_param("usrgrpid"))); + } + $frmUserG->AddItemToBottomRow(SPACE); + $frmUserG->AddItemToBottomRow(new CButtonCancel(url_param("config"))); + $frmUserG->Show(); + } + + # Insert form for Item information function insert_item_form() { @@ -447,134 +514,6 @@ $frmItem->Show(); } - # Insert form for Host Groups - function insert_hostgroups_form($groupid) - { - global $_REQUEST; - - $frm_title = S_HOST_GROUP; - if(isset($groupid)) - { - $groupid=get_group_by_groupid($groupid); - $frm_title = S_HOST_GROUP." \"".$groupid["name"]."\""; - if($_REQUEST["form"]!=1) - $name=$groupid["name"]; - else - $name = get_request("name",""); - } - else - { - $name=get_request("name",""); - } - $frmHostG = new CFormTable($frm_title,"hosts.php"); - $frmHostG->SetHelp("web.hosts.group.php"); - $frmHostG->AddVar("config",get_request("config",1)); - if(isset($_REQUEST["groupid"])) - { - $frmHostG->AddVar("groupid",$_REQUEST["groupid"]); - } - - $frmHostG->AddRow(S_GROUP_NAME,new CTextBox("name",$name,30)); - - $cmbHosts = new CListBox("hosts[]",5); - $hosts=DBselect("select distinct hostid,host from hosts where status<>".HOST_STATUS_DELETED." order by host"); - while($host=DBfetch($hosts)) - { - if(isset($_REQUEST["groupid"])) - { - $result=DBselect("select count(*) as count from hosts_groups". - " where hostid=".$host["hostid"]." and groupid=".$_REQUEST["groupid"]); - $res_row=DBfetch($result); - $cmbHosts->AddItem($host["hostid"],$host["host"], - ($res_row["count"]==0) ? 'no' : 'yes'); - } - else - { - $cmbHosts->AddItem($host["hostid"],$host["host"]); - } - } - $frmHostG->AddRow(S_HOSTS,$cmbHosts); - - $frmHostG->AddItemToBottomRow(new CButton("save",S_SAVE)); - if(isset($_REQUEST["groupid"])) - { - $frmHostG->AddItemToBottomRow(SPACE); - $frmHostG->AddItemToBottomRow( - new CButtonDelete("Delete selected group?", - url_param("config").url_param("groupid") - ) - ); - } - $frmHostG->AddItemToBottomRow(SPACE); - $frmHostG->AddItemToBottomRow(new CButtonCancel(url_param("config"))); - $frmHostG->Show(); - } - - # Insert form for User Groups - function insert_usergroups_form($usrgrpid) - { - global $_REQUEST; - - $frm_title = S_USER_GROUP; - if(isset($usrgrpid)) - { - $usrgrp=get_usergroup_by_usrgrpid($usrgrpid); - $frm_title = S_USER_GROUP." \"".$usrgrp["name"]."\""; - } - - if(isset($usrgrpid)&&$_REQUEST["form"]!=1) - { - $name = $usrgrp["name"]; - } - else - { - $name = get_request("name",""); - } - - $frmUserG = new CFormTable($frm_title,"users.php"); - $frmUserG->SetHelp("web.users.groups.php"); - $frmUserG->AddVar("config",get_request("config",2)); - if(isset($usrgrpid)) - { - $frmUserG->AddVar("usrgrpid",$usrgrpid); - } - $frmUserG->AddRow(S_GROUP_NAME,new CTextBox("name",$name,30)); - - $form_row = array(); - $users=DBselect("select distinct userid,alias from users order by alias"); - while($user=DBfetch($users)) - { - if(isset($_REQUEST["usrgrpid"])) - { - $sql="select count(*) as count from users_groups where userid=". - $user["userid"]." and usrgrpid=".$_REQUEST["usrgrpid"]; - $result=DBselect($sql); - $res_row=DBfetch($result); - array_push($form_row, - new CCheckBox($user["userid"],$res_row["count"], $user["alias"]), - BR); - } - else - { - array_push($form_row, - new CCheckBox($user["userid"], - isset($_REQUEST[$user["userid"]]),$user["alias"]), - BR); - } - } - $frmUserG->AddRow(S_USERS,$form_row); - - $frmUserG->AddItemToBottomRow(new CButton("save",S_SAVE)); - if(isset($_REQUEST["usrgrpid"])) - { - $frmUserG->AddItemToBottomRow(SPACE); - $frmUserG->AddItemToBottomRow(new CButtonDelete( - "Delete selected group?",url_param("config").url_param("usrgrpid"))); - } - $frmUserG->AddItemToBottomRow(SPACE); - $frmUserG->AddItemToBottomRow(new CButtonCancel(url_param("config"))); - $frmUserG->Show(); - } # Insert form for User permissions function insert_permissions_form($userid) @@ -1661,6 +1600,70 @@ function insert_image_form() $frmHost->AddItemToBottomRow(new CButtonCancel(url_param("config"))); $frmHost->Show(); } + + # Insert form for Host Groups + function insert_hostgroups_form($groupid) + { + global $_REQUEST; + + $frm_title = S_HOST_GROUP; + if(isset($groupid)) + { + $groupid=get_group_by_groupid($groupid); + $frm_title = S_HOST_GROUP." \"".$groupid["name"]."\""; + if($_REQUEST["form"]!=1) + $name=$groupid["name"]; + else + $name = get_request("name",""); + } + else + { + $name=get_request("name",""); + } + $frmHostG = new CFormTable($frm_title,"hosts.php"); + $frmHostG->SetHelp("web.hosts.group.php"); + $frmHostG->AddVar("config",get_request("config",1)); + if(isset($_REQUEST["groupid"])) + { + $frmHostG->AddVar("groupid",$_REQUEST["groupid"]); + } + + $frmHostG->AddRow(S_GROUP_NAME,new CTextBox("name",$name,30)); + + $cmbHosts = new CListBox("hosts[]",5); + $hosts=DBselect("select distinct hostid,host from hosts where status<>".HOST_STATUS_DELETED." order by host"); + while($host=DBfetch($hosts)) + { + if(isset($_REQUEST["groupid"])) + { + $result=DBselect("select count(*) as count from hosts_groups". + " where hostid=".$host["hostid"]." and groupid=".$_REQUEST["groupid"]); + $res_row=DBfetch($result); + $cmbHosts->AddItem($host["hostid"],$host["host"], + ($res_row["count"]==0) ? 'no' : 'yes'); + } + else + { + $cmbHosts->AddItem($host["hostid"],$host["host"]); + } + } + $frmHostG->AddRow(S_HOSTS,$cmbHosts); + + $frmHostG->AddItemToBottomRow(new CButton("save",S_SAVE)); + if(isset($_REQUEST["groupid"])) + { + $frmHostG->AddItemToBottomRow(SPACE); + $frmHostG->AddItemToBottomRow( + new CButtonDelete("Delete selected group?", + url_param("config").url_param("groupid") + ) + ); + } + $frmHostG->AddItemToBottomRow(SPACE); + $frmHostG->AddItemToBottomRow(new CButtonCancel(url_param("config"))); + $frmHostG->Show(); + } + /* # Insert host profile form function insert_host_profile_form($hostid,$readonly=0) |