See threads:
and
I also had this problem, and I'm suprised no one has patched it yet, since it disables such a neat feature. Maybe not everyone is having this problem? I'm using
PHP 5.1.2 (cli) (built: Feb 28 2006 06:21:15)
Fedora Core 5
and Zabbix 1.1beta9
for what that's worth.
Anyway, I took a couple hours and fixed the problem, it's in the insert_map_link_form() function in ./include/forms.inc.php
The author here attempted to reuse some form elements by renaming them, or something. Anyway, it didn't quite work, giving me bad forms that submitted GET requests with duplicate selementid2, type_on, and color_on fields, while ommitting the selementid1, type_off, and color_off fields, because they were not present on the generated form.
I've modified the code and attached a patch, here's the new parts of insert_map_link_form() for beta9:
The prep:
And the followup:
We're planning on using Zabbix for our business of 50ish employees. Thank you for an excellent program and keep up the good work.
and
I also had this problem, and I'm suprised no one has patched it yet, since it disables such a neat feature. Maybe not everyone is having this problem? I'm using
PHP 5.1.2 (cli) (built: Feb 28 2006 06:21:15)
Fedora Core 5
and Zabbix 1.1beta9
for what that's worth.
Anyway, I took a couple hours and fixed the problem, it's in the insert_map_link_form() function in ./include/forms.inc.php
The author here attempted to reuse some form elements by renaming them, or something. Anyway, it didn't quite work, giving me bad forms that submitted GET requests with duplicate selementid2, type_on, and color_on fields, while ommitting the selementid1, type_off, and color_off fields, because they were not present on the generated form.
I've modified the code and attached a patch, here's the new parts of insert_map_link_form() for beta9:
The prep:
Code:
/* START comboboxes preparations */
$cmbElements = new CComboBox("selementid1",$selementid1);
$cmbElements2 = new CComboBox("selementid2",$selementid2);
$db_selements = DBselect("select selementid,label,elementid,elementtype from sysmaps_elements".
" where sysmapid=".$_REQUEST["sysmapid"]);
while($db_selement = DBfetch($db_selements))
{
$label = $db_selement["label"];
if($db_selement["elementtype"] == SYSMAP_ELEMENT_TYPE_HOST)
{
$db_host = get_host_by_hostid($db_selement["elementid"]);
$label .= ":".$db_host["host"];
}
elseif($db_selement["elementtype"] == SYSMAP_ELEMENT_TYPE_MAP)
{
$db_map = get_sysmap_by_sysmapid($db_selement["elementid"]);
$label .= ":".$db_map["name"];
}
elseif($db_selement["elementtype"] == SYSMAP_ELEMENT_TYPE_IMAGE)
{
if($db_selement["elementid"]>0)
{
$label .= ":".expand_trigger_description($db_selement["elementid"]);
}
}
$cmbElements->AddItem($db_selement["selementid"],$label);
$cmbElements2->AddItem($db_selement["selementid"],$label);
}
$cmbType = new CComboBox("drawtype_off",$drawtype_off);
$cmbType->AddItem(0,get_drawtype_description(0));
$cmbType->AddItem(1,get_drawtype_description(1));
$cmbType->AddItem(2,get_drawtype_description(2));
$cmbType->AddItem(3,get_drawtype_description(3));
$cmbType->AddItem(4,get_drawtype_description(4));
$cmbType2 = new CComboBox("drawtype_on",$drawtype_on);
$cmbType2->AddItem(0,get_drawtype_description(0));
$cmbType2->AddItem(1,get_drawtype_description(1));
$cmbType2->AddItem(2,get_drawtype_description(2));
$cmbType2->AddItem(3,get_drawtype_description(3));
$cmbType2->AddItem(4,get_drawtype_description(4));
$cmbColor = new CComboBox("color_off",$color_off);
$cmbColor->AddItem('Black',"Black");
$cmbColor->AddItem('Blue',"Blue");
$cmbColor->AddItem('Cyan',"Cyan");
$cmbColor->AddItem('Dark Blue',"Dark Blue");
$cmbColor->AddItem('Dark Green',"Dark Green");
$cmbColor->AddItem('Dark Red',"Dark Red");
$cmbColor->AddItem('Dark Yellow',"Dark Yellow");
$cmbColor->AddItem('Green',"Green");
$cmbColor->AddItem('Red',"Red");
$cmbColor->AddItem('White',"White");
$cmbColor->AddItem('Yellow',"Yellow");
$cmbColor2 = new CComboBox("color_on",$color_on);
$cmbColor2->AddItem('Black',"Black");
$cmbColor2->AddItem('Blue',"Blue");
$cmbColor2->AddItem('Cyan',"Cyan");
$cmbColor2->AddItem('Dark Blue',"Dark Blue");
$cmbColor2->AddItem('Dark Green',"Dark Green");
$cmbColor2->AddItem('Dark Red',"Dark Red");
$cmbColor2->AddItem('Dark Yellow',"Dark Yellow");
$cmbColor2->AddItem('Green',"Green");
$cmbColor2->AddItem('Red',"Red");
$cmbColor2->AddItem('White',"White");
$cmbColor2->AddItem('Yellow',"Yellow");
Code:
/* END preparation */
$frmCnct->AddRow("Element 1",$cmbElements);
// $cmbElements->SetName("selementid2"); // rename without recreation
// $cmbElements->SetValue($selementid2); // rename without recreation
$frmCnct->AddRow("Element 2",$cmbElements2);
Code:
$frmCnct->AddRow("Type (OFF)",$cmbType);
$frmCnct->AddRow("Color (OFF)",$cmbColor);
// $cmbType->SetName("drawtype_on"); // rename without recreation
// $cmbType->SetValue($drawtype_on); // rename without recreation
$frmCnct->AddRow("Type (ON)",$cmbType2);
// $cmbColor->SetName("color_on"); // rename without recreation
// $cmbColor->SetValue($color_on); // rename without recreation
$frmCnct->AddRow("Color (ON)",$cmbColor2);
Comment