responsive
This commit is contained in:
parent
e3793cd78f
commit
d328f19f0a
|
@ -17,11 +17,14 @@ use \htmlDiv;
|
||||||
use \htmlJavaScript;
|
use \htmlJavaScript;
|
||||||
use \htmlLink;
|
use \htmlLink;
|
||||||
use \htmlInputTextarea;
|
use \htmlInputTextarea;
|
||||||
|
use \htmlResponsiveRow;
|
||||||
|
use \htmlResponsiveSelect;
|
||||||
|
use \htmlResponsiveInputField;
|
||||||
|
use \htmlResponsiveTable;
|
||||||
/*
|
/*
|
||||||
$Id$
|
|
||||||
|
|
||||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||||
Copyright (C) 2013 - 2017 Roland Gruber
|
Copyright (C) 2013 - 2018 Roland Gruber
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -92,18 +95,16 @@ else {
|
||||||
*/
|
*/
|
||||||
function displayStartPage() {
|
function displayStartPage() {
|
||||||
// display main page
|
// display main page
|
||||||
include 'main_header.php';
|
include '../lib/adminHeader.inc';
|
||||||
echo '<div class="user-bright smallPaddingContent">';
|
echo '<div class="user-bright smallPaddingContent">';
|
||||||
echo "<form action=\"multiEdit.php\" method=\"post\">\n";
|
echo "<form action=\"multiEdit.php\" method=\"post\">\n";
|
||||||
$errors = array();
|
$errors = array();
|
||||||
$tabindex = 1;
|
$tabindex = 1;
|
||||||
$container = new htmlTable();
|
$container = new htmlResponsiveRow();
|
||||||
$container->addElement(new htmlTitle(_("Multi edit")), true);
|
$container->add(new htmlTitle(_("Multi edit")), 12);
|
||||||
// LDAP suffix
|
// LDAP suffix
|
||||||
$showRules = array('-' => array('otherSuffix'));
|
$showRules = array('-' => array('otherSuffix'));
|
||||||
$hideRules = array();
|
$hideRules = array();
|
||||||
$container->addElement(new htmlOutputText(_('LDAP suffix')));
|
|
||||||
$suffixGroup = new htmlTable();
|
|
||||||
$typeManager = new \LAM\TYPES\TypeManager();
|
$typeManager = new \LAM\TYPES\TypeManager();
|
||||||
$types = $typeManager->getConfiguredTypes();
|
$types = $typeManager->getConfiguredTypes();
|
||||||
$suffixes = array();
|
$suffixes = array();
|
||||||
|
@ -125,27 +126,23 @@ function displayStartPage() {
|
||||||
$suffixes[_('Other')] = '-';
|
$suffixes[_('Other')] = '-';
|
||||||
$suffixValues = array_values($suffixes);
|
$suffixValues = array_values($suffixes);
|
||||||
$valSuffix = empty($_POST['suffix']) ? $suffixValues[0] : $_POST['suffix'];
|
$valSuffix = empty($_POST['suffix']) ? $suffixValues[0] : $_POST['suffix'];
|
||||||
$suffixSelect = new htmlSelect('suffix', $suffixes, array($valSuffix));
|
$suffixSelect = new htmlResponsiveSelect('suffix', $suffixes, array($valSuffix), _('LDAP suffix'), '700');
|
||||||
$suffixSelect->setHasDescriptiveElements(true);
|
$suffixSelect->setHasDescriptiveElements(true);
|
||||||
$suffixSelect->setSortElements(false);
|
$suffixSelect->setSortElements(false);
|
||||||
$suffixSelect->setTableRowsToShow($showRules);
|
$suffixSelect->setTableRowsToShow($showRules);
|
||||||
$suffixSelect->setTableRowsToHide($hideRules);
|
$suffixSelect->setTableRowsToHide($hideRules);
|
||||||
$suffixGroup->addElement($suffixSelect);
|
$container->add($suffixSelect, 12);
|
||||||
$otherSuffixTable = new htmlTable();
|
|
||||||
$valOtherSuffix = empty($_POST['otherSuffix']) ? '' : $_POST['otherSuffix'];
|
$valOtherSuffix = empty($_POST['otherSuffix']) ? '' : $_POST['otherSuffix'];
|
||||||
$otherSuffixTable->addElement(new htmlInputField('otherSuffix'));
|
$container->add(new htmlResponsiveInputField(_('Other'), 'otherSuffix', $valOtherSuffix), 12);
|
||||||
$suffixGroup->addElement($otherSuffixTable);
|
|
||||||
$container->addElement($suffixGroup);
|
|
||||||
$container->addElement(new htmlHelpLink('700'), true);
|
|
||||||
// LDAP filter
|
// LDAP filter
|
||||||
$valFilter = empty($_POST['filter']) ? '(objectClass=inetOrgPerson)' : $_POST['filter'];
|
$valFilter = empty($_POST['filter']) ? '(objectClass=inetOrgPerson)' : $_POST['filter'];
|
||||||
$container->addElement(new htmlTableExtendedInputField(_('LDAP filter'), 'filter', $valFilter, '701'), true);
|
$container->add(new htmlResponsiveInputField(_('LDAP filter'), 'filter', $valFilter, '701'), 12);
|
||||||
// operation fields
|
// operation fields
|
||||||
$container->addElement(new htmlSubTitle(_('Operations')), true);
|
$operationsTitle = new htmlSubTitle(_('Operations'));
|
||||||
$container->addElement(new htmlOutputText(_('Type')));
|
$operationsTitle->setHelpId('702');
|
||||||
$container->addElement(new htmlOutputText(_('Attribute name')));
|
$container->add($operationsTitle, 12);
|
||||||
$container->addElement(new htmlOutputText(_('Value')));
|
$operationsTitles = array(_('Type'), _('Attribute name'), _('Value'));
|
||||||
$container->addElement(new htmlHelpLink('702'), true);
|
$data = array();
|
||||||
$opCount = empty($_POST['opcount']) ? '3' : $_POST['opcount'];
|
$opCount = empty($_POST['opcount']) ? '3' : $_POST['opcount'];
|
||||||
if (isset($_POST['addFields'])) {
|
if (isset($_POST['addFields'])) {
|
||||||
$opCount += 3;
|
$opCount += 3;
|
||||||
|
@ -156,12 +153,12 @@ function displayStartPage() {
|
||||||
$selOp = empty($_POST['op_' . $i]) ? ADD : $_POST['op_' . $i];
|
$selOp = empty($_POST['op_' . $i]) ? ADD : $_POST['op_' . $i];
|
||||||
$opSelect = new htmlSelect('op_' . $i, $operations, array($selOp));
|
$opSelect = new htmlSelect('op_' . $i, $operations, array($selOp));
|
||||||
$opSelect->setHasDescriptiveElements(true);
|
$opSelect->setHasDescriptiveElements(true);
|
||||||
$container->addElement($opSelect);
|
$data[$i][] = $opSelect;
|
||||||
// attribute name
|
// attribute name
|
||||||
$attrVal = empty($_POST['attr_' . $i]) ? '' : $_POST['attr_' . $i];
|
$attrVal = empty($_POST['attr_' . $i]) ? '' : $_POST['attr_' . $i];
|
||||||
$container->addElement(new htmlInputField('attr_' . $i, $attrVal));
|
$data[$i][] = new htmlInputField('attr_' . $i, $attrVal);
|
||||||
$valVal = empty($_POST['val_' . $i]) ? '' : $_POST['val_' . $i];
|
$valVal = empty($_POST['val_' . $i]) ? '' : $_POST['val_' . $i];
|
||||||
$container->addElement(new htmlInputField('val_' . $i, $valVal), true);
|
$data[$i][] = new htmlInputField('val_' . $i, $valVal);
|
||||||
// check input
|
// check input
|
||||||
if (($selOp == ADD) && !empty($attrVal) && empty($valVal)) {
|
if (($selOp == ADD) && !empty($attrVal) && empty($valVal)) {
|
||||||
$errors[] = new htmlStatusMessage('ERROR', _('Please enter a value to add.'), htmlspecialchars($attrVal));
|
$errors[] = new htmlStatusMessage('ERROR', _('Please enter a value to add.'), htmlspecialchars($attrVal));
|
||||||
|
@ -170,20 +167,22 @@ function displayStartPage() {
|
||||||
$errors[] = new htmlStatusMessage('ERROR', _('Please enter a value to modify.'), htmlspecialchars($attrVal));
|
$errors[] = new htmlStatusMessage('ERROR', _('Please enter a value to modify.'), htmlspecialchars($attrVal));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$operationsTable = new htmlResponsiveTable($operationsTitles, $data);
|
||||||
|
$container->add($operationsTable, 12);
|
||||||
// add more fields
|
// add more fields
|
||||||
$container->addVerticalSpace('5px');
|
$container->addVerticalSpacer('1rem');
|
||||||
$container->addElement(new htmlButton('addFields', _('Add more fields')));
|
$container->add(new htmlButton('addFields', _('Add more fields')), 12);
|
||||||
$container->addElement(new htmlHiddenInput('opcount', $opCount), true);
|
$container->add(new htmlHiddenInput('opcount', $opCount), 12);
|
||||||
// error messages
|
// error messages
|
||||||
if (sizeof($errors) > 0) {
|
if (sizeof($errors) > 0) {
|
||||||
$container->addVerticalSpace('20px');
|
$container->addVerticalSpacer('5rem');
|
||||||
foreach ($errors as $error) {
|
foreach ($errors as $error) {
|
||||||
$error->colspan = 5;
|
$error->colspan = 5;
|
||||||
$container->addElement($error, true);
|
$container->add($error, 12);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// action buttons
|
// action buttons
|
||||||
$container->addVerticalSpace('20px');
|
$container->addVerticalSpacer('2rem');
|
||||||
$buttonGroup = new htmlGroup();
|
$buttonGroup = new htmlGroup();
|
||||||
$buttonGroup->colspan = 3;
|
$buttonGroup->colspan = 3;
|
||||||
$dryRunButton = new htmlButton('dryRun', _('Dry run'));
|
$dryRunButton = new htmlButton('dryRun', _('Dry run'));
|
||||||
|
@ -193,8 +192,8 @@ function displayStartPage() {
|
||||||
$applyButton = new htmlButton('applyChanges', _('Apply changes'));
|
$applyButton = new htmlButton('applyChanges', _('Apply changes'));
|
||||||
$applyButton->setIconClass('saveButton');
|
$applyButton->setIconClass('saveButton');
|
||||||
$buttonGroup->addElement($applyButton);
|
$buttonGroup->addElement($applyButton);
|
||||||
$container->addElement($buttonGroup, true);
|
$container->add($buttonGroup, 12);
|
||||||
$container->addVerticalSpace('10px');
|
$container->addVerticalSpacer('1rem');
|
||||||
|
|
||||||
// run actions
|
// run actions
|
||||||
if ((sizeof($errors) == 0) && (isset($_POST['dryRun']) || isset($_POST['applyChanges']))) {
|
if ((sizeof($errors) == 0) && (isset($_POST['dryRun']) || isset($_POST['applyChanges']))) {
|
||||||
|
@ -206,15 +205,15 @@ function displayStartPage() {
|
||||||
parseHtml(null, $container, array(), false, $tabindex, 'user');
|
parseHtml(null, $container, array(), false, $tabindex, 'user');
|
||||||
echo ("</form>\n");
|
echo ("</form>\n");
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
include 'main_footer.php';
|
include '../lib/adminFooter.inc';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs the dry run and change actions.
|
* Runs the dry run and change actions.
|
||||||
*
|
*
|
||||||
* @param htmlTable $container container
|
* @param htmlResponsiveRow $container container
|
||||||
*/
|
*/
|
||||||
function runActions(htmlTable &$container) {
|
function runActions(htmlResponsiveRow &$container) {
|
||||||
// LDAP suffix
|
// LDAP suffix
|
||||||
if ($_POST['suffix'] == '-') {
|
if ($_POST['suffix'] == '-') {
|
||||||
$suffix = trim($_POST['otherSuffix']);
|
$suffix = trim($_POST['otherSuffix']);
|
||||||
|
@ -225,7 +224,7 @@ function runActions(htmlTable &$container) {
|
||||||
if (empty($suffix)) {
|
if (empty($suffix)) {
|
||||||
$error = new htmlStatusMessage('ERROR', _('LDAP Suffix is invalid!'));
|
$error = new htmlStatusMessage('ERROR', _('LDAP Suffix is invalid!'));
|
||||||
$error->colspan = 5;
|
$error->colspan = 5;
|
||||||
$container->addElement($error);
|
$container->add($error, 12);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// LDAP filter
|
// LDAP filter
|
||||||
|
@ -240,7 +239,7 @@ function runActions(htmlTable &$container) {
|
||||||
if (sizeof($operations) == 0) {
|
if (sizeof($operations) == 0) {
|
||||||
$error = new htmlStatusMessage('ERROR', _('Please specify at least one operation.'));
|
$error = new htmlStatusMessage('ERROR', _('Please specify at least one operation.'));
|
||||||
$error->colspan = 5;
|
$error->colspan = 5;
|
||||||
$container->addElement($error);
|
$container->add($error, 12);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$_SESSION['multiEdit_suffix'] = $suffix;
|
$_SESSION['multiEdit_suffix'] = $suffix;
|
||||||
|
@ -254,15 +253,15 @@ function runActions(htmlTable &$container) {
|
||||||
jQuery(\'select\').attr(\'disabled\', true);
|
jQuery(\'select\').attr(\'disabled\', true);
|
||||||
jQuery(\'button\').attr(\'disabled\', true);
|
jQuery(\'button\').attr(\'disabled\', true);
|
||||||
';
|
';
|
||||||
$container->addElement(new htmlJavaScript($jsContent), true);
|
$container->add(new htmlJavaScript($jsContent), 12);
|
||||||
// progress area
|
// progress area
|
||||||
$container->addElement(new htmlSubTitle(_('Progress')), true);
|
$container->add(new htmlSubTitle(_('Progress')), 12);
|
||||||
$progressBarDiv = new htmlDiv('progressBar', '');
|
$progressBarDiv = new htmlDiv('progressBar', '');
|
||||||
$progressBarDiv->colspan = 5;
|
$progressBarDiv->colspan = 5;
|
||||||
$container->addElement($progressBarDiv, true);
|
$container->add($progressBarDiv, 12);
|
||||||
$progressDiv = new htmlDiv('progressArea', '');
|
$progressDiv = new htmlDiv('progressArea', '');
|
||||||
$progressDiv->colspan = 5;
|
$progressDiv->colspan = 5;
|
||||||
$container->addElement($progressDiv, true);
|
$container->add($progressDiv, 12);
|
||||||
// JS block for AJAX status update
|
// JS block for AJAX status update
|
||||||
$ajaxBlock = '
|
$ajaxBlock = '
|
||||||
jQuery.get(\'multiEdit.php?ajaxStatus\', null, function(data) {handleReply(data);}, \'json\');
|
jQuery.get(\'multiEdit.php?ajaxStatus\', null, function(data) {handleReply(data);}, \'json\');
|
||||||
|
@ -281,7 +280,7 @@ function runActions(htmlTable &$container) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
';
|
';
|
||||||
$container->addElement(new htmlJavaScript($ajaxBlock), true);
|
$container->add(new htmlJavaScript($ajaxBlock), 12);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -392,7 +391,7 @@ function generateActions() {
|
||||||
if (empty($val) && !empty($entry[$attr])) {
|
if (empty($val) && !empty($entry[$attr])) {
|
||||||
$actions[] = array(DEL, $dn, $attr, null);
|
$actions[] = array(DEL, $dn, $attr, null);
|
||||||
}
|
}
|
||||||
elseif (!empty($val) && in_array($val, $entry[$attr])) {
|
elseif (!empty($val) && isset($entry[$attr]) && in_array($val, $entry[$attr])) {
|
||||||
$actions[] = array(DEL, $dn, $attr, $val);
|
$actions[] = array(DEL, $dn, $attr, $val);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue