diff --git a/app/Classes/LDAP/Attribute.php b/app/Classes/LDAP/Attribute.php index 8d83f9ca..08fcb513 100644 --- a/app/Classes/LDAP/Attribute.php +++ b/app/Classes/LDAP/Attribute.php @@ -307,15 +307,17 @@ class Attribute implements \Countable, \ArrayAccess * @param bool $edit Render an edit form * @param bool $old Use old value * @param bool $new Enable adding values + * @param string $langtag Langtag to use when rendering these attribute values + * @param bool $updated Has the entry been updated (uses rendering highlights)) * @return View */ - public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE): View + public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE,string $langtag=Entry::TAG_NOTAG,bool $updated=FALSE): View { $view = match ($this->schema?->syntax_oid) { self::SYNTAX_CERTIFICATE => view('components.syntax.certificate'), self::SYNTAX_CERTIFICATE_LIST => view('components.syntax.certificatelist'), - default => view()->exists($x = 'components.attribute.' . $this->name_lc) + default => view()->exists($x='components.attribute.'.$this->name_lc) ? view($x) : view('components.attribute'), }; @@ -324,7 +326,9 @@ class Attribute implements \Countable, \ArrayAccess ->with('o',$this) ->with('edit',$edit) ->with('old',$old) - ->with('new',$new); + ->with('new',$new) + ->with('langtag',$langtag) + ->with('updated',$updated); } public function render_item_old(string $dotkey): ?string diff --git a/app/Classes/LDAP/Attribute/Binary/JpegPhoto.php b/app/Classes/LDAP/Attribute/Binary/JpegPhoto.php index cc876305..37f64aa0 100644 --- a/app/Classes/LDAP/Attribute/Binary/JpegPhoto.php +++ b/app/Classes/LDAP/Attribute/Binary/JpegPhoto.php @@ -15,7 +15,7 @@ final class JpegPhoto extends Binary { use MD5Updates; - public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE,string $langtag=Entry::TAG_NOTAG): View + public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE,string $langtag=Entry::TAG_NOTAG,bool $updated=FALSE): View { return view('components.attribute.binary.jpegphoto') ->with('o',$this) @@ -23,6 +23,7 @@ final class JpegPhoto extends Binary ->with('old',$old) ->with('new',$new) ->with('langtag',$langtag) + ->with('updated',$updated) ->with('f',new \finfo); } } \ No newline at end of file diff --git a/app/Classes/LDAP/Attribute/GidNumber.php b/app/Classes/LDAP/Attribute/GidNumber.php index c6ad0bd1..b2a05a35 100644 --- a/app/Classes/LDAP/Attribute/GidNumber.php +++ b/app/Classes/LDAP/Attribute/GidNumber.php @@ -9,5 +9,4 @@ use App\Classes\LDAP\Attribute; */ final class GidNumber extends Attribute { - protected(set) bool $no_attr_tags = FALSE; } \ No newline at end of file diff --git a/app/Classes/LDAP/Attribute/Internal.php b/app/Classes/LDAP/Attribute/Internal.php index d6d99097..4f5701e2 100644 --- a/app/Classes/LDAP/Attribute/Internal.php +++ b/app/Classes/LDAP/Attribute/Internal.php @@ -5,6 +5,7 @@ namespace App\Classes\LDAP\Attribute; use Illuminate\Contracts\View\View; use App\Classes\LDAP\Attribute; +use App\Ldap\Entry; /** * Represents an attribute whose values are internal @@ -14,7 +15,7 @@ abstract class Internal extends Attribute protected(set) bool $is_internal = TRUE; protected(set) bool $no_attr_tags = TRUE; - public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE): View + public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE,string $langtag=Entry::TAG_NOTAG,bool $updated=FALSE): View { // @note Internal attributes cannot be edited return view('components.attribute.internal') diff --git a/app/Classes/LDAP/Attribute/Internal/Timestamp.php b/app/Classes/LDAP/Attribute/Internal/Timestamp.php index 52070f51..72533331 100644 --- a/app/Classes/LDAP/Attribute/Internal/Timestamp.php +++ b/app/Classes/LDAP/Attribute/Internal/Timestamp.php @@ -5,13 +5,14 @@ namespace App\Classes\LDAP\Attribute\Internal; use Illuminate\Contracts\View\View; use App\Classes\LDAP\Attribute\Internal; +use App\Ldap\Entry; /** * Represents an attribute whose values are timestamps */ final class Timestamp extends Internal { - public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE): View + public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE,string $langtag=Entry::TAG_NOTAG,bool $updated=FALSE): View { // @note Internal attributes cannot be edited return view('components.attribute.internal.timestamp') diff --git a/app/Classes/LDAP/Attribute/KrbPrincipalKey.php b/app/Classes/LDAP/Attribute/KrbPrincipalKey.php index 19b1cba3..1fb378e6 100644 --- a/app/Classes/LDAP/Attribute/KrbPrincipalKey.php +++ b/app/Classes/LDAP/Attribute/KrbPrincipalKey.php @@ -3,9 +3,9 @@ namespace App\Classes\LDAP\Attribute; use Illuminate\Contracts\View\View; -use Illuminate\Support\Arr; use App\Classes\LDAP\Attribute; +use App\Ldap\Entry; use App\Traits\MD5Updates; /** @@ -17,13 +17,14 @@ final class KrbPrincipalKey extends Attribute protected(set) bool $no_attr_tags = TRUE; - public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE): View + public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE,string $langtag=Entry::TAG_NOTAG,bool $updated=FALSE): View { return view('components.attribute.krbprincipalkey') ->with('o',$this) ->with('edit',$edit) ->with('old',$old) - ->with('new',$new); + ->with('new',$new) + ->with('updated',$updated); } public function render_item_old(string $dotkey): ?string diff --git a/app/Classes/LDAP/Attribute/KrbTicketFlags.php b/app/Classes/LDAP/Attribute/KrbTicketFlags.php index d9a4a775..6921a9d3 100644 --- a/app/Classes/LDAP/Attribute/KrbTicketFlags.php +++ b/app/Classes/LDAP/Attribute/KrbTicketFlags.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 attribute whose value is a Kerberos Ticket Flag @@ -49,13 +50,14 @@ final class KrbTicketFlags extends Attribute return $helpers; } - public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE): View + public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE,string $langtag=Entry::TAG_NOTAG,bool $updated=FALSE): View { return view('components.attribute.krbticketflags') ->with('o',$this) ->with('edit',$edit) ->with('old',$old) ->with('new',$new) + ->with('updated',$updated) ->with('helper',static::helpers()); } } \ No newline at end of file diff --git a/app/Classes/LDAP/Attribute/ObjectClass.php b/app/Classes/LDAP/Attribute/ObjectClass.php index e2265891..ca179a4d 100644 --- a/app/Classes/LDAP/Attribute/ObjectClass.php +++ b/app/Classes/LDAP/Attribute/ObjectClass.php @@ -70,14 +70,14 @@ final class ObjectClass extends Attribute ->contains($value); } - public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE): View + public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE,string $langtag=Entry::TAG_NOTAG,bool $updated=FALSE): View { return view('components.attribute.objectclass') ->with('o',$this) ->with('edit',$edit) - ->with('langtag',Entry::TAG_NOTAG) ->with('old',$old) - ->with('new',$new); + ->with('new',$new) + ->with('updated',$updated); } private function set_oc_schema(Collection $tv): void diff --git a/app/Classes/LDAP/Attribute/Password.php b/app/Classes/LDAP/Attribute/Password.php index d9ebc61b..e84e47c8 100644 --- a/app/Classes/LDAP/Attribute/Password.php +++ b/app/Classes/LDAP/Attribute/Password.php @@ -7,6 +7,7 @@ use Illuminate\Support\Arr; use Illuminate\Support\Collection; use App\Classes\LDAP\Attribute; +use App\Ldap\Entry; use App\Traits\MD5Updates; /** @@ -78,13 +79,14 @@ final class Password extends Attribute return ($helpers=static::helpers())->has($id) ? new ($helpers->get($id)) : NULL; } - public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE): View + public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE,string $langtag=Entry::TAG_NOTAG,bool $updated=FALSE): View { return view('components.attribute.password') ->with('o',$this) ->with('edit',$edit) ->with('old',$old) ->with('new',$new) + ->with('updated',$updated) ->with('helpers',static::helpers()->map(fn($item,$key)=>['id'=>$key,'value'=>$key])->sort()); } diff --git a/app/Classes/LDAP/Attribute/RDN.php b/app/Classes/LDAP/Attribute/RDN.php index ea26007f..c28eb67e 100644 --- a/app/Classes/LDAP/Attribute/RDN.php +++ b/app/Classes/LDAP/Attribute/RDN.php @@ -6,6 +6,7 @@ use Illuminate\Contracts\View\View; use Illuminate\Support\Collection; use App\Classes\LDAP\Attribute; +use App\Ldap\Entry; /** * Represents the RDN for an Entry @@ -31,7 +32,7 @@ final class RDN extends Attribute ]); } - public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE): View + public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE,string $langtag=Entry::TAG_NOTAG,bool $updated=FALSE): View { return view('components.attribute.rdn') ->with('o',$this); diff --git a/app/Classes/LDAP/Attribute/Schema.php b/app/Classes/LDAP/Attribute/Schema.php index b971784a..22941082 100644 --- a/app/Classes/LDAP/Attribute/Schema.php +++ b/app/Classes/LDAP/Attribute/Schema.php @@ -7,6 +7,7 @@ use Illuminate\Support\Arr; use Illuminate\Support\Facades\Cache; use App\Classes\LDAP\Attribute; +use App\Ldap\Entry; /** * Represents an attribute whose values are schema related @@ -53,7 +54,7 @@ abstract class Schema extends Attribute __('No description available, can you help with one?')); } - public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE): View + public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE,string $langtag=Entry::TAG_NOTAG,bool $updated=FALSE): View { // @note Schema attributes cannot be edited return view('components.attribute.internal') diff --git a/app/Classes/LDAP/Attribute/Schema/Generic.php b/app/Classes/LDAP/Attribute/Schema/Generic.php index dbc92338..64645d5d 100644 --- a/app/Classes/LDAP/Attribute/Schema/Generic.php +++ b/app/Classes/LDAP/Attribute/Schema/Generic.php @@ -5,13 +5,14 @@ namespace App\Classes\LDAP\Attribute\Schema; use Illuminate\Contracts\View\View; use App\Classes\LDAP\Attribute\Schema; +use App\Ldap\Entry; /** * Represents a Generic Schema Attribute */ class Generic extends Schema { - public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE): View + public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE,string $langtag=Entry::TAG_NOTAG,bool $updated=FALSE): View { // @note Schema attributes cannot be edited return view('components.attribute.schema.generic') diff --git a/app/Classes/LDAP/Attribute/Schema/Mechanisms.php b/app/Classes/LDAP/Attribute/Schema/Mechanisms.php index 8034b934..2cbf8396 100644 --- a/app/Classes/LDAP/Attribute/Schema/Mechanisms.php +++ b/app/Classes/LDAP/Attribute/Schema/Mechanisms.php @@ -5,6 +5,7 @@ namespace App\Classes\LDAP\Attribute\Schema; use Illuminate\Contracts\View\View; use App\Classes\LDAP\Attribute\Schema; +use App\Ldap\Entry; /** * Represents a Mechanisms Attribute @@ -33,7 +34,7 @@ final class Mechanisms extends Schema return parent::_get(config_path('ldap_supported_saslmechanisms.txt'),$string,$key); } - public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE): View + public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE,string $langtag=Entry::TAG_NOTAG,bool $updated=FALSE): View { // @note Schema attributes cannot be edited return view('components.attribute.schema.mechanisms') diff --git a/app/Classes/LDAP/Attribute/Schema/OID.php b/app/Classes/LDAP/Attribute/Schema/OID.php index 77a75d3e..2b9765b0 100644 --- a/app/Classes/LDAP/Attribute/Schema/OID.php +++ b/app/Classes/LDAP/Attribute/Schema/OID.php @@ -5,6 +5,7 @@ namespace App\Classes\LDAP\Attribute\Schema; use Illuminate\Contracts\View\View; use App\Classes\LDAP\Attribute\Schema; +use App\Ldap\Entry; /** * Represents an OID Attribute @@ -34,7 +35,7 @@ final class OID extends Schema return parent::_get(config_path('ldap_supported_oids.txt'),$string,$key); } - public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE): View + public function render(bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE,string $langtag=Entry::TAG_NOTAG,bool $updated=FALSE): View { // @note Schema attributes cannot be edited return view('components.attribute.schema.oid') diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index f4daf786..b0628cf4 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -91,16 +91,18 @@ class HomeController extends Controller $dn = $request->dn ? Crypt::decrypt($request->dn) : ''; $o = Factory::create(dn: $dn,attribute: $id,values: [],oc: $request->objectclasses); - return $request->noheader + $view = $request->noheader ? view(sprintf('components.attribute.widget.%s',$id)) - ->with('o',$o) ->with('value',$request->value) - ->with('langtag',Entry::TAG_NOTAG) ->with('loop',$xx) : view('components.attribute-type') - ->with('o',$o) ->with('new',TRUE) ->with('edit',TRUE); + + return $view + ->with('o',$o) + ->with('langtag',Entry::TAG_NOTAG) + ->with('updated',FALSE); } public function entry_create(EntryAddRequest $request): \Illuminate\Http\RedirectResponse diff --git a/app/View/Components/Attribute.php b/app/View/Components/Attribute.php index 84dab452..9e7b0344 100644 --- a/app/View/Components/Attribute.php +++ b/app/View/Components/Attribute.php @@ -19,13 +19,14 @@ class Attribute extends Component /** * Create a new component instance. */ - public function __construct(?LDAPAttribute $o,bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE,string $langtag=Entry::TAG_NOTAG) + public function __construct(?LDAPAttribute $o,bool $edit=FALSE,bool $old=FALSE,bool $new=FALSE,string $langtag=Entry::TAG_NOTAG,bool $updated=FALSE) { $this->o = $o; $this->edit = $edit; $this->old = $old; $this->new = $new; $this->langtag = $langtag; + $this->updated = $updated; } /** @@ -37,7 +38,7 @@ class Attribute extends Component { return $this->o ? $this->o - ->render(edit: $this->edit,old: $this->old,new: $this->new) + ->render(edit: $this->edit,old: $this->old,new: $this->new,langtag: $this->langtag,updated: $this->updated) : __('Unknown'); } } \ No newline at end of file diff --git a/public/css/custom.css b/public/css/custom.css index f7f8c16f..47e325e3 100644 --- a/public/css/custom.css +++ b/public/css/custom.css @@ -23,6 +23,10 @@ input.form-control.input-group-end { border-top-right-radius: 4px !important; } +.custom-tooltip-success { + --bs-tooltip-bg: var(--bs-success); +} + .custom-tooltip-warning { --bs-tooltip-bg: var(--bs-warning); --bs-tooltip-color: black; @@ -69,4 +73,13 @@ input.form-control.input-group-end { /* hide the site icons when the search is opened */ .search-wrapper.active + .header-menu.nav { display: none; +} + +.page-title-wrapper .page-title-items { + margin-left: auto; + max-width: 50%; +} + +.page-title-wrapper .page-title-items .page-title-status .alert { + font-size: 0.80em; } \ No newline at end of file diff --git a/resources/themes/architect/views/layouts/partials/contentheader.blade.php b/resources/themes/architect/views/layouts/partials/contentheader.blade.php index 9758beb3..2c3c5d73 100644 --- a/resources/themes/architect/views/layouts/partials/contentheader.blade.php +++ b/resources/themes/architect/views/layouts/partials/contentheader.blade.php @@ -13,8 +13,14 @@ -
@lang('Validation Errors')
{{ session()->pull('note') }}
+{{ session()->pull('note') }}
{{ __('Entry updated') }}
-@lang('Entry updated') [{{ session()->get('updated')->count() }} @lang('attributes(s)')]