allow adding multiple object classes
This commit is contained in:
parent
766fe93cba
commit
d97c2e5afc
|
@ -62,7 +62,7 @@ setlanguage();
|
||||||
|
|
||||||
$dn = rawurldecode( $_POST['dn'] );
|
$dn = rawurldecode( $_POST['dn'] );
|
||||||
$encoded_dn = rawurlencode( $dn );
|
$encoded_dn = rawurlencode( $dn );
|
||||||
$new_oclass = $_POST['new_oclass'];
|
$new_oclass = unserialize( rawurldecode( $_POST['new_oclass'] ) );
|
||||||
$new_attrs = $_POST['new_attrs'];
|
$new_attrs = $_POST['new_attrs'];
|
||||||
|
|
||||||
$new_entry = array();
|
$new_entry = array();
|
||||||
|
|
|
@ -75,11 +75,14 @@ foreach( $entry as $attr => $junk )
|
||||||
$current_attrs[] = strtolower($attr);
|
$current_attrs[] = strtolower($attr);
|
||||||
|
|
||||||
// grab the required attributes for the new objectClass
|
// grab the required attributes for the new objectClass
|
||||||
$oclass = get_schema_objectclass( $new_oclass );
|
$schema_oclasses = get_schema_objectclasses();
|
||||||
if( $oclass )
|
|
||||||
$must_attrs = $oclass->getMustAttrs();
|
|
||||||
else
|
|
||||||
$must_attrs = array();
|
$must_attrs = array();
|
||||||
|
foreach($new_oclass as $oclass_name) {
|
||||||
|
$oclass = get_schema_objectclass($oclass_name);
|
||||||
|
if($oclass)
|
||||||
|
$must_attrs = array_merge($must_attrs, $oclass->getMustAttrNames($schema_oclasses));
|
||||||
|
}
|
||||||
|
$must_attrs = array_unique( $must_attrs );
|
||||||
|
|
||||||
// We don't want any of the attr meta-data, just the string
|
// We don't want any of the attr meta-data, just the string
|
||||||
//foreach( $must_attrs as $i => $attr )
|
//foreach( $must_attrs as $i => $attr )
|
||||||
|
@ -89,7 +92,7 @@ else
|
||||||
// but that the object does not currently contain
|
// but that the object does not currently contain
|
||||||
$needed_attrs = array();
|
$needed_attrs = array();
|
||||||
foreach( $must_attrs as $attr ) {
|
foreach( $must_attrs as $attr ) {
|
||||||
$attr = get_schema_attribute( $attr->getName() );
|
$attr = get_schema_attribute($attr);
|
||||||
//echo "<pre>"; var_dump( $attr ); echo "</pre>";
|
//echo "<pre>"; var_dump( $attr ); echo "</pre>";
|
||||||
// First, check if one of this attr's aliases is already an attribute of this entry
|
// First, check if one of this attr's aliases is already an attribute of this entry
|
||||||
foreach( $attr->getAliases() as $alias_attr_name )
|
foreach( $attr->getAliases() as $alias_attr_name )
|
||||||
|
@ -120,7 +123,7 @@ if( count( $needed_attrs ) > 0 )
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<form action="add_oclass.php" method="post">
|
<form action="add_oclass.php" method="post">
|
||||||
<input type="hidden" name="new_oclass" value="<?php echo htmlspecialchars( $new_oclass ); ?>" />
|
<input type="hidden" name="new_oclass" value="<?php echo rawurlencode(serialize($new_oclass)); ?>" />
|
||||||
<input type="hidden" name="dn" value="<?php echo $encoded_dn; ?>" />
|
<input type="hidden" name="dn" value="<?php echo $encoded_dn; ?>" />
|
||||||
|
|
||||||
<table class="tree_edit_dn" cellspacing="0">
|
<table class="tree_edit_dn" cellspacing="0">
|
||||||
|
|
|
@ -141,7 +141,7 @@ if( $is_object_class ) {
|
||||||
|
|
||||||
<form action="add_oclass_form.php" method="post" class="new_value">
|
<form action="add_oclass_form.php" method="post" class="new_value">
|
||||||
<input type="hidden" name="dn" value="<?php echo $encoded_dn; ?>" />
|
<input type="hidden" name="dn" value="<?php echo $encoded_dn; ?>" />
|
||||||
<select name="new_oclass">
|
<select name="new_oclass[]" multiple size="15">
|
||||||
|
|
||||||
<?php foreach( $schema_oclasses as $name => $oclass ) {
|
<?php foreach( $schema_oclasses as $name => $oclass ) {
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ if( $is_object_class ) {
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
</select> <input type="submit" value="<?php echo _('Add'); ?>" />
|
</select><br /><br /><input type="submit" value="<?php echo _('Add'); ?>" />
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue