diff --git a/public/css/custom.css b/public/css/custom.css
index 807825d8..a0b522fe 100644
--- a/public/css/custom.css
+++ b/public/css/custom.css
@@ -1,5 +1,5 @@
/** ensure our userpassword has select is next to the password input */
-div#userPassword .select2-container--bootstrap-5 .select2-selection {
+attribute#userPassword .select2-container--bootstrap-5 .select2-selection {
font-size: inherit;
width: 9em;
border: #444054 1px solid;
@@ -11,7 +11,7 @@ div#userPassword .select2-container--bootstrap-5 .select2-selection {
border-top-right-radius: unset;
}
-div#objectClass .input-group-end:not(input.form-control) {
+attribute#objectClass .input-group-end:not(input.form-control) {
position: absolute;
right: 1em;
top: 0.5em;
diff --git a/resources/views/components/attribute/layout.blade.php b/resources/views/components/attribute/layout.blade.php
index 080e7f06..014a11d7 100644
--- a/resources/views/components/attribute/layout.blade.php
+++ b/resources/views/components/attribute/layout.blade.php
@@ -1,10 +1,10 @@
+
\ No newline at end of file
diff --git a/resources/views/components/attribute/widget/options.blade.php b/resources/views/components/attribute/widget/options.blade.php
index c5a45c77..5dbccb70 100644
--- a/resources/views/components/attribute/widget/options.blade.php
+++ b/resources/views/components/attribute/widget/options.blade.php
@@ -1,15 +1,18 @@
+@use(App\Classes\LDAP\Attribute\Binary\JpegPhoto)
+@use(App\Classes\LDAP\Attribute\ObjectClass)
@php($clone=FALSE)
-@if($o->is_rdn)
-
-@elseif($edit && $o->can_addvalues)
-
+
+ @if($o->is_rdn)
+
+
+ @elseif($edit && $o->can_addvalues)
@switch(get_class($o))
- @case('App\Classes\LDAP\Attribute\Binary\JpegPhoto')
+ @case(JpegPhoto::class)
@break
- @case('App\Classes\LDAP\Attribute\ObjectClass')
+ @case(ObjectClass::class)
@@ -37,42 +40,12 @@
$(document).ready(function() {
var added_oc = []; // Object classes being added to this entry
var rendered = false;
+ var newadded = [];
- // Show our ObjectClass modal so that we can add more objectclasses
- $('#new_objectclass-modal').on('shown.bs.modal',function() {
- if (! rendered)
- $.ajax({
- method: 'POST',
- url: '{{ url('entry/objectclass/add') }}',
- data: {
- oc: oc,
- },
- cache: false,
- success: function(data) {
- $('select#newoc').select2({
- dropdownParent: $('#new_objectclass-modal'),
- theme: 'bootstrap-5',
- multiple: true,
- data: data,
- });
- },
- error: function(e) {
- if (e.status !== 412)
- alert('That didnt work? Please try again....');
- },
- });
-
- rendered = true;
- })
-
- // When the ObjectClass modal is closed, process what was selected
- $('#new_objectclass-modal').on('hide.bs.modal',function() {
- var newadded = $('select#newoc').val();
-
- // If nothing selected, we dont have anything to do
- if (added_oc.sort().join('|') === newadded.sort().join('|'))
- return;
+ if (newadded.length)
+ process_oc();
+ function process_oc() {
// Find out what was selected, and add them
newadded.forEach(function (item) {
if (added_oc.indexOf(item) !== -1)
@@ -97,6 +70,7 @@
},
});
+ // Get a list of attributes already on the page, so we dont double up
$.ajax({
method: 'POST',
url: '{{ url('api/schema/objectclass/attrs') }}/'+item,
@@ -105,6 +79,9 @@
// Render any must attributes
if (data.must.length) {
data.must.forEach(function(item) {
+ if ($('attribute#'+item).length)
+ return;
+
// Add attribute to the page
$.ajax({
method: 'POST',
@@ -174,7 +151,7 @@
if (x.length) {
x.remove();
- // Add this to the must attrs list, because its been rendered
+ // Add this to the must attrs list, because its been rendered
} else {
attrs.push(mayitem);
}
@@ -196,13 +173,51 @@
});
added_oc = newadded;
+ }
+
+ // Show our ObjectClass modal so that we can add more objectclasses
+ $('#new_objectclass-modal').on('shown.bs.modal',function() {
+ if (! rendered)
+ $.ajax({
+ method: 'POST',
+ url: '{{ url('entry/objectclass/add') }}',
+ data: {
+ oc: oc,
+ },
+ cache: false,
+ success: function(data) {
+ $('select#newoc').select2({
+ dropdownParent: $('#new_objectclass-modal'),
+ theme: 'bootstrap-5',
+ multiple: true,
+ data: data,
+ });
+ },
+ error: function(e) {
+ if (e.status !== 412)
+ alert('That didnt work? Please try again....');
+ },
+ });
+
+ rendered = true;
+ })
+
+ // When the ObjectClass modal is closed, process what was selected
+ $('#new_objectclass-modal').on('hide.bs.modal',function() {
+ newadded = $('select#newoc').val();
+
+ // If nothing selected, we dont have anything to do
+ if (added_oc.sort().join('|') === newadded.sort().join('|'))
+ return;
+
+ process_oc();
});
});
@append
@break
- @case('App\Classes\LDAP\Attribute')
+
@default
@php($clone=TRUE)
(! $new)]) id="{{ $o->name }}-addnew"> @lang('Add Value')
@@ -222,5 +237,5 @@
@endif
@append
@endswitch
-
-@endif
\ No newline at end of file
+ @endif
+
\ No newline at end of file