2021-12-03 02:36:25 +00:00
|
|
|
@extends('layouts.dn')
|
2020-09-13 11:30:04 +00:00
|
|
|
|
|
|
|
@section('page_title')
|
2021-12-08 12:26:12 +00:00
|
|
|
<table class="table table-borderless">
|
|
|
|
<tr>
|
2024-01-10 21:59:40 +00:00
|
|
|
<td class="{{ ($x=$o->getObject('jpegphoto')) ? 'border' : '' }}" rowspan="2">{!! $x ? $x->render() : sprintf('<div class="page-title-icon f32"><i class="%s"></i></div>',$o->icon() ?? "fas fa-info") !!}</td>
|
2023-03-25 12:33:27 +00:00
|
|
|
<td class="text-end align-text-top p-0 {{ $x ? 'ps-5' : 'pt-2' }}"><strong>{{ $dn }}</strong></td>
|
2023-03-02 07:21:53 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="line-height-1" style="font-size: 55%;vertical-align: bottom;" colspan="2">
|
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<td class="p-1 m-1">Created</td>
|
2024-01-10 21:59:40 +00:00
|
|
|
<th class="p-1 m-1">{{ ($x=$o->getObject('createtimestamp')) ? $x->render() : __('Unknown') }} [{{ ($x=$o->getObject('creatorsname')) ? $x->render() : __('Unknown') }}]</th>
|
2023-03-02 07:21:53 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="p-1 m-1">Modified</td>
|
2024-01-10 21:59:40 +00:00
|
|
|
<th class="p-1 m-1">{{ ($x=$o->getObject('modifytimestamp')) ? $x->render() : __('Unknown') }} [{{ ($x=$o->getObject('modifiersname')) ? $x->render() : __('Unknown') }}]</th>
|
2023-03-02 07:21:53 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="p-1 m-1">UUID</td>
|
|
|
|
<th class="p-1 m-1">{{ $o->entryuuid[0] ?? '' }}</th>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</td>
|
2021-12-08 12:26:12 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
2020-09-13 11:30:04 +00:00
|
|
|
@endsection
|
|
|
|
|
|
|
|
@section('main-content')
|
2023-03-31 04:55:08 +00:00
|
|
|
@if(session()->has('note'))
|
|
|
|
<div class="alert alert-info">
|
|
|
|
<h4 class="alert-heading"><i class="fas fa-fw fa-note-sticky"></i> Note:</h4>
|
|
|
|
<hr>
|
|
|
|
<p>{{ session()->pull('note') }}</p>
|
|
|
|
</div>
|
|
|
|
@endif
|
|
|
|
|
|
|
|
@if(session()->has('success'))
|
|
|
|
<div class="alert alert-success">
|
|
|
|
<h4 class="alert-heading"><i class="fas fa-fw fa-thumbs-up"></i> Success!</h4>
|
|
|
|
<hr>
|
|
|
|
<p>{{ session()->pull('success') }}</p>
|
|
|
|
<ul style="list-style-type: square;">
|
|
|
|
@foreach (session()->pull('updated') as $key => $values)
|
|
|
|
<li>{{ $key }}: {{ join(',',$values) }}</li>
|
|
|
|
@endforeach
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
@endif
|
|
|
|
|
2023-09-02 10:50:54 +00:00
|
|
|
<!-- @todo If we are redirected here, check old() and add back any attributes that were in the original submission -->
|
2023-03-31 04:55:08 +00:00
|
|
|
@if($errors->any())
|
|
|
|
<div class="alert alert-danger">
|
|
|
|
<h4 class="alert-heading"><i class="fas fa-fw fa-thumbs-down"></i> Error?</h4>
|
|
|
|
<hr>
|
|
|
|
<ul style="list-style-type: square;">
|
|
|
|
@foreach ($errors->all() as $error)
|
|
|
|
<li>{{ $error }}</li>
|
|
|
|
@endforeach
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
@endif
|
|
|
|
|
2023-03-01 22:54:30 +00:00
|
|
|
<div class="main-card mb-3 card">
|
|
|
|
<div class="card-body">
|
|
|
|
<div class="card-header-tabs">
|
|
|
|
<ul class="nav nav-tabs">
|
2023-04-02 12:41:06 +00:00
|
|
|
<li class="nav-item"><a data-bs-toggle="tab" href="#attributes" class="nav-link active">@lang('Attributes')</a></li>
|
|
|
|
<li class="nav-item"><a data-bs-toggle="tab" href="#internal" class="nav-link">@lang('Internal')</a></li>
|
2023-03-27 05:20:45 +00:00
|
|
|
@env(['local'])
|
2023-04-02 12:41:06 +00:00
|
|
|
<li class="nav-item"><a data-bs-toggle="tab" href="#debug" class="nav-link">@lang('Debug')</a></li>
|
2023-03-27 05:20:45 +00:00
|
|
|
@endenv
|
2023-03-01 22:54:30 +00:00
|
|
|
</ul>
|
|
|
|
|
|
|
|
<div class="tab-content">
|
|
|
|
<!-- All Attributes -->
|
|
|
|
<div class="tab-pane active" id="attributes" role="tabpanel">
|
2023-09-02 10:50:54 +00:00
|
|
|
<form id="dn-edit" method="POST" class="needs-validation" action="{{ url('entry/update/pending') }}" novalidate>
|
2023-03-31 04:55:08 +00:00
|
|
|
@csrf
|
|
|
|
|
|
|
|
<input type="hidden" name="dn" value="{{ $o->getDNSecure() }}">
|
|
|
|
|
2023-09-02 10:50:54 +00:00
|
|
|
@foreach ($o->getVisibleAttributes() as $ao)
|
|
|
|
<x-attribute-type :edit="true" :o="$ao"/>
|
|
|
|
@endforeach
|
|
|
|
|
|
|
|
<div id="newattrs"></div>
|
|
|
|
|
|
|
|
<!-- Add new attributes -->
|
2023-03-31 04:55:08 +00:00
|
|
|
<div class="row">
|
2023-09-02 10:50:54 +00:00
|
|
|
<div class="col-12 col-sm-1 col-md-2"></div>
|
|
|
|
<div class="col-12 col-sm-10 col-md-8">
|
|
|
|
<div class="d-none" id="newattr-select">
|
|
|
|
|
|
|
|
@if($o->getMissingAttributes()->count())
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-12 bg-dark text-light p-2">
|
|
|
|
<i class="fas fa-plus-circle"></i> Add New Attribute
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-12 pt-2">
|
|
|
|
<label for="newattr" class="form-label">Select from...</label>
|
|
|
|
<select class="form-select" id="newattr">
|
|
|
|
<option value=""> </option>
|
|
|
|
@foreach ($o->getMissingAttributes() as $ao)
|
|
|
|
<option value="{{ $ao->name_lc }}">{{ $ao->name }}</option>
|
|
|
|
@endforeach
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
@endif
|
|
|
|
</div>
|
2023-03-31 04:55:08 +00:00
|
|
|
</div>
|
2023-09-02 10:50:54 +00:00
|
|
|
<div class="col-2"></div>
|
2023-03-01 22:54:30 +00:00
|
|
|
</div>
|
|
|
|
|
2023-09-02 10:50:54 +00:00
|
|
|
<div class="row d-none pt-3">
|
2023-03-31 04:55:08 +00:00
|
|
|
<div class="col-12 offset-sm-2 col-sm-4 col-lg-2">
|
2023-04-02 12:41:06 +00:00
|
|
|
<span id="form-reset" class="btn btn-outline-danger">@lang('Reset')</span>
|
|
|
|
<span id="form-submit" class="btn btn-success">@lang('Update')</span>
|
2023-03-31 04:55:08 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
2023-03-01 22:54:30 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Internal Attributes -->
|
|
|
|
<div class="tab-pane" id="internal" role="tabpanel">
|
2023-03-02 07:21:53 +00:00
|
|
|
<div class="row">
|
2023-04-11 22:17:57 +00:00
|
|
|
<div class="col-12 offset-lg-2 col-lg-8">
|
2023-03-02 07:21:53 +00:00
|
|
|
<table class="table">
|
|
|
|
@foreach ($o->getInternalAttributes() as $ao)
|
|
|
|
<tr class="bg-light text-dark small">
|
|
|
|
<th class="w-25">
|
|
|
|
<abbr title="{{ $ao->description }}">{{ $ao->name }}</abbr>
|
|
|
|
</th>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2023-03-25 12:33:27 +00:00
|
|
|
<td class="ps-5">
|
2023-03-31 04:55:08 +00:00
|
|
|
<x-attribute :edit="false" :o="$ao"/>
|
2023-03-02 07:21:53 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
@endforeach
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-03-01 22:54:30 +00:00
|
|
|
</div>
|
|
|
|
|
2023-03-27 05:20:45 +00:00
|
|
|
<!-- Debug -->
|
|
|
|
<div class="tab-pane" id="debug" role="tabpanel">
|
|
|
|
<div class="row">
|
2023-09-02 10:50:54 +00:00
|
|
|
<div class="col-4">
|
2023-03-27 05:20:45 +00:00
|
|
|
@dump($o)
|
|
|
|
</div>
|
2023-09-02 10:50:54 +00:00
|
|
|
<div class="col-4">
|
2023-03-27 05:20:45 +00:00
|
|
|
@dump($o->getAttributes())
|
|
|
|
</div>
|
2023-09-02 10:50:54 +00:00
|
|
|
<div class="col-4">
|
|
|
|
@dump(['available'=>$o->getAvailableAttributes()->pluck('name'),'missing'=>$o->getMissingAttributes()->pluck('name')])
|
|
|
|
</div>
|
2023-03-27 05:20:45 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-03-01 22:54:30 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-09-18 14:08:00 +00:00
|
|
|
</div>
|
2023-03-31 04:55:08 +00:00
|
|
|
@endsection
|
|
|
|
|
2024-01-10 21:59:40 +00:00
|
|
|
@section('page-modals')
|
|
|
|
<!-- Modal -->
|
|
|
|
<div class="modal fade" id="entry-export-modal" tabindex="-1" aria-labelledby="entry-export-label" aria-hidden="true">
|
|
|
|
<div class="modal-dialog modal-lg modal-fullscreen-xl-down">
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
|
|
|
<h1 class="modal-title fs-5" id="entry-export-label">LDIF for {{ $dn }}</h1>
|
|
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="modal-body">
|
|
|
|
<div id="entry-export"><div class="fa-3x"><i class="fas fa-spinner fa-pulse fa-sm"></i></div></div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="modal-footer">
|
|
|
|
<button type="button" class="btn btn-secondary btn-sm" data-bs-dismiss="modal">Close</button>
|
|
|
|
<button id="entry-export-download" type="button" class="btn btn-primary btn-sm">Download</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
@endsection
|
|
|
|
|
2023-03-31 04:55:08 +00:00
|
|
|
@section('page-scripts')
|
2023-04-11 22:17:57 +00:00
|
|
|
<script type="text/javascript">
|
2024-01-10 21:59:40 +00:00
|
|
|
function download(filename,text) {
|
|
|
|
var element = document.createElement('a');
|
|
|
|
|
|
|
|
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
|
|
|
|
element.setAttribute('download', filename);
|
|
|
|
element.style.display = 'none';
|
|
|
|
document.body.appendChild(element);
|
|
|
|
|
|
|
|
element.click();
|
|
|
|
document.body.removeChild(element);
|
|
|
|
}
|
|
|
|
|
2023-04-11 22:17:57 +00:00
|
|
|
function editmode() {
|
|
|
|
$('button[id=entry-edit]').addClass('active').removeClass('btn-outline-dark').addClass('btn-outline-light');
|
|
|
|
|
|
|
|
// Find all input items and turn off readonly
|
|
|
|
$('input.form-control').each(function() {
|
|
|
|
$(this).attr('readonly',false);
|
|
|
|
});
|
|
|
|
|
|
|
|
$('.row.d-none').removeClass('d-none');
|
|
|
|
$('.addable.d-none').removeClass('d-none');
|
|
|
|
$('.deletable.d-none').removeClass('d-none');
|
2023-09-02 10:50:54 +00:00
|
|
|
|
|
|
|
@if($o->getMissingAttributes()->count())
|
|
|
|
$('#newattr-select.d-none').removeClass('d-none');
|
|
|
|
@endif
|
2023-04-11 22:17:57 +00:00
|
|
|
}
|
|
|
|
|
2023-03-31 04:55:08 +00:00
|
|
|
$(document).ready(function() {
|
2023-09-02 10:50:54 +00:00
|
|
|
$('#form-reset').click(function() {
|
|
|
|
$('#dn-edit')[0].reset();
|
2024-01-10 21:59:40 +00:00
|
|
|
});
|
2023-03-31 04:55:08 +00:00
|
|
|
|
|
|
|
$('#form-submit').click(function() {
|
2023-09-02 10:50:54 +00:00
|
|
|
$('#dn-edit')[0].submit();
|
2024-01-10 21:59:40 +00:00
|
|
|
});
|
2023-03-31 04:55:08 +00:00
|
|
|
|
2023-09-02 10:50:54 +00:00
|
|
|
$('#newattr').on('change',function(item) {
|
|
|
|
$.ajax({
|
|
|
|
type: 'GET',
|
2024-01-10 21:59:40 +00:00
|
|
|
beforeSend: function() {},
|
2023-09-02 10:50:54 +00:00
|
|
|
success: function(data) {
|
|
|
|
$('#newattrs').append(data);
|
|
|
|
},
|
|
|
|
error: function(e) {
|
|
|
|
if (e.status != 412)
|
|
|
|
alert('That didnt work? Please try again....');
|
|
|
|
},
|
|
|
|
url: '{{ url('entry/newattr') }}/'+item.target.value,
|
|
|
|
cache: false
|
2024-01-10 21:59:40 +00:00
|
|
|
});
|
2023-09-02 10:50:54 +00:00
|
|
|
|
|
|
|
// Remove the option from the list
|
|
|
|
$(this).find('[value="'+item.target.value+'"]').remove()
|
|
|
|
|
|
|
|
// If there are no more options
|
|
|
|
if ($(this).find("option").length === 1)
|
|
|
|
$('#newattr-select').remove();
|
2023-04-11 22:17:57 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
$('button[id=entry-edit]').on('click',function(item) {
|
|
|
|
item.preventDefault();
|
|
|
|
|
|
|
|
if ($(this).hasClass('active'))
|
|
|
|
return;
|
|
|
|
|
|
|
|
editmode();
|
|
|
|
});
|
|
|
|
|
2024-01-10 21:59:40 +00:00
|
|
|
$('#entry-export-download').on('click',function(item) {
|
|
|
|
item.preventDefault();
|
|
|
|
|
|
|
|
let ldif = $('#entry-export').find('pre:first'); // update this selector in your local version
|
|
|
|
download('ldap-export.ldif',ldif.html());
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#entry-export-modal').on('shown.bs.modal', function () {
|
|
|
|
$.ajax({
|
|
|
|
type: 'GET',
|
|
|
|
beforeSend: function() {},
|
|
|
|
success: function(data) {
|
|
|
|
$('#entry-export').empty().append(data);
|
|
|
|
},
|
|
|
|
error: function(e) {
|
|
|
|
if (e.status != 412)
|
|
|
|
alert('That didnt work? Please try again....');
|
|
|
|
},
|
|
|
|
url: '{{ url('entry/export',$o->getDNSecure()) }}/',
|
|
|
|
cache: false
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2023-04-11 22:17:57 +00:00
|
|
|
@if(old())
|
|
|
|
editmode();
|
|
|
|
@endif
|
2023-03-31 04:55:08 +00:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
@append
|