Make the ajax calls POST methods, and make the 'Create Entry' in the tree configurable so calls to children() can just return child entries
This commit is contained in:
parent
883ac5d90f
commit
339ba7258a
@ -38,7 +38,7 @@ class AjaxController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function children(Request $request): Collection
|
public function children(Request $request): Collection
|
||||||
{
|
{
|
||||||
$dn = Crypt::decryptString($request->query('_key'));
|
$dn = Crypt::decryptString($request->post('_key'));
|
||||||
|
|
||||||
// Sometimes our key has a command, so we'll ignore it
|
// Sometimes our key has a command, so we'll ignore it
|
||||||
if (str_starts_with($dn,'*') && ($x=strpos($dn,'|')))
|
if (str_starts_with($dn,'*') && ($x=strpos($dn,'|')))
|
||||||
@ -57,13 +57,18 @@ class AjaxController extends Controller
|
|||||||
'tooltip'=>$item->getDn(),
|
'tooltip'=>$item->getDn(),
|
||||||
])
|
])
|
||||||
->prepend(
|
->prepend(
|
||||||
[
|
$request->create
|
||||||
'title'=>sprintf('[%s]',__('Create Entry')),
|
? [
|
||||||
'item'=>Crypt::encryptString(sprintf('*%s|%s','create',$dn)),
|
'title'=>sprintf('[%s]',__('Create Entry')),
|
||||||
'lazy'=>FALSE,
|
'item'=>Crypt::encryptString(sprintf('*%s|%s','create',$dn)),
|
||||||
'icon'=>'fas fa-fw fa-square-plus text-warning',
|
'lazy'=>FALSE,
|
||||||
'tooltip'=>__('Create new LDAP item here'),
|
'icon'=>'fas fa-fw fa-square-plus text-warning',
|
||||||
]);
|
'tooltip'=>__('Create new LDAP item here'),
|
||||||
|
]
|
||||||
|
: []
|
||||||
|
)
|
||||||
|
->filter()
|
||||||
|
->values();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function schema_view(Request $request)
|
public function schema_view(Request $request)
|
||||||
|
5
public/js/custom.js
vendored
5
public/js/custom.js
vendored
@ -59,7 +59,7 @@ $(document).ready(function() {
|
|||||||
if (typeof basedn !== 'undefined') {
|
if (typeof basedn !== 'undefined') {
|
||||||
sources = basedn;
|
sources = basedn;
|
||||||
} else {
|
} else {
|
||||||
sources = { url: '/ajax/bases' };
|
sources = { method: 'POST', url: '/ajax/bases' };
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attach the fancytree widget to an existing <div id="tree"> element
|
// Attach the fancytree widget to an existing <div id="tree"> element
|
||||||
@ -95,8 +95,9 @@ $(document).ready(function() {
|
|||||||
source: sources,
|
source: sources,
|
||||||
lazyLoad: function(event,data) {
|
lazyLoad: function(event,data) {
|
||||||
data.result = {
|
data.result = {
|
||||||
|
method: 'POST',
|
||||||
url: '/ajax/children',
|
url: '/ajax/children',
|
||||||
data: {_key: data.node.data.item,depth: 1}
|
data: {_key: data.node.data.item,create: true}
|
||||||
};
|
};
|
||||||
|
|
||||||
expandChildren(data.tree.rootNode);
|
expandChildren(data.tree.rootNode);
|
||||||
|
@ -63,8 +63,8 @@ Route::controller(HomeController::class)->group(function() {
|
|||||||
Route::controller(AjaxController::class)
|
Route::controller(AjaxController::class)
|
||||||
->prefix('ajax')
|
->prefix('ajax')
|
||||||
->group(function() {
|
->group(function() {
|
||||||
Route::get('bases','bases');
|
Route::post('bases','bases');
|
||||||
Route::get('children','children');
|
Route::post('children','children');
|
||||||
Route::post('schema/view','schema_view');
|
Route::post('schema/view','schema_view');
|
||||||
Route::post('schema/objectclass/attrs/{id}','schema_objectclass_attrs');
|
Route::post('schema/objectclass/attrs/{id}','schema_objectclass_attrs');
|
||||||
});
|
});
|
Loading…
x
Reference in New Issue
Block a user