} else { if ($action == "delete") { $DBRESULT =& $pearDB->query("DELETE from `mod_gmap_locations` WHERE l_id='{$l_id}' LIMIT 1"); } } } if (PEAR::isError($DBRESULT)) { print "DB Error : " . $DBRESULT->getDebugInfo() . "<br>"; } } /* * we pass either group or host */ getHostgroupLatLong2('host'); getHostList(); $mod_gmap_options = readConfigOptions($pearDB, $oreon); $tpl = new Smarty(); $tpl = initSmartyTpl($path, $tpl); $tpl->assign("h_names", $smarty_host); $tpl->assign("host_list", $smarty_host_list); $tpl->assign("hostgroup_list", $smarty_hostgroup_list); $tpl->assign("gmap_lat", $mod_gmap_options['lat']); $tpl->assign("gmap_lng", $mod_gmap_options['lng']); $tpl->assign("gmap_height", $mod_gmap_options['height']); $tpl->assign("gmap_zoom", $mod_gmap_options['zoomLevel']); /* * translations */ $tpl->assign("host", _("Hosts")); $tpl->assign("address", _("Address, postal code, city, country")); $tpl->assign("latitude", _("Latitude"));
} } $form->addRule('height', _("You need to fix a map height"), 'required', '', 'client'); $form->setJsWarnings(_("Input Error"), ""); $form->applyFilter('_ALL_', 'trim'); $form->setDefaults($sopt); $form->addElement('submit', 'submitC', _("Save")); /* * Smarty template Init */ $tpl = new Smarty(); $tpl = initSmartyTpl($path, $tpl); if ($form->validate()) { updateGmapCFG($form->getSubmitValue("id")); $o = "w"; $valid = true; $sopt = readConfigOptions($pearDB, $oreon); } /* * Apply a template definition */ $renderer =& new HTML_QuickForm_Renderer_ArraySmarty($tpl); $form->accept($renderer); $tpl->assign('form', $renderer->toArray()); $tpl->assign('o', $o); $tpl->assign('valid', $valid); $tpl->assign("gmap_lat", $sopt['lat']); $tpl->assign("gmap_lng", $sopt['lng']); $tpl->assign("gmap_zoom", $sopt['zoomLevel']); $tpl->assign("text_opt", _("To center the map on a point, take the marker and move it wherever you want on the map.<br/>" . "You can also select the + and - to set zoom level.<br/>" . "It is impossible to edit by hand the lngitude, latitude and zoom values. Only the map height is editable by hand.<br/><br/>")); $tpl->display("formGmap.ihtml");