Clear some javascript @todos: fancytree options, optionclass processing
All checks were successful
Create Docker Image / Test Application (x86_64) (push) Successful in 3m27s
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 1m25s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 4m35s
Create Docker Image / Final Docker Image Manifest (push) Successful in 9s
All checks were successful
Create Docker Image / Test Application (x86_64) (push) Successful in 3m27s
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 1m25s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 4m35s
Create Docker Image / Final Docker Image Manifest (push) Successful in 9s
This commit is contained in:
parent
dc623b18ae
commit
c588e13bd8
@ -241,6 +241,7 @@ class Attribute implements \Countable, \ArrayAccess, \Iterator
|
|||||||
// @todo
|
// @todo
|
||||||
|
|
||||||
// objectClasses requiring this attribute
|
// objectClasses requiring this attribute
|
||||||
|
// @todo limit this to this DNs objectclasses
|
||||||
// eg: $result->put('required','Required by objectClasses: a,b');
|
// eg: $result->put('required','Required by objectClasses: a,b');
|
||||||
if ($this->required_by->count())
|
if ($this->required_by->count())
|
||||||
$result->put(__('required'),sprintf('%s: %s',__('Required Attribute by ObjectClass(es)'),$this->required_by->join(',')));
|
$result->put(__('required'),sprintf('%s: %s',__('Required Attribute by ObjectClass(es)'),$this->required_by->join(',')));
|
||||||
|
@ -96,7 +96,7 @@ class HomeController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function entry_attr_add(Request $request,string $id): string
|
public function entry_attr_add(Request $request,string $id): string
|
||||||
{
|
{
|
||||||
$xx = new \stdClass();
|
$xx = new \stdClass;
|
||||||
$xx->index = 0;
|
$xx->index = 0;
|
||||||
|
|
||||||
$x = $request->noheader
|
$x = $request->noheader
|
||||||
|
6
public/css/fixes.css
vendored
6
public/css/fixes.css
vendored
@ -69,10 +69,6 @@ table.dataTable thead .sorting {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/** Fancy Tree Fixes **/
|
/** Fancy Tree Fixes **/
|
||||||
/*
|
|
||||||
@todo The unopened lazy branches off the tree are off by 5px. see *-cdl. below
|
|
||||||
@todo The last node is missing some dots, connecting to the previous node
|
|
||||||
*/
|
|
||||||
/* So our tree can be longer than the frame */
|
/* So our tree can be longer than the frame */
|
||||||
.scrollbar-sidebar {
|
.scrollbar-sidebar {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
@ -117,7 +113,7 @@ ul.fancytree-container ul {
|
|||||||
}
|
}
|
||||||
.fancytree-node.fancytree-exp-n span.fancytree-expander,
|
.fancytree-node.fancytree-exp-n span.fancytree-expander,
|
||||||
.fancytree-node.fancytree-exp-n span.fancytree-expander:hover { /* node */
|
.fancytree-node.fancytree-exp-n span.fancytree-expander:hover { /* node */
|
||||||
margin-top: 4px;
|
margin-top: 3px;
|
||||||
background-position: 0 -63px;
|
background-position: 0 -63px;
|
||||||
}
|
}
|
||||||
.fancytree-node.fancytree-exp-nl span.fancytree-expander { /* node last */
|
.fancytree-node.fancytree-exp-nl span.fancytree-expander { /* node last */
|
||||||
|
12
public/js/custom.js
vendored
12
public/js/custom.js
vendored
@ -64,18 +64,14 @@ $(document).ready(function() {
|
|||||||
// and pass the tree options as an argument to the fancytree() function:
|
// and pass the tree options as an argument to the fancytree() function:
|
||||||
$('#tree').fancytree({
|
$('#tree').fancytree({
|
||||||
clickFolderMode: 3,
|
clickFolderMode: 3,
|
||||||
extensions: ['glyph','persist'],
|
extensions: ['persist'],
|
||||||
autoCollapse: true, // Automatically collapse all siblings, when a node is expanded.
|
autoCollapse: true, // Automatically collapse all siblings, when a node is expanded.
|
||||||
autoScroll: true, // Automatically scroll nodes into visible area.
|
autoScroll: true, // Automatically scroll nodes into visible area.
|
||||||
focusOnSelect: true, // Set focus when node is checked by a mouse click
|
focusOnSelect: true, // Set focus when node is checked by a mouse click
|
||||||
glyph: {
|
|
||||||
preset: 'bootstrap3', // @todo look at changing this to awesome5
|
|
||||||
map: {}
|
|
||||||
},
|
|
||||||
persist: {
|
persist: {
|
||||||
// Available options with their default:
|
// Available options with their default:
|
||||||
cookieDelimiter: '~', // character used to join key strings
|
cookieDelimiter: '~', // character used to join key strings
|
||||||
cookiePrefix: undefined, // 'fancytree-<treeId>-' by default
|
cookiePrefix: 'pla-<treeId>-', // 'fancytree-<treeId>-' by default
|
||||||
cookie: { // settings passed to jquery.cookie plugin
|
cookie: { // settings passed to jquery.cookie plugin
|
||||||
raw: false,
|
raw: false,
|
||||||
expires: '',
|
expires: '',
|
||||||
@ -85,14 +81,14 @@ $(document).ready(function() {
|
|||||||
},
|
},
|
||||||
expandLazy: true, // true: recursively expand and load lazy nodes
|
expandLazy: true, // true: recursively expand and load lazy nodes
|
||||||
expandOpts: undefined, // optional `opts` argument passed to setExpanded()
|
expandOpts: undefined, // optional `opts` argument passed to setExpanded()
|
||||||
|
fireActivate: false, //
|
||||||
overrideSource: true, // true: cookie takes precedence over `source` data attributes.
|
overrideSource: true, // true: cookie takes precedence over `source` data attributes.
|
||||||
store: 'auto', // 'cookie': use cookie, 'local': use localStore, 'session': use sessionStore
|
store: 'auto', // 'cookie': use cookie, 'local': use localStore, 'session': use sessionStore
|
||||||
types: 'active expanded focus selected' // which status types to store
|
types: 'active expanded focus selected' // which status types to store
|
||||||
},
|
},
|
||||||
click: function(event,data) {
|
click: function(event,data) {
|
||||||
if (data.targetType == 'title') {
|
if (data.targetType === 'title')
|
||||||
getNode(data.node.data.item);
|
getNode(data.node.data.item);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
source: sources,
|
source: sources,
|
||||||
lazyLoad: function(event,data) {
|
lazyLoad: function(event,data) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<!-- $o=Attribute::class -->
|
<!-- $o=Attribute::class -->
|
||||||
<x-attribute.layout :edit="$edit" :new="$new" :o="$o">
|
<x-attribute.layout :edit="$edit" :new="$new" :o="$o">
|
||||||
@foreach (old($o->name_lc,$o->values) as $value)
|
@foreach(old($o->name_lc,$o->values) as $value)
|
||||||
@if ($edit)
|
@if ($edit)
|
||||||
<x-attribute.widget.objectclass :o="$o" :edit="$edit" :new="$new" :loop="$loop" :value="$value"/>
|
<x-attribute.widget.objectclass :o="$o" :edit="$edit" :new="$new" :loop="$loop" :value="$value"/>
|
||||||
@else
|
@else
|
||||||
|
@ -27,9 +27,6 @@
|
|||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-sm btn-primary" data-bs-dismiss="modal">Next</button>
|
<button type="button" class="btn btn-sm btn-primary" data-bs-dismiss="modal">Next</button>
|
||||||
{{--
|
|
||||||
<button type="button" class="btn btn-sm btn-primary" data-bs-dismiss="modal"><i class="fas fa-fw fa-spinner fa-spin d-none"></i> Next</button>
|
|
||||||
--}}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -45,12 +42,12 @@
|
|||||||
$('#new_objectclass-modal').on('shown.bs.modal',function() {
|
$('#new_objectclass-modal').on('shown.bs.modal',function() {
|
||||||
if (! rendered)
|
if (! rendered)
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
method: 'POST',
|
||||||
cache: false,
|
|
||||||
url: '{{ url('entry/objectclass/add') }}',
|
url: '{{ url('entry/objectclass/add') }}',
|
||||||
data: {
|
data: {
|
||||||
oc: oc,
|
oc: oc,
|
||||||
},
|
},
|
||||||
|
cache: false,
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$('select#newoc').select2({
|
$('select#newoc').select2({
|
||||||
dropdownParent: $('#new_objectclass-modal'),
|
dropdownParent: $('#new_objectclass-modal'),
|
||||||
@ -60,7 +57,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
error: function(e) {
|
error: function(e) {
|
||||||
if (e.status != 412)
|
if (e.status !== 412)
|
||||||
alert('That didnt work? Please try again....');
|
alert('That didnt work? Please try again....');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -70,11 +67,10 @@
|
|||||||
|
|
||||||
// When the ObjectClass modal is closed, process what was selected
|
// When the ObjectClass modal is closed, process what was selected
|
||||||
$('#new_objectclass-modal').on('hide.bs.modal',function() {
|
$('#new_objectclass-modal').on('hide.bs.modal',function() {
|
||||||
var c = {{ $o->values->count() }}; // @todo do we need this?
|
|
||||||
var newadded = $('select#newoc').val();
|
var newadded = $('select#newoc').val();
|
||||||
|
|
||||||
// If nothing selected, we dont have anything to do
|
// If nothing selected, we dont have anything to do
|
||||||
if (added_oc.sort().join('|') == newadded.sort().join('|'))
|
if (added_oc.sort().join('|') === newadded.sort().join('|'))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Find out what was selected, and add them
|
// Find out what was selected, and add them
|
||||||
@ -84,50 +80,47 @@
|
|||||||
|
|
||||||
// Add attribute to the page
|
// Add attribute to the page
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
method: 'POST',
|
||||||
beforeSend: function() {},
|
|
||||||
success: function(data) {
|
|
||||||
$('#{{ $o->name }}').append(data);
|
|
||||||
},
|
|
||||||
error: function(e) {
|
|
||||||
if (e.status != 412)
|
|
||||||
alert('That didnt work? Please try again....');
|
|
||||||
},
|
|
||||||
url: '{{ url('entry/attr/add',[$o->name_lc]) }}',
|
url: '{{ url('entry/attr/add',[$o->name_lc]) }}',
|
||||||
data: {
|
data: {
|
||||||
noheader: true,
|
noheader: true,
|
||||||
value: item,
|
value: item,
|
||||||
objectclasses: oc,
|
objectclasses: oc,
|
||||||
loop: c++, // @todo can we omit loop and c
|
|
||||||
},
|
},
|
||||||
cache: false
|
cache: false,
|
||||||
|
success: function(data) {
|
||||||
|
$('#{{ $o->name }}').append(data);
|
||||||
|
},
|
||||||
|
error: function(e) {
|
||||||
|
if (e.status !== 412)
|
||||||
|
alert('That didnt work? Please try again....');
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
method: 'POST',
|
||||||
beforeSend: function() {},
|
url: '{{ url('api/schema/objectclass/attrs') }}/'+item,
|
||||||
|
cache: false,
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
// Render any must attributes
|
// Render any must attributes
|
||||||
if (data.must.length) {
|
if (data.must.length) {
|
||||||
data.must.forEach(function(item) {
|
data.must.forEach(function(item) {
|
||||||
// Add attribute to the page
|
// Add attribute to the page
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
method: 'POST',
|
||||||
beforeSend: function() {},
|
|
||||||
success: function(data) {
|
|
||||||
$('#newattrs').append(data);
|
|
||||||
},
|
|
||||||
error: function(e) {
|
|
||||||
if (e.status != 412)
|
|
||||||
alert('That didnt work? Please try again....');
|
|
||||||
},
|
|
||||||
url: '{{ url('entry/attr/add') }}/'+item,
|
url: '{{ url('entry/attr/add') }}/'+item,
|
||||||
data: {
|
data: {
|
||||||
value: item,
|
value: item,
|
||||||
objectclasses: oc,
|
objectclasses: oc,
|
||||||
loop: c++, // @todo can we omit loop and c
|
|
||||||
},
|
},
|
||||||
cache: false
|
cache: false,
|
||||||
|
success: function(data) {
|
||||||
|
$('#newattrs').append(data);
|
||||||
|
},
|
||||||
|
error: function(e) {
|
||||||
|
if (e.status !== 412)
|
||||||
|
alert('That didnt work? Please try again....');
|
||||||
|
},
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -135,19 +128,29 @@
|
|||||||
// Add attributes to "Add new Attribute" that are now available
|
// Add attributes to "Add new Attribute" that are now available
|
||||||
if (data.may.length) {
|
if (data.may.length) {
|
||||||
var newattr = $('select#newattr');
|
var newattr = $('select#newattr');
|
||||||
|
var oldoptions = $('select#newattr option').map((i,o)=>o.value).get();
|
||||||
|
|
||||||
// @todo It might be nice to re-sort these options
|
|
||||||
data.may.forEach(function(item) {
|
data.may.forEach(function(item) {
|
||||||
newattr.append(new Option(item,item,false,false));
|
if (! oldoptions.includes(item))
|
||||||
|
newattr.append(new Option(item,item,false,false));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Sort the attributes
|
||||||
|
newattr
|
||||||
|
.append($('select#newattr option')
|
||||||
|
.remove()
|
||||||
|
.sort(function (a,b) {
|
||||||
|
let at = $(a).text(),
|
||||||
|
bt = $(b).text();
|
||||||
|
return (at > bt) ? 1 : ((at < bt) ? -1 : 0);
|
||||||
|
}))
|
||||||
|
.val('');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(e) {
|
error: function(e) {
|
||||||
if (e.status != 412)
|
if (e.status !== 412)
|
||||||
alert('That didnt work? Please try again....');
|
alert('That didnt work? Please try again....');
|
||||||
},
|
},
|
||||||
url: '{{ url('api/schema/objectclass/attrs') }}/'+item,
|
|
||||||
cache: false
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -156,10 +159,10 @@
|
|||||||
if (newadded.indexOf(item) === -1) {
|
if (newadded.indexOf(item) === -1) {
|
||||||
$('span#objectclass_'+item).empty();
|
$('span#objectclass_'+item).empty();
|
||||||
|
|
||||||
// @todo Remove attributes from "Add new Attribute" that are no longer available
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
method: 'POST',
|
||||||
beforeSend: function() {},
|
url: '{{ url('api/schema/objectclass/attrs') }}/'+item,
|
||||||
|
cache: false,
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
var attrs = [];
|
var attrs = [];
|
||||||
|
|
||||||
@ -183,17 +186,11 @@
|
|||||||
|
|
||||||
x.css('background-color','#f0c0c0').attr('readonly',true).attr('placeholder',x.val()).val('');
|
x.css('background-color','#f0c0c0').attr('readonly',true).attr('placeholder',x.val()).val('');
|
||||||
});
|
});
|
||||||
|
|
||||||
// remove the Add Values box
|
|
||||||
// Remove any keyed in values
|
|
||||||
// @todo remove any required attributes that are no longer defined as a result of removing this OC
|
|
||||||
},
|
},
|
||||||
error: function(e) {
|
error: function(e) {
|
||||||
if (e.status != 412)
|
if (e.status !== 412)
|
||||||
alert('That didnt work? Please try again....');
|
alert('That didnt work? Please try again....');
|
||||||
},
|
},
|
||||||
url: '{{ url('api/schema/objectclass/attrs') }}/'+item,
|
|
||||||
cache: false
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user