added link to go down DN level

This commit is contained in:
Roland Gruber 2018-10-14 09:16:55 +02:00
parent f0cbe217eb
commit 5f62f9aed3
2 changed files with 11 additions and 7 deletions

View File

@ -1044,13 +1044,15 @@ window.lam.html.showDnSelection = function(fieldId, title, okText, cancelText, t
.done(function(jsonData) { .done(function(jsonData) {
jQuery('#dlg_' + fieldId).html(jsonData.dialogData); jQuery('#dlg_' + fieldId).html(jsonData.dialogData);
var buttonList = {}; var buttonList = {};
buttonList[cancelText] = function() { jQuery(this).dialog("close"); }; buttonList[cancelText] = function() { jQuery(this).dialog("destroy"); };
jQuery('#dlg_' + fieldId).dialog({ jQuery('#dlg_' + fieldId).dialog({
modal: true, modal: true,
title: title, title: title,
dialogClass: 'defaultBackground', dialogClass: 'defaultBackground',
buttons: buttonList, buttons: buttonList,
width: 'auto' width: 'auto',
maxHeight: 600,
position: {my: 'center', at: 'center', of: window}
}); });
}); });
}; };
@ -1066,7 +1068,7 @@ window.lam.html.selectDn = function(el, fieldId) {
var field = jQuery('#' + fieldId); var field = jQuery('#' + fieldId);
var dn = jQuery(el).parents('.row').data('dn'); var dn = jQuery(el).parents('.row').data('dn');
field.val(dn); field.val(dn);
jQuery('#dlg_' + fieldId).dialog("close"); jQuery('#dlg_' + fieldId).dialog("destroy");
return false; return false;
} }

View File

@ -221,6 +221,9 @@ class Ajax {
private function buildDnSelectionHtml($dnList, $currentDn) { private function buildDnSelectionHtml($dnList, $currentDn) {
$fieldId = trim($_POST['fieldId']); $fieldId = trim($_POST['fieldId']);
$mainRow = new htmlResponsiveRow(); $mainRow = new htmlResponsiveRow();
$onclickUp = 'window.lam.html.updateDnSelection(this, \''
. htmlspecialchars($fieldId) . '\', \'' . getSecurityTokenName() . '\', \''
. getSecurityTokenValue() . '\')';
if (!empty($currentDn)) { if (!empty($currentDn)) {
$row = new htmlResponsiveRow(); $row = new htmlResponsiveRow();
$row->addDataAttribute('dn', $currentDn); $row->addDataAttribute('dn', $currentDn);
@ -236,9 +239,6 @@ class Ajax {
$row->add($button, 12, 3); $row->add($button, 12, 3);
$mainRow->add($row, 12); $mainRow->add($row, 12);
// back up // back up
$onclickUp = 'window.lam.html.updateDnSelection(this, \''
. htmlspecialchars($fieldId) . '\', \'' . getSecurityTokenName() . '\', \''
. getSecurityTokenValue() . '\')';
$row = new htmlResponsiveRow(); $row = new htmlResponsiveRow();
$row->addDataAttribute('dn', extractDNSuffix($currentDn)); $row->addDataAttribute('dn', extractDNSuffix($currentDn));
$text = new htmlLink('..', '#'); $text = new htmlLink('..', '#');
@ -257,7 +257,9 @@ class Ajax {
foreach ($dnList as $dn) { foreach ($dnList as $dn) {
$row = new htmlResponsiveRow(); $row = new htmlResponsiveRow();
$row->addDataAttribute('dn', $dn); $row->addDataAttribute('dn', $dn);
$row->add(new htmlOutputText($dn), 12, 9); $link = new htmlLink($dn, '#');
$link->setOnClick($onclickUp);
$row->add($link, 12, 9);
$row->setCSSClasses(array('text-right')); $row->setCSSClasses(array('text-right'));
$buttonId = base64_encode($dn); $buttonId = base64_encode($dn);
$buttonId = str_replace('=', '', $buttonId); $buttonId = str_replace('=', '', $buttonId);