responsive upload

This commit is contained in:
Roland Gruber 2018-04-18 18:43:29 +02:00
parent fad14da5f7
commit 9e71a67953
2 changed files with 135 additions and 170 deletions

View File

@ -87,6 +87,7 @@ table.responsive-table td {
padding-top: 0.5rem; padding-top: 0.5rem;
padding-right: 0.1rem; padding-right: 0.1rem;
padding-left: 0.1rem; padding-left: 0.1rem;
word-break: break-all;
} }
/* mobile */ /* mobile */
@ -161,6 +162,10 @@ table.responsive-table td {
display: none !important; display: none !important;
} }
table.alternating-color tbody tr:nth-child(odd) {
background-color:rgba(0, 0, 0, 0.05);
}
} }
/* desktop */ /* desktop */
@ -182,4 +187,8 @@ table.responsive-table td {
display: none !important; display: none !important;
} }
table.alternating-color tbody tr:nth-child(odd) {
background-color:rgba(0, 0, 0, 0.05);
}
} }

View File

@ -1,25 +1,24 @@
<?php <?php
namespace LAM\UPLOAD; namespace LAM\UPLOAD;
use \htmlTable; use \htmlResponsiveTable;
use \htmlTableExtendedSelect;
use \htmlSpacer;
use \htmlOutputText; use \htmlOutputText;
use \htmlGroup; use \htmlGroup;
use \htmlElement;
use \htmlImage; use \htmlImage;
use \htmlTableExtendedInputCheckbox; use \htmlResponsiveInputCheckbox;
use \htmlDiv; use \htmlDiv;
use \htmlHiddenInput; use \htmlHiddenInput;
use \htmlButton; use \htmlButton;
use \htmlTitle; use \htmlTitle;
use \htmlInputFileUpload; use \htmlResponsiveInputFileUpload;
use \htmlLink; use \htmlLink;
use \htmlSubTitle; use \htmlSubTitle;
use \htmlHelpLink; use \htmlHelpLink;
use \htmlTableRow; use \htmlResponsiveRow;
use \htmlResponsiveSelect;
use \htmlLabeledInputCheckbox;
use \htmlSpacer;
use \moduleCache; use \moduleCache;
/* /*
$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) 2004 - 2018 Roland Gruber Copyright (C) 2004 - 2018 Roland Gruber
@ -96,7 +95,7 @@ if (isset($_GET['getCSV'])) {
Uploader::cleanSession(); Uploader::cleanSession();
include '../main_header.php'; include '../../lib/adminHeader.inc';
// get possible types and remove those which do not support file upload // get possible types and remove those which do not support file upload
$typeManager = new \LAM\TYPES\TypeManager(); $typeManager = new \LAM\TYPES\TypeManager();
@ -145,21 +144,14 @@ if (isset($_REQUEST['type'])) {
$divClass = htmlspecialchars(\LAM\TYPES\getScopeFromTypeId($_REQUEST['type'])); $divClass = htmlspecialchars(\LAM\TYPES\getScopeFromTypeId($_REQUEST['type']));
} }
echo '<div class="' . $divClass . '-bright smallPaddingContent">'; echo '<div class="' . $divClass . '-bright smallPaddingContent">';
echo "<div class=\"title\">\n";
echo "<h2 class=\"titleText\">" . _("Account creation via file upload") . "</h2>\n";
echo "</div>";
echo "<p>&nbsp;</p>\n";
echo "<p>\n";
echo _("Here you can create multiple accounts by providing a CSV file.");
echo "</p>\n";
echo "<p>&nbsp;</p>\n";
echo "<form enctype=\"multipart/form-data\" action=\"masscreate.php\" method=\"post\">\n"; echo "<form enctype=\"multipart/form-data\" action=\"masscreate.php\" method=\"post\">\n";
$tabindex = 1; $tabindex = 1;
$table = new htmlTable();
$row = new htmlResponsiveRow();
$row->add(new htmlTitle(_("Account creation via file upload")), 12);
$row->add(new htmlOutputText(_("Here you can create multiple accounts by providing a CSV file.")), 12);
$row->addVerticalSpacer('4rem');
// account type // account type
$typeList = array(); $typeList = array();
@ -173,34 +165,32 @@ if (isset($_REQUEST['type'])) {
elseif (!empty($types)) { elseif (!empty($types)) {
$selectedType = $types[0]->getId(); $selectedType = $types[0]->getId();
} }
$typeSelect = new htmlTableExtendedSelect('type', $typeList, array($selectedType), _("Account type")); $typeSelect = new htmlResponsiveSelect('type', $typeList, array($selectedType), _("Account type"));
$typeSelect->setHasDescriptiveElements(true); $typeSelect->setHasDescriptiveElements(true);
$typeSelect->setOnchangeEvent('changeVisibleModules(this);'); $typeSelect->setOnchangeEvent('changeVisibleModules(this);');
$table->addElement($typeSelect, true); $row->add($typeSelect, 12);
$table->addElement(new htmlSpacer(null, '10px'), true); $row->addVerticalSpacer('1rem');
$row->add(new htmlSubTitle(_('Selected modules')), 12);
// module selection // module selection
$moduleLabel = new htmlOutputText(_('Selected modules'));
$moduleLabel->alignment = htmlElement::ALIGN_TOP;
$table->addElement($moduleLabel);
$moduleGroup = new htmlGroup();
foreach ($types as $type) { foreach ($types as $type) {
$divClasses = array('typeOptions'); $divClasses = array('typeOptions');
if ($selectedType != $type->getId()) { if ($selectedType != $type->getId()) {
$divClasses[] = 'hidden'; $divClasses[] = 'hidden';
} }
$innerTable = new htmlTable(); $innerRow = new htmlResponsiveRow();
$modules = $_SESSION['config']->get_AccountModules($type->getId()); $modules = $_SESSION['config']->get_AccountModules($type->getId());
foreach ($modules as $m => $moduleName) { foreach ($modules as $m => $moduleName) {
if (($m != 0) && ($m%3 == 0)) { $moduleGroup = new htmlGroup();
echo $innerTable->addNewLine();
}
$module = moduleCache::getModule($moduleName, $type->getScope()); $module = moduleCache::getModule($moduleName, $type->getScope());
$iconImage = $module->getIcon(); $iconImage = $module->getIcon();
if (!is_null($iconImage) && !(strpos($iconImage, 'http') === 0) && !(strpos($iconImage, '/') === 0)) { if (!is_null($iconImage) && !(strpos($iconImage, 'http') === 0) && !(strpos($iconImage, '/') === 0)) {
$iconImage = '../../graphics/' . $iconImage; $iconImage = '../../graphics/' . $iconImage;
} }
$innerTable->addElement(new htmlImage($iconImage)); $image = new htmlImage($iconImage, '32px', '32px');
$image->setCSSClasses(array('margin3'));
$moduleGroup->addElement($image);
$enabled = true; $enabled = true;
if (is_base_module($moduleName, $type->getScope())) { if (is_base_module($moduleName, $type->getScope())) {
$enabled = false; $enabled = false;
@ -209,34 +199,44 @@ foreach ($types as $type) {
if (isset($_POST['submit']) && !isset($_POST[$type->getId() . '___' . $moduleName])) { if (isset($_POST['submit']) && !isset($_POST[$type->getId() . '___' . $moduleName])) {
$checked = false; $checked = false;
} }
$checkbox = new htmlTableExtendedInputCheckbox($type->getId() . '___' . $moduleName, $checked, getModuleAlias($moduleName, $type->getScope()), null, false); $checkbox = new htmlLabeledInputCheckbox($type->getId() . '___' . $moduleName, $checked, getModuleAlias($moduleName, $type->getScope()), null, false);
$checkbox->setIsEnabled($enabled); $checkbox->setIsEnabled($enabled);
if ($enabled) { if ($enabled) {
$innerTable->addElement($checkbox); $moduleGroup->addElement($checkbox);
} }
else { else {
$boxGroup = new htmlGroup(); $boxGroup = new htmlGroup();
$boxGroup->addElement($checkbox); $boxGroup->addElement($checkbox);
// add hidden field to fake disabled checkbox value // add hidden field to fake disabled checkbox value
$boxGroup->addElement(new htmlHiddenInput($type->getId() . '___' . $moduleName, 'on')); $boxGroup->addElement(new htmlHiddenInput($type->getId() . '___' . $moduleName, 'on'));
$innerTable->addElement($boxGroup); $moduleGroup->addElement($boxGroup);
} }
$innerTable->addElement(new htmlSpacer('10px', null)); $innerRow->add($moduleGroup, 12, 6, 4);
} }
$typeDiv = new htmlDiv($type->getId(), $innerTable); $moduleCount = sizeof($modules);
if ($moduleCount%3 == 2) {
$innerRow->add(new htmlOutputText('&nbsp;', false), 0, 0, 4);
}
if ($moduleCount%3 == 1) {
$innerRow->add(new htmlOutputText('&nbsp;', false), 0, 0, 4);
}
if ($moduleCount%2 == 1) {
$innerRow->add(new htmlOutputText('&nbsp;', false), 0, 6, 0);
}
$typeDiv = new htmlDiv($type->getId(), $innerRow);
$typeDiv->setCSSClasses($divClasses); $typeDiv->setCSSClasses($divClasses);
$moduleGroup->addElement($typeDiv); $row->add($typeDiv, 12);
} }
$table->addElement($moduleGroup, true);
// ok button // ok button
$table->addElement(new htmlSpacer(null, '20px'), true); $row->addVerticalSpacer('3rem');
if (!empty($types)) { if (!empty($types)) {
$table->addElement(new htmlButton('submit', _('Ok')), true); $row->add(new htmlButton('submit', _('Ok')), 12);
} }
addSecurityTokenToMetaHTML($table); addSecurityTokenToMetaHTML($row);
parseHtml(null, $table, array(), false, $tabindex, 'user'); parseHtml(null, $row, array(), false, $tabindex, 'user');
?> ?>
<script type="text/javascript"> <script type="text/javascript">
function changeVisibleModules(element) { function changeVisibleModules(element) {
@ -248,7 +248,7 @@ function changeVisibleModules(element) {
echo "</form>\n"; echo "</form>\n";
echo '</div>'; echo '</div>';
include '../main_footer.php'; include '../../lib/adminFooter.inc';
/** /**
* Displays the acount type specific main page of the upload. * Displays the acount type specific main page of the upload.
@ -264,32 +264,36 @@ function showMainPage(\LAM\TYPES\ConfiguredType $type, $selectedModules) {
$modules = array_keys($columns); $modules = array_keys($columns);
echo "<form enctype=\"multipart/form-data\" action=\"massBuildAccounts.php\" method=\"post\">\n"; echo "<form enctype=\"multipart/form-data\" action=\"massBuildAccounts.php\" method=\"post\">\n";
$container = new htmlTable(); $tabindex = 1;
$row = new htmlResponsiveRow();
$row->setCSSClasses(array('maxrow'));
// title // title
$container->addElement(new htmlTitle(_("File upload")), true); $row->add(new htmlTitle(_("File upload")), 12);
$container->addElement(new htmlSpacer(null, '10px'), true);
// instructions // instructions
$container->addElement(new htmlOutputText(_("Please provide a CSV formated file with your account data. The cells in the first row must be filled with the column identifiers. The following rows represent one account for each row.")), true); $row->add(new htmlOutputText(_("Please provide a CSV formated file with your account data. The cells in the first row must be filled with the column identifiers. The following rows represent one account for each row.")), 12);
$container->addElement(new htmlOutputText(_("Check your input carefully. LAM will only do some basic checks on the upload data.")), true); $row->add(new htmlOutputText(_("Check your input carefully. LAM will only do some basic checks on the upload data.")), 12);
$container->addElement(new htmlSpacer(null, '10px'), true); $row->addVerticalSpacer('1rem');
$container->addElement(new htmlOutputText(_("Hint: Format all cells as text in your spreadsheet program and turn off auto correction.")), true); $row->add(new htmlOutputText(_("Hint: Format all cells as text in your spreadsheet program and turn off auto correction.")), 12);
$container->addElement(new htmlSpacer(null, '10px'), true); $row->addVerticalSpacer('1rem');
// upload elements // upload elements
$inputContainer = new htmlTable(); $row->addLabel(new htmlOutputText(_("Download sample CSV file")));
$inputContainer->addElement(new htmlOutputText(_("CSV file"))); $row->addField(new htmlLink('', 'masscreate.php?getCSV=1', '../../graphics/save.png', true));
$inputContainer->addElement(new htmlInputFileUpload('inputfile')); $row->addVerticalSpacer('3rem');
$inputContainer->addElement(new htmlSpacer('10px', null)); $row->add(new htmlResponsiveInputFileUpload('inputfile', _("CSV file")), 12);
$inputContainer->addElement(new htmlLink(_("Download sample CSV file"), 'masscreate.php?getCSV=1', '../../graphics/save.png', true)); $row->add(new htmlHiddenInput('typeId', $type->getId()), 12);
$inputContainer->addElement(new htmlHiddenInput('typeId', $type->getId())); $row->add(new htmlHiddenInput('selectedModules', implode(',', $selectedModules)), 12);
$inputContainer->addElement(new htmlHiddenInput('selectedModules', implode(',', $selectedModules)), true);
// PDF // PDF
$createPDF = false; $createPDF = false;
if (isset($_POST['createPDF']) && ($_POST['createPDF'] === '1')) { if (isset($_POST['createPDF']) && ($_POST['createPDF'] === '1')) {
$createPDF = true; $createPDF = true;
} }
$pdfCheckbox = new htmlTableExtendedInputCheckbox('createPDF', $createPDF, _('Create PDF files')); $pdfCheckbox = new htmlResponsiveInputCheckbox('createPDF', $createPDF, _('Create PDF files'));
$pdfCheckbox->setTableRowsToShow(array('pdfStructure', 'pdf_font')); $pdfCheckbox->setTableRowsToShow(array('pdfStructure', 'pdf_font'));
$inputContainer->addElement($pdfCheckbox, true); $row->add($pdfCheckbox, 12);
$pdfStructures = \LAM\PDF\getPDFStructures($type->getId()); $pdfStructures = \LAM\PDF\getPDFStructures($type->getId());
$pdfSelected = array(); $pdfSelected = array();
if (isset($_POST['pdfStructure'])) { if (isset($_POST['pdfStructure'])) {
@ -298,94 +302,76 @@ function showMainPage(\LAM\TYPES\ConfiguredType $type, $selectedModules) {
else if (in_array('default', $pdfStructures)) { else if (in_array('default', $pdfStructures)) {
$pdfSelected = array('default'); $pdfSelected = array('default');
} }
$inputContainer->addElement(new htmlTableExtendedSelect('pdfStructure', $pdfStructures, $pdfSelected, _('PDF structure')), true); $row->add(new htmlResponsiveSelect('pdfStructure', $pdfStructures, $pdfSelected, _('PDF structure')), 12);
$fonts = \LAM\PDF\getPdfFonts(); $fonts = \LAM\PDF\getPdfFonts();
$fontSelection = new htmlTableExtendedSelect('pdf_font', $fonts, array(), _('Font'), '411'); $fontSelection = new htmlResponsiveSelect('pdf_font', $fonts, array(), _('Font'), '411');
$fontSelection->setCSSClasses(array('lam-save-selection')); $fontSelection->setCSSClasses(array('lam-save-selection'));
$fontSelection->setHasDescriptiveElements(true); $fontSelection->setHasDescriptiveElements(true);
$fontSelection->setSortElements(false); $fontSelection->setSortElements(false);
$inputContainer->addElement($fontSelection, true); $row->add($fontSelection, 12);
$inputContainer->addElement(new htmlSpacer(null, '5px'), true); $row->addVerticalSpacer('1rem');
$uploadButton = new htmlButton('submitfile', _('Upload file and create accounts')); $uploadButton = new htmlButton('submitfile', _('Upload file and create accounts'));
$uploadButton->setIconClass('upButton'); $uploadButton->setIconClass('upButton');
$inputContainer->addElement($uploadButton); $row->addLabel($uploadButton);
$container->addElement($inputContainer, true); $row->addField(new htmlOutputText('&nbsp;', false));
$container->addElement(new htmlSpacer(null, '10px'), true); $row->addVerticalSpacer('2rem');
// column list
$columnSpacer = new htmlSpacer('10px', null); $row->add(new htmlTitle(_("Columns")), 12);
$container->addElement(new htmlTitle(_("Columns")), true);
$columnContainer = new htmlTable();
$columnContainer->setCSSClasses(array($scope . 'list', 'collapse'));
// DN options // DN options
$dnTitle = new htmlSubTitle(_("DN settings"), '../../graphics/logo32.png'); $dnTitle = new htmlSubTitle(_("DN settings"), '../../graphics/logo32.png');
$dnTitle->colspan = 20; $row->add($dnTitle, 12);
$columnContainer->addElement($dnTitle, true); $titles = array(_('Name'), _("Identifier"), _("Example value"), _("Default value"), _("Possible values"));
$columnContainer->addElement($columnSpacer); $data = array();
$columnContainer->addElement(new htmlOutputText(''));
$columnContainer->addElement($columnSpacer);
$header0 = new htmlOutputText(_('Name'));
$header0->alignment = htmlElement::ALIGN_LEFT;
$columnContainer->addElement($header0, false, true);
$columnContainer->addElement($columnSpacer);
$header1 = new htmlOutputText(_("Identifier"));
$header1->alignment = htmlElement::ALIGN_LEFT;
$columnContainer->addElement($header1, false, true);
$columnContainer->addElement($columnSpacer);
$header2 = new htmlOutputText(_("Example value"));
$header2->alignment = htmlElement::ALIGN_LEFT;
$columnContainer->addElement($header2, false, true);
$columnContainer->addElement($columnSpacer);
$header3 = new htmlOutputText(_("Default value"));
$header3->alignment = htmlElement::ALIGN_LEFT;
$columnContainer->addElement($header3, false, true);
$columnContainer->addElement($columnSpacer);
$header4 = new htmlOutputText(_("Possible values"));
$header4->alignment = htmlElement::ALIGN_LEFT;
$columnContainer->addElement($header4, false, true);
$dnSuffixRowCells = array(); $dnSuffixRowCells = array();
$dnSuffixRowCells[] = $columnSpacer; $nameGroup = new htmlGroup();
$dnSuffixRowCells[] = new htmlHelpLink('361'); $help = new htmlHelpLink('361');
$dnSuffixRowCells[] = $columnSpacer; $help->setCSSClasses(array('hide-on-mobile'));
$dnSuffixRowCells[] = new htmlOutputText(_("DN suffix")); $nameGroup->addElement($help);
$dnSuffixRowCells[] = $columnSpacer; $nameGroup->addElement(new htmlSpacer('0.25rem', '16px'));
$nameGroup->addElement(new htmlOutputText(_("DN suffix")));
$help = new htmlHelpLink('361');
$help->setCSSClasses(array('hide-on-tablet'));
$nameGroup->addElement($help);
$dnSuffixRowCells[] = $nameGroup;
$dnSuffixRowCells[] = new htmlOutputText('dn_suffix'); $dnSuffixRowCells[] = new htmlOutputText('dn_suffix');
$dnSuffixRowCells[] = $columnSpacer;
$dnSuffixRowCells[] = new htmlOutputText($type->getSuffix()); $dnSuffixRowCells[] = new htmlOutputText($type->getSuffix());
$dnSuffixRowCells[] = $columnSpacer;
$dnSuffixRowCells[] = new htmlOutputText($type->getSuffix()); $dnSuffixRowCells[] = new htmlOutputText($type->getSuffix());
$dnSuffixRowCells[] = $columnSpacer;
$dnSuffixRowCells[] = new htmlOutputText(''); $dnSuffixRowCells[] = new htmlOutputText('');
$dnSuffixRowCells[] = new htmlSpacer(null, '25px'); $data[] = $dnSuffixRowCells;
$dnSuffixRow = new htmlTableRow($dnSuffixRowCells);
$dnSuffixRow->setCSSClasses(array($scope . '-dark'));
$columnContainer->addElement($dnSuffixRow);
$dnRDNRowCells = array(); $dnRDNRowCells = array();
$dnRDNRowCells[] = $columnSpacer;
$dnRDNRowCells[] = new htmlHelpLink('301');
$dnRDNRowCells[] = $columnSpacer;
$rdnText = new htmlOutputText(_("RDN identifier")); $rdnText = new htmlOutputText(_("RDN identifier"));
$rdnText->setMarkAsRequired(true); $rdnText->setMarkAsRequired(true);
$dnRDNRowCells[] = $rdnText; $nameGroup = new htmlGroup();
$dnRDNRowCells[] = $columnSpacer; $help = new htmlHelpLink('301');
$help->setCSSClasses(array('hide-on-mobile'));
$nameGroup->addElement($help);
$nameGroup->addElement(new htmlSpacer('0.25rem', '16px'));
$nameGroup->addElement($rdnText);
$help = new htmlHelpLink('301');
$help->setCSSClasses(array('hide-on-tablet'));
$nameGroup->addElement($help);
$dnRDNRowCells[] = $nameGroup;
$dnRDNRowCells[] = new htmlOutputText('dn_rdn'); $dnRDNRowCells[] = new htmlOutputText('dn_rdn');
$dnRDNRowCells[] = $columnSpacer;
$rdnAttributes = getRDNAttributes($type->getId(), $selectedModules); $rdnAttributes = getRDNAttributes($type->getId(), $selectedModules);
$dnRDNRowCells[] = new htmlOutputText($rdnAttributes[0]); $dnRDNRowCells[] = new htmlOutputText($rdnAttributes[0]);
$dnRDNRowCells[] = $columnSpacer;
$dnRDNRowCells[] = new htmlOutputText(''); $dnRDNRowCells[] = new htmlOutputText('');
$dnRDNRowCells[] = $columnSpacer;
$dnRDNRowCells[] = new htmlOutputText(implode(", ", $rdnAttributes)); $dnRDNRowCells[] = new htmlOutputText(implode(", ", $rdnAttributes));
$dnRDNRowCells[] = new htmlSpacer(null, '25px'); $dnRDNRowCells[] = new htmlHelpLink('301');
$dnRDNRow = new htmlTableRow($dnRDNRowCells); $data[] = $dnRDNRowCells;
$dnRDNRow->setCSSClasses(array($scope . '-bright')); $table = new htmlResponsiveTable($titles, $data);
$columnContainer->addElement($dnRDNRow); $table->setCSSClasses(array('alternating-color'));
$row->add($table, 12);
$data = array();
// module options // module options
foreach ($modules as $moduleName) { foreach ($modules as $moduleName) {
// skip modules without upload columns // skip modules without upload columns
if (sizeof($columns[$moduleName]) < 1) { if (sizeof($columns[$moduleName]) < 1) {
continue; continue;
} }
$columnContainer->addElement(new htmlSpacer(null, '10px'), true); $row->addVerticalSpacer('2rem');
$module = moduleCache::getModule($moduleName, $scope); $module = moduleCache::getModule($moduleName, $scope);
$icon = $module->getIcon(); $icon = $module->getIcon();
if (!empty($icon) && !(strpos($icon, 'http') === 0) && !(strpos($icon, '/') === 0)) { if (!empty($icon) && !(strpos($icon, 'http') === 0) && !(strpos($icon, '/') === 0)) {
@ -393,82 +379,52 @@ function showMainPage(\LAM\TYPES\ConfiguredType $type, $selectedModules) {
} }
$moduleTitle = new htmlSubTitle(getModuleAlias($moduleName, $scope), $icon); $moduleTitle = new htmlSubTitle(getModuleAlias($moduleName, $scope), $icon);
$moduleTitle->colspan = 20; $moduleTitle->colspan = 20;
$columnContainer->addElement($moduleTitle, true); $row->add($moduleTitle, 12);
$columnContainer->addElement(new htmlOutputText(''));
$columnContainer->addElement(new htmlOutputText(''));
$columnContainer->addElement(new htmlOutputText(''));
$nameOut = new htmlOutputText(_('Name'));
$nameOut->alignment = htmlElement::ALIGN_LEFT;
$columnContainer->addElement($nameOut, false, true);
$columnContainer->addElement(new htmlOutputText(''));
$idOut = new htmlOutputText(_('Identifier'));
$idOut->alignment = htmlElement::ALIGN_LEFT;
$columnContainer->addElement($idOut, false, true);
$columnContainer->addElement(new htmlOutputText(''));
$exampleOut = new htmlOutputText(_('Example value'));
$exampleOut->alignment = htmlElement::ALIGN_LEFT;
$columnContainer->addElement($exampleOut, false, true);
$columnContainer->addElement(new htmlOutputText(''));
$defaultOut = new htmlOutputText(_('Default value'));
$defaultOut->alignment = htmlElement::ALIGN_LEFT;
$columnContainer->addElement($defaultOut, false, true);
$columnContainer->addElement(new htmlOutputText(''));
$possibleOut = new htmlOutputText(_('Possible values'));
$possibleOut->alignment = htmlElement::ALIGN_LEFT;
$columnContainer->addElement($possibleOut, false, true);
$odd = true;
foreach ($columns[$moduleName] as $column) { foreach ($columns[$moduleName] as $column) {
$required = false; $required = false;
if (isset($column['required']) && ($column['required'] === true)) { if (isset($column['required']) && ($column['required'] === true)) {
$required = true; $required = true;
} }
$rowCells = array(); $rowCells = array();
$rowCells[] = $columnSpacer;
$rowCells[] = new htmlHelpLink($column['help'], $moduleName, $scope);
$rowCells[] = $columnSpacer;
$descriptionText = new htmlOutputText($column['description']); $descriptionText = new htmlOutputText($column['description']);
$descriptionText->setMarkAsRequired($required); $descriptionText->setMarkAsRequired($required);
$descriptionText->setNoWrap(true); $nameGroup = new htmlGroup();
$rowCells[] = $descriptionText; $help = new htmlHelpLink($column['help'], $moduleName, $scope);
$rowCells[] = $columnSpacer; $help->setCSSClasses(array('hide-on-mobile'));
$nameGroup->addElement($help);
$nameGroup->addElement(new htmlSpacer('0.25rem', '16px'));
$nameGroup->addElement($descriptionText);
$help = new htmlHelpLink($column['help'], $moduleName, $scope);
$help->setCSSClasses(array('hide-on-tablet'));
$nameGroup->addElement($help);
$rowCells[] = $nameGroup;
$rowCells[] = new htmlOutputText($column['name']); $rowCells[] = new htmlOutputText($column['name']);
$rowCells[] = $columnSpacer;
$example = ''; $example = '';
if (isset($column['example'])) { if (isset($column['example'])) {
$example = $column['example']; $example = $column['example'];
} }
$rowCells[] = new htmlOutputText($example); $rowCells[] = new htmlOutputText($example);
$rowCells[] = $columnSpacer;
if (isset($column['default'])) { if (isset($column['default'])) {
$rowCells[] = new htmlOutputText($column['default']); $rowCells[] = new htmlOutputText($column['default']);
} }
else { else {
$rowCells[] = new htmlOutputText(''); $rowCells[] = new htmlOutputText('');
} }
$rowCells[] = $columnSpacer;
if (isset($column['values'])) { if (isset($column['values'])) {
$rowCells[] = new htmlOutputText($column['values']); $rowCells[] = new htmlOutputText($column['values']);
} }
else { else {
$rowCells[] = new htmlOutputText(''); $rowCells[] = new htmlOutputText('');
} }
$rowCells[] = new htmlSpacer(null, '25px'); $data[] = $rowCells;
$row = new htmlTableRow($rowCells);
if ($odd) {
$row->setCSSClasses(array($scope . '-dark'));
} }
else { $table = new htmlResponsiveTable($titles, $data);
$row->setCSSClasses(array($scope . '-bright')); $table->setCSSClasses(array('alternating-color'));
$row->add($table, 12);
} }
$odd = !$odd;
$columnContainer->addElement($row);
}
}
$container->addElement($columnContainer, true);
addSecurityTokenToMetaHTML($container); addSecurityTokenToMetaHTML($row);
$tabindex = 1; parseHtml(null, $row, array(), false, $tabindex, $scope);
parseHtml(null, $container, array(), false, $tabindex, $scope);
echo "</form>\n"; echo "</form>\n";