$filepath = $directive_editor->engine_path . "/" . $file; if (!file_exists($filepath)) { die(ossim_error(_("User Contributed file not found in") . " " . $directive_editor->engine_path . ". " . _("Please, create it first"))); } // SAVE CURRENT if ($directive_id != "") { $directive_editor = new Directive_editor($engine_id); $filepath = $directive_editor->engine_path . "/" . $file; $dom = $directive_editor->get_xml($filepath, "DOMXML"); $directive = $directive_editor->getDirectiveFromXML($dom, $directive_id); $node = $directive->directive; $node->setAttribute('name', $name); $node->setAttribute('priority', $prio); $directive_editor->save_xml($filepath, $dom, "DOMXML"); $directive_editor->update_directive_pluginsid($directive_id, 2, $prio, $name); $directive_editor->update_directive_taxonomy($directive_id, $intent, $strategy, $method); $infolog = array($directive_id, 'updated'); Log_action::log(86, $infolog); } else { if ($directive_editor->directive_exists($name, $filepath)) { die(ossim_error(_("This directive name already exists"))); } // Get new ID $id = $directive_editor->new_directive_id($file); if ($id < 1) { echo ossim_error(_("Unable to create a new directive in ") . "<b>{$file}</b>"); } // Create a Node (Do not create yet, at rule finish) // ... } // Back to MAIN
$rule = new Directive_rule(POST('id'), POST('level'), "", $attributes); $file = $directive_editor->engine_path . "/" . POST('xml_file'); $directive_error = false; if (POST('from_directive') != "") { $dom = $directive_editor->get_xml($file, "DOMXML"); $node = $dom->createElement('directive'); $node->setAttribute('id', POST('directive_id')); $node->setAttribute('name', POST('directive_name')); $node->setAttribute('priority', POST('directive_prio')); $dom->appendChild($node); if (!$directive_editor->save_xml($file, $dom, "DOMXML", false)) { // DTD Validation = false $directive_error = true; } else { $directive_editor->update_directive_pluginsid(POST('directive_id'), 2, POST('directive_prio'), POST('directive_name')); $directive_editor->update_directive_taxonomy(POST('directive_id'), POST('directive_intent'), POST('directive_strategy'), POST('directive_method')); } } if (!$directive_error) { $directive_editor->insert($rule, POST("directive_id"), $file); ?> <script type="text/javascript"> var params = new Array(); params['xml'] = "<?php echo $xml_file; ?> "; params['directive'] = "<?php echo POST('directive_id'); ?> ";