Beispiel #1
0
    $location = "incidenttype.php";
} elseif ($action == "modify_ct") {
    Incident_custom::update_custom($conn, $custom_name, $custom_type, $custom_options, $custom_required, $inctype_id, $custom_old_name);
    $location = "modifyincidenttypeform.php?id=" . urlencode($inctype_id);
} elseif ($action == "modify_pos") {
    Incident_custom::update_ord($conn, $custom_oldpos, $custom_newpos, $inctype_id, $custom_old_name);
    $location = "modifyincidenttypeform.php?id=" . urlencode($inctype_id);
} elseif ($action == "add" && trim($custom_name) != "" && trim($custom_type) != "") {
    if (in_array($custom_type, $options) && $custom_options != '' || !in_array($custom_type, $options)) {
        $next_ord = Incident_custom::get_next_ord($conn, $inctype_id);
        $params = array($inctype_id, $custom_name, $custom_type, $custom_options, $custom_required, $next_ord);
        Incident_custom::insert_custom($conn, $params);
        $location = "modifyincidenttypeform.php?id=" . urlencode($inctype_id);
    }
} elseif ($action == "delete" && trim($custom_name) != "") {
    Incident_custom::delete_custom($conn, $inctype_id, $custom_name);
    $location = "modifyincidenttypeform.php?id=" . urlencode($inctype_id);
}
$db->close($conn);
?>
    <p> <?php 
echo gettext("Action type succesfully updated");
?>
 </p>
<?php 
sleep(1);
echo "<script>window.location='{$location}';</script>";
?>
</body>
</html>
        Util::print_succesful(_($var_tmp));
    }
}
$inctype_id = GET('id');
ossim_valid($inctype_id, OSS_ALPHA, OSS_SPACE, OSS_PUNC, 'illegal:' . _("Incident type"));
if (ossim_error()) {
    die(ossim_error());
}
$db = new ossim_db();
$conn = $db->connect();
//
$custom_fields = array();
if ($inctype_list = Incident_type::get_list($conn, "WHERE id = '{$inctype_id}'")) {
    $inctype = $inctype_list[0];
    $custom = preg_match("/custom/", $inctype->get_keywords()) ? 1 : 0;
    $custom_fields = Incident_custom::get_custom_types($conn, $inctype_id);
}
?>



<form method="post" id="crt" action="modifyincidenttype.php">
	
	<div id='info_error' class='ct_error'></div>
	<input type="hidden" id="modify" name="modify" value="modify"/>
	<input type="hidden" name="id" id='id_crt' value="<?php 
echo $inctype->get_id();
?>
" />
	<input type="hidden" id="oldpos" name="oldpos" value="0"/>
	<input type="hidden" id="newpos" name="newpos" value="0"/>
Beispiel #3
0
	<tr>
		<th class='thr'><?php 
    echo _("Description");
    ?>
</th>
		<td class='left' style="border-width: 0px;">
			<div class='wf3'><textarea name="description" rows="10" cols="80" wrap="hard"><?php 
    echo $description;
    ?>
</textarea></div>
		</td>
	</tr>

<?php 
} elseif ($ref == "Custom") {
    $fields = Incident_custom::get_custom_types($conn, $type);
    $form_builder = new Form_builder();
    $params = array();
    $cont = 1;
    if (empty($fields)) {
        echo "<tr><td class='nobborder' colspan='2'>";
        $error = new OssimNotice();
        $info = array(_("You don't have added any custom types or your custom types have been deleted"));
        $error->display(_("DEFAULT"), $info, false);
        echo "</td></tr>";
    } else {
        foreach ($fields as $field) {
            echo "<tr id='item_" . $cont . "'><th id='name_" . $cont . "' class='thr'><span>" . utf8_decode($field['name']) . "</span></th>";
            echo "<td style='border-width: 0px;text-align:left'>";
            $params = get_params_field($field, $map_key);
            $form_builder->set_attributes($params);
Beispiel #4
0
    ?>
</th>
			<th><?php 
    echo gettext("Custom");
    ?>
</th>
			<th><?php 
    echo gettext("Actions");
    ?>
</th>
		</tr>    

		<?php 
    foreach ($inctype_list as $inctype) {
        $custom = preg_match("/custom/", $inctype->get_keywords()) ? "tick.png" : "cross.png";
        $custom_fields = Incident_custom::get_custom_types($conn, $inctype->get_id());
        $alt = preg_match("/custom/", $inctype->get_keywords()) ? implode(",", $custom_fields) : "";
        $class = $i % 2 == 0 ? 'class="odd"' : 'class="even"';
        $id = urlencode($inctype->get_id());
        $tr_id = 'tr_' . $id;
        ?>
			
			<tr <?php 
        echo $class;
        ?>
 id='<?php 
        echo $tr_id;
        ?>
'>
				
				<td id='loading_<?php 
                Incident_custom::update_custom($conn, $custom_name, $custom_type, $custom_options, $custom_required, $inctype_id, $custom_old_name);
                $location = "modifyincidenttypeform.php?id=" . urlencode($inctype_id);
            } elseif ($_GET['action'] == 'add') {
                $inctype_id = POST('id');
                $custom_name = POST('custom_namef');
                $custom_name = Util::htmlentities($custom_name, ENT_QUOTES);
                $custom_old_name = POST('old_name');
                $custom_old_name = Util::htmlentities($custom_old_name, ENT_QUOTES);
                $custom_type = POST('custom_typef');
                $custom_options = POST('custom_optionsf');
                $custom_required = POST('custom_requiredf');
                if (in_array($custom_type, $options) && $custom_options != '' || !in_array($custom_type, $options)) {
                    $next_ord = Incident_custom::get_next_ord($conn, $inctype_id);
                    $params = array($inctype_id, $custom_name, $custom_type, $custom_options, $custom_required, $next_ord);
                    Incident_custom::insert_custom($conn, $params);
                    $location = "modifyincidenttypeform.php?id=" . urlencode($inctype_id);
                }
            } elseif ($_GET['action'] == 'modify_pos') {
                $inctype_id = POST('id');
                $custom_old_name = POST('old_name');
                $custom_name = Util::htmlentities($custom_old_name, ENT_QUOTES);
                $custom_oldpos = POST('oldpos');
                $custom_newpos = POST('newpos');
                Incident_custom::update_ord($conn, $custom_oldpos, $custom_newpos, $inctype_id, $custom_old_name);
                $location = "modifyincidenttypeform.php?id=" . urlencode($inctype_id);
            }
            $db->close($conn);
            header("Location: {$location}");
        }
    }
}