diff --git a/app/Classes/LDAP/Attribute/ObjectClass.php b/app/Classes/LDAP/Attribute/ObjectClass.php index 62ba706a..e2265891 100644 --- a/app/Classes/LDAP/Attribute/ObjectClass.php +++ b/app/Classes/LDAP/Attribute/ObjectClass.php @@ -6,6 +6,7 @@ use Illuminate\Contracts\View\View; use Illuminate\Support\Collection; use App\Classes\LDAP\Attribute; +use App\Ldap\Entry; /** * Represents an ObjectClass Attribute @@ -74,6 +75,7 @@ final class ObjectClass extends Attribute return view('components.attribute.objectclass') ->with('o',$this) ->with('edit',$edit) + ->with('langtag',Entry::TAG_NOTAG) ->with('old',$old) ->with('new',$new); } diff --git a/app/Http/Controllers/APIController.php b/app/Http/Controllers/APIController.php index 53d912a8..a1ed3027 100644 --- a/app/Http/Controllers/APIController.php +++ b/app/Http/Controllers/APIController.php @@ -97,7 +97,6 @@ class APIController extends Controller /** * Return the required and additional attributes for an object class * - * @param Request $request * @param string $objectclass * @return array */ diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 5c87e5bf..e3926e83 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -93,11 +93,11 @@ class HomeController extends Controller return $request->noheader ? view(sprintf('components.attribute.widget.%s',$id)) - ->with('o',Factory::create($dn,$id,[],$request->objectclasses)) + ->with('o',Factory::create(dn: $dn,attribute: $id,values: [],oc: $request->objectclasses)) ->with('value',$request->value) ->with('langtag',Entry::TAG_NOTAG) ->with('loop',$xx) - : new AttributeType(Factory::create($dn,$id,[],$request->objectclasses),TRUE) + : new AttributeType(Factory::create($dn,$id,[],$request->objectclasses),new: TRUE,edit: TRUE) ->render(); } diff --git a/app/View/Components/Attribute.php b/app/View/Components/Attribute.php index 1716ce93..b94b6568 100644 --- a/app/View/Components/Attribute.php +++ b/app/View/Components/Attribute.php @@ -2,6 +2,8 @@ namespace App\View\Components; +use Closure; +use Illuminate\Contracts\View\View; use Illuminate\View\Component; use App\Classes\LDAP\Attribute as LDAPAttribute; @@ -32,13 +34,13 @@ class Attribute extends Component /** * Get the view / contents that represent the component. * - * @return \Illuminate\Contracts\View\View|\Closure|string + * @return View|string */ - public function render() + public function render(): View|string { return $this->o ? $this->o - ->render($this->edit,$this->old,$this->new) + ->render(edit: $this->edit,old: $this->old,new: $this->new) : $this->na; } } \ No newline at end of file diff --git a/app/View/Components/AttributeType.php b/app/View/Components/AttributeType.php index 364b4a8e..69bdfda4 100644 --- a/app/View/Components/AttributeType.php +++ b/app/View/Components/AttributeType.php @@ -2,7 +2,6 @@ namespace App\View\Components; -use Closure; use Illuminate\Contracts\View\View; use Illuminate\View\Component; @@ -30,7 +29,7 @@ class AttributeType extends Component /** * Get the view / contents that represent the component. */ - public function render(): View|Closure|string + public function render(): View { return view('components.attribute-type') ->with('o',$this->o) diff --git a/resources/views/components/attribute/widget/options.blade.php b/resources/views/components/attribute/widget/options.blade.php index 290b11e2..2b0d32e7 100644 --- a/resources/views/components/attribute/widget/options.blade.php +++ b/resources/views/components/attribute/widget/options.blade.php @@ -46,6 +46,9 @@ if (added_oc.indexOf(item) !== -1) return; + // Add our new OC to the list of OCs + oc.push(item); + // Add attribute to the page $.ajax({ method: 'POST', @@ -146,7 +149,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); }