DN chooser

This commit is contained in:
Roland Gruber 2018-10-06 19:47:33 +02:00
parent a202ed8824
commit 89df814e77
4 changed files with 73 additions and 1 deletions

View File

@ -1,3 +1,7 @@
December 2018 6.6
- New import/export in tools menu
25.09.2018 6.5
- Password change possible via LDAP EXOP operation (set LDAP_EXOP as password hash, requires PHP 7.2)
- Support Imagick and GD
@ -25,6 +29,7 @@
- Fixed bugs:
-> Error on password reset page when custom fields is used (194)
19.03.2018 6.3
- Server profile: added option if referential integrity overlay is active to skip cleanup actions
- Unix: several options are now specific to subaccount types (reconfiguration required!)

View File

@ -472,6 +472,8 @@ class htmlInputField extends htmlElement {
protected $autocompleteMinLength = 1;
/** show calendar */
protected $showCalendar = false;
/** show DN selection */
protected $showDnSelection = false;
/** calendar format */
protected $calendarFormat = '';
/** title attribute */
@ -589,8 +591,19 @@ class htmlInputField extends htmlElement {
if (!empty($this->title)) {
$title = ' title="' . $this->title . '"';
}
if ($this->showDnSelection) {
echo '<span class="nowrap">';
}
echo '<input type="' . $inputType . '"' . $class . $name . $id . $value . $maxLength
. $min . $max . $size . $fieldTabIndex . $onKeyPress . $onKeyUp . $title . $disabled . '>';
if ($this->showDnSelection) {
echo '<img class="align-middle" src="../../graphics/view.png"
width="16" height="16" title="' . _('Choose entry') . '"
onclick="window.lam.html.showDnSelection(\'' . $this->fieldName . '\', \'' . _('Choose entry') . '\'
, \'' . _('Ok') . '\', \'' . _('Cancel') . '\', \'' . getSecurityTokenName() . '\'
, \'' . getSecurityTokenValue() . '\');">';
echo '</span>';
}
// autocompletion
if ($this->autocomplete) {
echo "<script type=\"text/javascript\">\n";
@ -805,6 +818,13 @@ class htmlInputField extends htmlElement {
$this->calendarFormat = $format;
}
/**
* Shows a DN selection next to input field.
*/
public function showDnSelection() {
$this->showDnSelection = true;
}
/**
* Sets the title for the input field.
*

View File

@ -1011,6 +1011,51 @@ window.lam.importexport.startExport = function(tokenName, tokenValue) {
});
};
window.lam.html = window.lam.html || {};
/**
* Shows a DN selection for the given input field.
*
* @param fieldId id of input field
* @param title title of dialog
* @param okText ok button text
* @param cancelText cancel button text
* @param tokenName CSRF token name
* @param tokenValue CSRF token value
*/
window.lam.html.showDnSelection = function(fieldId, title, okText, cancelText, tokenName, tokenValue) {
var field = jQuery('#' + fieldId);
var fieldDiv = jQuery('#dlg_' + fieldId);
if (!fieldDiv.length > 0) {
jQuery('body').append(jQuery('<div class="hidden" id="dlg_' + fieldId + '"></div>'));
}
var dnValue = field.val();
var data = {
jsonInput: ''
};
data[tokenName] = tokenValue;
data['dn'] = dnValue;
jQuery.ajax({
url: '../misc/ajax.php?function=dnselection',
method: 'POST',
data: data
})
.done(function(jsonData){
})
.fail(function() {
});
var buttonList = {};
buttonList[okText] = function() { alert('OK'); };
buttonList[cancelText] = function() { jQuery(this).dialog("close"); };
jQuery('#dlg_' + fieldId).dialog({
modal: true,
title: title,
dialogClass: 'defaultBackground',
buttons: buttonList,
width: 'auto'
});
};
jQuery(document).ready(function() {
window.lam.gui.equalHeight();
window.lam.form.autoTrim();

View File

@ -262,7 +262,9 @@ function printExportTabContent(&$tabindex) {
$container = new htmlResponsiveRow();
$container->add(new htmlTitle(_("Export")), 12);
$container->add(new htmlResponsiveInputField(_('Base DN'), 'baseDn', getDefaultBaseDn(), '751', true), 12);
$baseDnField = new htmlResponsiveInputField(_('Base DN'), 'baseDn', getDefaultBaseDn(), '751', true);
$baseDnField->showDnSelection();
$container->add($baseDnField, 12);
$searchScopes = array(
_('Base (base dn only)') => 'base',