if ($config_class == "service") { history_add("created", $config_class, $_POST[$id_naming_attr], $id, "add_service", $host_id); } else { history_add("created", $config_class, $_POST[$id_naming_attr], $id); } while ($attr = each($_POST)) { // only add attributes (which have int(id) as attr key if (is_int($attr["key"])) { // add attribute add_attribute($id, $attr["key"], $attr["value"]); } } //// // Handle not visible attributes // lookup visible=no attributes $attrs_visible_no = read_attributes($config_class, 'no'); // add attributes (visible=no) foreach ($attrs_visible_no as $attribute_key => $attribute_value) { NConf_DEBUG::set($attribute_key . " -> " . $attribute_value, 'DEBUG', "Add attribute"); $result = add_attribute($id, $attribute_key, $attribute_value); } if (DB_NO_WRITES != 1) { NConf_DEBUG::set('Successfully added <b>' . escape_string($_POST[$id_naming_attr]) . '</b>', 'INFO'); } # cache if (isset($_SESSION["cache"]["modify"])) { unset($_SESSION["cache"]["modify"]); } if ($config_class == "host") { $_SESSION["created_id"] = $id; $step2 = "yes";
} // END while } } else { message($debug, '[ FAILED ]'); } //// // Add other attributes (visible=yes) foreach ($attrs_visible_yes as $attribute_key => $attribute_value) { NConf_DEBUG::set($attribute_key . " -> " . $attribute_value, 'DEBUG', "Add attribute"); $result = add_attribute($new_service_ID, $attribute_key, $attribute_value); } //// // Handle not visible attributes // lookup visible=no attributes $attrs_visible_no = read_attributes('service', 'no'); // add attributes (visible=no) foreach ($attrs_visible_no as $attribute_key => $attribute_value) { NConf_DEBUG::set($attribute_key . " -> " . $attribute_value, 'DEBUG', "Add attribute"); $result = add_attribute($new_service_ID, $attribute_key, $attribute_value); } // give feedback for jQuery // add service to list of added services echo '<div id="add_success">' . $new_service_ID . '</div>'; } // END if ( $insert ){ //NConf_DEBUG::group_end(); } // END while } else { // give feedback for jQuery