responsive settings

This commit is contained in:
Roland Gruber 2017-12-02 18:07:33 +01:00
parent 059d987cc9
commit 6be073de49
3 changed files with 45 additions and 72 deletions

View File

@ -541,23 +541,20 @@ class posixGroup extends baseModule implements passwordService {
/** /**
* Returns a list of elements for the configuration. * {@inheritDoc}
* * @see baseModule::get_configOptions()
* @param array $scopes account types (user, group, host) */
* @param array $allScopes list of all modules and active scopes public function get_configOptions($scopes, $allScopes) {
* @return array configuration elements
*/
function get_configOptions($scopes, $allScopes) {
// configuration options // configuration options
$configContainer = new htmlTable(); $configContainer = new htmlResponsiveRow();
$configContainer->addElement(new htmlSubTitle(_("Groups")), true); $configContainer->add(new htmlSubTitle(_("Groups")), 12);
$genOptions = array( $genOptions = array(
_('Fixed range') => 'range', _('Fixed range') => 'range',
_('Samba ID pool') => 'sambaPool', _('Samba ID pool') => 'sambaPool',
_('Windows domain info') => 'windowsDomain', _('Windows domain info') => 'windowsDomain',
_('Magic number') => 'magicNumber' _('Magic number') => 'magicNumber'
); );
$gidGeneratorSelect = new htmlTableExtendedSelect('posixGroup_gidGenerator', $genOptions, array('range'), _('GID generator'), 'gidGenerator'); $gidGeneratorSelect = new htmlResponsiveSelect('posixGroup_gidGenerator', $genOptions, array('range'), _('GID generator'), 'gidGenerator');
$gidGeneratorSelect->setHasDescriptiveElements(true); $gidGeneratorSelect->setHasDescriptiveElements(true);
$gidGeneratorSelect->setTableRowsToHide(array( $gidGeneratorSelect->setTableRowsToHide(array(
'range' => array('posixGroup_sambaIDPoolDN', 'posixGroup_windowsIDPoolDN', 'posixGroup_magicNumber'), 'range' => array('posixGroup_sambaIDPoolDN', 'posixGroup_windowsIDPoolDN', 'posixGroup_magicNumber'),
@ -571,31 +568,31 @@ class posixGroup extends baseModule implements passwordService {
'windowsDomain' => array('posixGroup_windowsIDPoolDN'), 'windowsDomain' => array('posixGroup_windowsIDPoolDN'),
'magicNumber' => array('posixGroup_magicNumber') 'magicNumber' => array('posixGroup_magicNumber')
)); ));
$configContainer->addElement($gidGeneratorSelect, true); $configContainer->add($gidGeneratorSelect, 12);
$minGidInput = new htmlTableExtendedInputField(_('Minimum GID number'), 'posixGroup_minGID', null, 'minMaxGID'); $minGidInput = new htmlResponsiveInputField(_('Minimum GID number'), 'posixGroup_minGID', null, 'minMaxGID');
$minGidInput->setRequired(true); $minGidInput->setRequired(true);
$configContainer->addElement($minGidInput, true); $configContainer->add($minGidInput, 12);
$maxGidInput = new htmlTableExtendedInputField(_('Maximum GID number'), 'posixGroup_maxGID', null, 'minMaxGID'); $maxGidInput = new htmlResponsiveInputField(_('Maximum GID number'), 'posixGroup_maxGID', null, 'minMaxGID');
$maxGidInput->setRequired(true); $maxGidInput->setRequired(true);
$configContainer->addElement($maxGidInput, true); $configContainer->add($maxGidInput, 12);
$gidGeneratorDN = new htmlTableExtendedInputField(_('Samba ID pool DN'), 'posixGroup_sambaIDPoolDN', null, 'sambaIDPoolDN'); $gidGeneratorDN = new htmlResponsiveInputField(_('Samba ID pool DN'), 'posixGroup_sambaIDPoolDN', null, 'sambaIDPoolDN');
$gidGeneratorDN->setRequired(true); $gidGeneratorDN->setRequired(true);
$configContainer->addElement($gidGeneratorDN, true); $configContainer->add($gidGeneratorDN, 12);
$winGeneratorDN = new htmlTableExtendedInputField(_('Windows domain info DN'), 'posixGroup_windowsIDPoolDN', null, 'windowsIDPoolDN'); $winGeneratorDN = new htmlResponsiveInputField(_('Windows domain info DN'), 'posixGroup_windowsIDPoolDN', null, 'windowsIDPoolDN');
$winGeneratorDN->setRequired(true); $winGeneratorDN->setRequired(true);
$configContainer->addElement($winGeneratorDN, true); $configContainer->add($winGeneratorDN, 12);
$magicNumber = new htmlTableExtendedInputField(_('Magic number'), 'posixGroup_magicNumber', null, 'magicNumber'); $magicNumber = new htmlResponsiveInputField(_('Magic number'), 'posixGroup_magicNumber', null, 'magicNumber');
$magicNumber->setRequired(true); $magicNumber->setRequired(true);
$configContainer->addElement($magicNumber, true); $configContainer->add($magicNumber, 12);
$configContainer->addElement(new htmlTableExtendedInputField(_('Suffix for GID/group name check'), 'posixGroup_gidCheckSuffix', '', 'gidCheckSuffix'), true); $configContainer->add(new htmlResponsiveInputField(_('Suffix for GID/group name check'), 'posixGroup_gidCheckSuffix', '', 'gidCheckSuffix'), 12);
$configContainer->addElement(new htmlTableExtendedInputCheckbox('posixGroup_hidememberUid', false, _('Disable membership management'), 'hidememberUid'), true); $configContainer->add(new htmlResponsiveInputCheckbox('posixGroup_hidememberUid', false, _('Disable membership management'), 'hidememberUid'), 12);
if ((!empty($allScopes['groupOfNames']) && in_array('group', $allScopes['groupOfNames'])) if ((!empty($allScopes['groupOfNames']) && in_array('group', $allScopes['groupOfNames']))
|| (!empty($allScopes['groupOfUniqueNames']) && in_array('group', $allScopes['groupOfUniqueNames']))) { || (!empty($allScopes['groupOfUniqueNames']) && in_array('group', $allScopes['groupOfUniqueNames']))) {
$configContainer->addElement(new htmlTableExtendedInputCheckbox('posixGroup_autoSyncGon', false, _('Force sync with group of names'), 'autoSyncGon'), true); $configContainer->add(new htmlResponsiveInputCheckbox('posixGroup_autoSyncGon', false, _('Force sync with group of names'), 'autoSyncGon'), 12);
} }
// display password hash option only if posixAccount module is not used // display password hash option only if posixAccount module is not used
if (!isset($allScopes['posixAccount'])) { if (!isset($allScopes['posixAccount'])) {
$configContainer->addElement(new htmlTableExtendedSelect('posixAccount_pwdHash', getSupportedHashTypes(), array('SSHA'), _("Password hash type"), 'pwdHash')); $configContainer->add(new htmlResponsiveSelect('posixAccount_pwdHash', getSupportedHashTypes(), array('SSHA'), _("Password hash type"), 'pwdHash'), 12);
} }
return $configContainer; return $configContainer;
} }

View File

@ -516,26 +516,14 @@ class puppetClient extends baseModule {
} }
/** /**
* Returns a list of configuration options. * {@inheritDoc}
* * @see baseModule::get_configOptions()
* Calling this method does not require the existence of an enclosing {@link accountContainer}.<br> */
* <br>
* The field names are used as keywords to load and save settings.
* We recommend to use the module name as prefix for them (e.g. posixAccount_homeDirectory) to avoid naming conflicts.
*
* @param array $scopes account types (user, group, host)
* @param array $allScopes list of all active account modules and their scopes (module => array(scopes))
* @return mixed htmlElement or array of htmlElement
*
* @see htmlElement
*/
public function get_configOptions($scopes, $allScopes) { public function get_configOptions($scopes, $allScopes) {
$return = parent::get_configOptions($scopes, $allScopes); $return = new htmlResponsiveRow();
// config options // config options
$configContainer = new htmlTable(); $return->add(new htmlResponsiveInputTextarea('puppetClient_environments', "production\r\ntesting", 30, 5, _('Predefined environments'), 'predefinedEnvironments'), 12);
$configContainer->addElement(new htmlTableExtendedInputTextarea('puppetClient_environments', "production\r\ntesting", 30, 5, _('Predefined environments'), 'predefinedEnvironments'), true); $return->add(new htmlResponsiveInputTextarea('puppetClient_enforceClasses', '', 30, 5, _('Enforce classes'), 'enforceClasses'), 12);
$configContainer->addElement(new htmlTableExtendedInputTextarea('puppetClient_enforceClasses', '', 30, 5, _('Enforce classes'), 'enforceClasses'), true);
$return[] = $configContainer;
return $return; return $return;
} }

View File

@ -1869,49 +1869,37 @@ class sambaSamAccount extends baseModule implements passwordService {
if (!in_array('user', $scopes)) { if (!in_array('user', $scopes)) {
return $return; return $return;
} }
$configContainer = new htmlTable(); $configContainer = new htmlResponsiveRow();
// password history // password history
$history = new htmlTable();
$historyOptions = array( $historyOptions = array(
_('yes - ordered ascending') => 'yes_deleteLast', _('yes - ordered ascending') => 'yes_deleteLast',
_('yes - ordered descending') => 'yes_deleteFirst', _('yes - ordered descending') => 'yes_deleteFirst',
_('no') => 'no' _('no') => 'no'
); );
$historySelect = new htmlTableExtendedSelect('sambaSamAccount_history', $historyOptions, array('yes_deleteLast'), _("Password history"), 'history'); $historySelect = new htmlResponsiveSelect('sambaSamAccount_history', $historyOptions, array('yes_deleteLast'), _("Password history"), 'history');
$historySelect->setHasDescriptiveElements(true); $historySelect->setHasDescriptiveElements(true);
$history->addElement($historySelect, true); $configContainer->add($historySelect, 12);
$configContainer->addElement($history, true);
// disable LM passwords // disable LM passwords
$disableLM = new htmlTable();
$yesNo = array(_('yes') => 'yes', _('no') => 'no'); $yesNo = array(_('yes') => 'yes', _('no') => 'no');
$lmYesNoSelect = new htmlTableExtendedSelect('sambaSamAccount_lmHash', $yesNo, array('yes'), _("Disable LM hashes"), 'lmHash'); $lmYesNoSelect = new htmlResponsiveSelect('sambaSamAccount_lmHash', $yesNo, array('yes'), _("Disable LM hashes"), 'lmHash');
$lmYesNoSelect->setHasDescriptiveElements(true); $lmYesNoSelect->setHasDescriptiveElements(true);
$disableLM->addElement($lmYesNoSelect, true); $configContainer->add($lmYesNoSelect, 12);
$configContainer->addElement($disableLM, true);
// hidden options // hidden options
$configContainer->addElement(new htmlSpacer(null, '10px'), true); $configContainer->addVerticalSpacer('1rem');
$configHiddenLabelGroup = new htmlGroup(); $configHiddenLabelGroup = new htmlGroup();
$configHiddenLabelGroup->addElement(new htmlOutputText(_('Hidden options') . ' ')); $configHiddenLabelGroup->addElement(new htmlOutputText(_('Hidden options') . ' '));
$configHiddenLabelGroup->addElement(new htmlHelpLink('hiddenOptions')); $configHiddenLabelGroup->addElement(new htmlHelpLink('hiddenOptions'));
$configContainer->addElement($configHiddenLabelGroup, true); $configContainer->add($configHiddenLabelGroup, 12);
$hiddenContainer = new htmlTable(); $configContainer->addVerticalSpacer('0.5rem');
$hiddenContainer->colspan = 5; $configContainer->add(new htmlResponsiveInputCheckbox('sambaSamAccount_hideHomeDrive', false, _('Home drive'), null, true), 12, 4);
$hiddenContainer->addElement(new htmlTableExtendedInputCheckbox('sambaSamAccount_hideHomeDrive', false, _('Home drive'), null, false)); $configContainer->add(new htmlResponsiveInputCheckbox('sambaSamAccount_hideHomePath', false, _('Home path'), null, true), 12, 4);
$hiddenContainer->addElement(new htmlOutputText(' ')); $configContainer->add(new htmlResponsiveInputCheckbox('sambaSamAccount_hideProfilePath', false, _('Profile path'), null, true), 12, 4);
$hiddenContainer->addElement(new htmlTableExtendedInputCheckbox('sambaSamAccount_hideHomePath', false, _('Home path'), null, false)); $configContainer->add(new htmlResponsiveInputCheckbox('sambaSamAccount_hideLogonScript', false, _('Logon script'), null, true), 12, 4);
$hiddenContainer->addElement(new htmlOutputText(' ')); $configContainer->add(new htmlResponsiveInputCheckbox('sambaSamAccount_hideSambaPwdLastSet', false, _('Last password change'), null, true), 12, 4);
$hiddenContainer->addElement(new htmlTableExtendedInputCheckbox('sambaSamAccount_hideProfilePath', false, _('Profile path'), null, false)); $configContainer->add(new htmlResponsiveInputCheckbox('sambaSamAccount_hideWorkstations', false, _('Samba workstations'), null, true), 12, 4);
$hiddenContainer->addElement(new htmlOutputText(' ')); $configContainer->add(new htmlResponsiveInputCheckbox('sambaSamAccount_hideLogonHours', false, _('Logon hours'), null, true), 12, 4);
$hiddenContainer->addElement(new htmlTableExtendedInputCheckbox('sambaSamAccount_hideLogonScript', false, _('Logon script'), null, false)); $configContainer->add(new htmlResponsiveInputCheckbox('sambaSamAccount_hideTerminalServer', false, _('Terminal server options'), null, true), 12, 4);
$hiddenContainer->addElement(new htmlOutputText(' ')); $configContainer->add(new htmlOutputText(''), 12, 4);
$hiddenContainer->addElement(new htmlTableExtendedInputCheckbox('sambaSamAccount_hideSambaPwdLastSet', false, _('Last password change'), null, false));
$hiddenContainer->addNewLine();
$hiddenContainer->addElement(new htmlTableExtendedInputCheckbox('sambaSamAccount_hideWorkstations', false, _('Samba workstations'), null, false));
$hiddenContainer->addElement(new htmlOutputText(' '));
$hiddenContainer->addElement(new htmlTableExtendedInputCheckbox('sambaSamAccount_hideLogonHours', false, _('Logon hours'), null, false));
$hiddenContainer->addElement(new htmlOutputText(' '));
$hiddenContainer->addElement(new htmlTableExtendedInputCheckbox('sambaSamAccount_hideTerminalServer', false, _('Terminal server options'), null, false));
$configContainer->addElement($hiddenContainer);
$return[] = $configContainer; $return[] = $configContainer;
return $return; return $return;
} }