Remove Components/AttributeType::class it wasnt providing any functionality
This commit is contained in:
parent
6954b09089
commit
bab5a2626d
@ -22,7 +22,6 @@ use App\Exceptions\Import\{GeneralException,VersionException};
|
|||||||
use App\Exceptions\InvalidUsage;
|
use App\Exceptions\InvalidUsage;
|
||||||
use App\Http\Requests\{EntryRequest,EntryAddRequest,ImportRequest};
|
use App\Http\Requests\{EntryRequest,EntryAddRequest,ImportRequest};
|
||||||
use App\Ldap\Entry;
|
use App\Ldap\Entry;
|
||||||
use App\View\Components\AttributeType;
|
|
||||||
|
|
||||||
class HomeController extends Controller
|
class HomeController extends Controller
|
||||||
{
|
{
|
||||||
@ -90,15 +89,18 @@ class HomeController extends Controller
|
|||||||
$xx->index = 0;
|
$xx->index = 0;
|
||||||
|
|
||||||
$dn = $request->dn ? Crypt::decrypt($request->dn) : '';
|
$dn = $request->dn ? Crypt::decrypt($request->dn) : '';
|
||||||
|
$o = Factory::create(dn: $dn,attribute: $id,values: [],oc: $request->objectclasses);
|
||||||
|
|
||||||
return $request->noheader
|
return $request->noheader
|
||||||
? view(sprintf('components.attribute.widget.%s',$id))
|
? view(sprintf('components.attribute.widget.%s',$id))
|
||||||
->with('o',Factory::create(dn: $dn,attribute: $id,values: [],oc: $request->objectclasses))
|
->with('o',$o)
|
||||||
->with('value',$request->value)
|
->with('value',$request->value)
|
||||||
->with('langtag',Entry::TAG_NOTAG)
|
->with('langtag',Entry::TAG_NOTAG)
|
||||||
->with('loop',$xx)
|
->with('loop',$xx)
|
||||||
: new AttributeType(Factory::create($dn,$id,[],$request->objectclasses),new: TRUE,edit: TRUE)
|
: view('components.attribute-type')
|
||||||
->render();
|
->with('o',$o)
|
||||||
|
->with('new',TRUE)
|
||||||
|
->with('edit',TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function entry_create(EntryAddRequest $request): \Illuminate\Http\RedirectResponse
|
public function entry_create(EntryAddRequest $request): \Illuminate\Http\RedirectResponse
|
||||||
@ -350,7 +352,8 @@ class HomeController extends Controller
|
|||||||
|
|
||||||
return Redirect::to('/')
|
return Redirect::to('/')
|
||||||
->withInput()
|
->withInput()
|
||||||
->with('updated',collect($dirty)->map(fn($item,$key)=>$o->getObject(collect(explode(';',$key))->first())));
|
->with('updated',collect($dirty)
|
||||||
|
->map(fn($item,$key)=>$o->getObject(collect(explode(';',$key))->first())));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\View\Components;
|
namespace App\View\Components;
|
||||||
|
|
||||||
use Closure;
|
|
||||||
use Illuminate\Contracts\View\View;
|
use Illuminate\Contracts\View\View;
|
||||||
use Illuminate\View\Component;
|
use Illuminate\View\Component;
|
||||||
|
|
||||||
@ -16,19 +15,17 @@ class Attribute extends Component
|
|||||||
public bool $new;
|
public bool $new;
|
||||||
public bool $old;
|
public bool $old;
|
||||||
public string $langtag;
|
public string $langtag;
|
||||||
public ?string $na; // Text to render if the LDAPAttribute is null
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new component instance.
|
* Create a new component instance.
|
||||||
*/
|
*/
|
||||||
public function __construct(?LDAPAttribute $o,bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE,string $langtag=Entry::TAG_NOTAG,?string $na=NULL)
|
public function __construct(?LDAPAttribute $o,bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE,string $langtag=Entry::TAG_NOTAG)
|
||||||
{
|
{
|
||||||
$this->o = $o;
|
$this->o = $o;
|
||||||
$this->edit = $edit;
|
$this->edit = $edit;
|
||||||
$this->old = $old;
|
$this->old = $old;
|
||||||
$this->new = $new;
|
$this->new = $new;
|
||||||
$this->langtag = $langtag;
|
$this->langtag = $langtag;
|
||||||
$this->na = $na;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,6 +38,6 @@ class Attribute extends Component
|
|||||||
return $this->o
|
return $this->o
|
||||||
? $this->o
|
? $this->o
|
||||||
->render(edit: $this->edit,old: $this->old,new: $this->new)
|
->render(edit: $this->edit,old: $this->old,new: $this->new)
|
||||||
: $this->na;
|
: __('Unknown');
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,40 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\View\Components;
|
|
||||||
|
|
||||||
use Illuminate\Contracts\View\View;
|
|
||||||
use Illuminate\View\Component;
|
|
||||||
|
|
||||||
use App\Classes\LDAP\Attribute as LDAPAttribute;
|
|
||||||
use App\Ldap\Entry;
|
|
||||||
|
|
||||||
class AttributeType extends Component
|
|
||||||
{
|
|
||||||
private LDAPAttribute $o;
|
|
||||||
private bool $new;
|
|
||||||
private bool $edit;
|
|
||||||
private string $langtag;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new component instance.
|
|
||||||
*/
|
|
||||||
public function __construct(LDAPAttribute $o,bool $new=FALSE,bool $edit=FALSE,string $langtag=Entry::TAG_NOTAG)
|
|
||||||
{
|
|
||||||
$this->o = $o;
|
|
||||||
$this->new = $new;
|
|
||||||
$this->edit = $edit;
|
|
||||||
$this->langtag = $langtag;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the view / contents that represent the component.
|
|
||||||
*/
|
|
||||||
public function render(): View
|
|
||||||
{
|
|
||||||
return view('components.attribute-type')
|
|
||||||
->with('o',$this->o)
|
|
||||||
->with('new',$this->new)
|
|
||||||
->with('edit',$this->edit)
|
|
||||||
->with('langtag',$this->langtag);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +1,3 @@
|
|||||||
<!-- $o=AttributeType::class -->
|
|
||||||
<div class="row pb-3">
|
<div class="row pb-3">
|
||||||
<div class="col-12 col-sm-1 col-md-2"></div>
|
<div class="col-12 col-sm-1 col-md-2"></div>
|
||||||
<div class="col-12 col-sm-10 col-md-8">
|
<div class="col-12 col-sm-10 col-md-8">
|
||||||
@ -15,7 +14,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<x-attribute :o="$o" :edit="$edit" :new="$new" :langtag="$langtag"/>
|
<x-attribute :o="$o" :edit="$edit ?? FALSE" :new="$new ?? FALSE" :langtag="$langtag ?? \App\Ldap\Entry::TAG_NOTAG"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
|
@use(App\Ldap\Entry)
|
||||||
|
|
||||||
<!-- $o=Attribute::class -->
|
<!-- $o=Attribute::class -->
|
||||||
<x-attribute.layout :edit="$edit" :new="$new" :o="$o">
|
<x-attribute.layout :edit="$edit=($edit ?? FALSE)" :new="$new=($new ?? FALSE)" :o="$o">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
@foreach(Arr::get(old($o->name_lc,[$langtag=>$new ? [NULL] : $o->tagValues($langtag)]),$langtag,[]) as $key => $value)
|
@foreach(Arr::get(old($o->name_lc,[($langtag=($langtag ?? Entry::TAG_NOTAG))=>$new ? [NULL] : $o->tagValues($langtag)]),$langtag,[]) as $key => $value)
|
||||||
@if($edit && (! $o->is_rdn))
|
@if($edit && (! $o->is_rdn))
|
||||||
<div class="input-group has-validation">
|
<div class="input-group has-validation">
|
||||||
<input type="text" @class(['form-control','is-invalid'=>($e=$errors->get($o->name_lc.'.'.$langtag.'.'.$loop->index)),'mb-1','border-focus'=>! ($tv=$o->tagValuesOld($langtag))->contains($value)]) name="{{ $o->name_lc }}[{{ $langtag }}][]" value="{{ $value }}" placeholder="{{ ! is_null($x=$tv->get($loop->index)) ? $x : '['.__('NEW').']' }}" @readonly(! $new) @disabled($o->isDynamic())>
|
<input type="text" @class(['form-control','is-invalid'=>($e=$errors->get($o->name_lc.'.'.$langtag.'.'.$loop->index)),'mb-1','border-focus'=>! ($tv=$o->tagValuesOld($langtag))->contains($value)]) name="{{ $o->name_lc }}[{{ $langtag }}][]" value="{{ $value }}" placeholder="{{ ! is_null($x=$tv->get($loop->index)) ? $x : '['.__('NEW').']' }}" @readonly(! $new) @disabled($o->isDynamic())>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<div class="row pt-2">
|
<div class="row pt-2">
|
||||||
<div @class(['col-1','d-none'=>(! $edit) && (! ($detail ?? false))])></div>
|
<div @class(['col-1','d-none'=>(! $edit) && (! ($detail ?? FALSE))])></div>
|
||||||
<div class="col-10">
|
<div class="col-10">
|
||||||
<attribute id="{{ $o->name }}">
|
<attribute id="{{ $o->name }}">
|
||||||
{{ $slot }}
|
{{ $slot }}
|
||||||
|
@ -11,19 +11,19 @@
|
|||||||
<tr class="mt-1">
|
<tr class="mt-1">
|
||||||
<td class="p-0 pe-2">Created</td>
|
<td class="p-0 pe-2">Created</td>
|
||||||
<th class="p-0">
|
<th class="p-0">
|
||||||
<x-attribute :o="$o->getObject('createtimestamp')" :na="__('Unknown')"/> [<x-attribute :o="$o->getObject('creatorsname')" :na="__('Unknown')"/>]
|
<x-attribute :o="$o->getObject('createtimestamp')"/> [<x-attribute :o="$o->getObject('creatorsname')"/>]
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="mt-1">
|
<tr class="mt-1">
|
||||||
<td class="p-0 pe-2">Modified</td>
|
<td class="p-0 pe-2">Modified</td>
|
||||||
<th class="p-0">
|
<th class="p-0">
|
||||||
<x-attribute :o="$o->getObject('modifytimestamp')" :na="__('Unknown')"/> [<x-attribute :o="$o->getObject('modifiersname')" :na="__('Unknown')"/>]
|
<x-attribute :o="$o->getObject('modifytimestamp')"/> [<x-attribute :o="$o->getObject('modifiersname')"/>]
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="mt-1">
|
<tr class="mt-1">
|
||||||
<td class="p-0 pe-2">UUID</td>
|
<td class="p-0 pe-2">UUID</td>
|
||||||
<th class="p-0">
|
<th class="p-0">
|
||||||
<x-attribute :o="$o->getObject('entryuuid')" :na="__('Unknown')"/>
|
<x-attribute :o="$o->getObject('entryuuid')""/>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
@if($langtags->count())
|
@if($langtags->count())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user