responsive

This commit is contained in:
Roland Gruber 2019-11-02 11:35:54 +01:00
parent cbff63567c
commit 75ce322789
4 changed files with 91 additions and 60 deletions

View File

@ -4549,6 +4549,8 @@ class htmlResponsiveSelect extends htmlSelect {
private $helpModule = null; private $helpModule = null;
/** render HTML of parent class */ /** render HTML of parent class */
private $renderParentHtml = false; private $renderParentHtml = false;
/** short label */
private $shortLabel = false;
/** /**
* Constructor. * Constructor.
@ -4591,7 +4593,8 @@ class htmlResponsiveSelect extends htmlSelect {
$helpLinkLabel->setCSSClasses(array('hide-on-tablet', 'margin-left5')); $helpLinkLabel->setCSSClasses(array('hide-on-tablet', 'margin-left5'));
$labelGroup->addElement($helpLinkLabel); $labelGroup->addElement($helpLinkLabel);
} }
$row->add($labelGroup, 12, 6, 6, 'responsiveLabel'); $tabletDesktopLabelColumns = $this->shortLabel ? 4 : 6;
$row->add($labelGroup, 12, $tabletDesktopLabelColumns, $tabletDesktopLabelColumns, 'responsiveLabel');
// input field // input field
$fieldGroup = new htmlGroup(); $fieldGroup = new htmlGroup();
$fieldGroup->addElement($this); $fieldGroup->addElement($this);
@ -4600,7 +4603,8 @@ class htmlResponsiveSelect extends htmlSelect {
$helpLink->setCSSClasses(array('hide-on-mobile')); $helpLink->setCSSClasses(array('hide-on-mobile'));
$fieldGroup->addElement($helpLink); $fieldGroup->addElement($helpLink);
} }
$row->add($fieldGroup, 12, 6, 6, 'responsiveField nowrap'); $tabletDesktopFieldColumns = $this->shortLabel ? 8 : 6;
$row->add($fieldGroup, 12, $tabletDesktopFieldColumns, $tabletDesktopFieldColumns, 'responsiveField nowrap');
return $row->generateHTML($module, $input, $values, $restricted, $tabindex, $scope); return $row->generateHTML($module, $input, $values, $restricted, $tabindex, $scope);
} }
@ -4612,6 +4616,13 @@ class htmlResponsiveSelect extends htmlSelect {
return '.row'; return '.row';
} }
/**
* Use a short label (4 columns instead of 6) for tablet/desktop.
*/
public function setShortLabel() {
$this->shortLabel = true;
}
} }
/** /**

View File

@ -1069,11 +1069,13 @@ class accountContainer {
$suffixSelect = new htmlResponsiveSelect('accountContainerSuffix', $suffixList, $selectedSuffix, _('Suffix')); $suffixSelect = new htmlResponsiveSelect('accountContainerSuffix', $suffixList, $selectedSuffix, _('Suffix'));
$suffixSelect->setHasDescriptiveElements(true); $suffixSelect->setHasDescriptiveElements(true);
$suffixSelect->setRightToLeftTextDirection(true); $suffixSelect->setRightToLeftTextDirection(true);
$titleBarSuffixRdn->add($suffixSelect, 12, 12, 8); $suffixSelect->setShortLabel();
$titleBarSuffixRdn->add($suffixSelect, 12, 12, 7);
// RDN selection // RDN selection
$rdnlist = getRDNAttributes($this->type->getId()); $rdnlist = getRDNAttributes($this->type->getId());
$rdnSelect = new htmlResponsiveSelect('accountContainerRDN', $rdnlist, array($this->rdn), _('RDN identifier'), '400'); $rdnSelect = new htmlResponsiveSelect('accountContainerRDN', $rdnlist, array($this->rdn), _('RDN identifier'), '400');
$titleBarSuffixRdn->add($rdnSelect, 12, 12, 4); $rdnSelect->setShortLabel();
$titleBarSuffixRdn->add($rdnSelect, 12, 12, 5);
$titleBarContainer->add($titleBarSuffixRdn, 12); $titleBarContainer->add($titleBarSuffixRdn, 12);
$titleBarDiv = new htmlDiv(null, $titleBarContainer, array('titleBar', 'ui-corner-top')); $titleBarDiv = new htmlDiv(null, $titleBarContainer, array('titleBar', 'ui-corner-top'));

View File

@ -1068,12 +1068,12 @@ class sambaSamAccount extends baseModule implements passwordService {
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_attributes() { function display_html_attributes() {
$return = new htmlTable(); $return = new htmlResponsiveRow();
if ($this->isExtensionEnabled()) { if ($this->isExtensionEnabled()) {
if ($this->get_scope() == "host") { if ($this->get_scope() == "host") {
$attrs = $this->getAccountContainer()->getAccountModule('posixAccount')->getAttributes(); $attrs = $this->getAccountContainer()->getAccountModule('posixAccount')->getAttributes();
if (substr($attrs['uid'][0], -1, 1) != '$') { if (substr($attrs['uid'][0], -1, 1) != '$') {
$return->addElement(new htmlStatusMessage("ERROR", _('Host name must end with $!'), _('Please check your settings on the Unix page!')), true); $return->add(new htmlStatusMessage("ERROR", _('Host name must end with $!'), _('Please check your settings on the Unix page!')), 12);
} }
} }
$personalAttributes = array(); $personalAttributes = array();
@ -1083,7 +1083,7 @@ class sambaSamAccount extends baseModule implements passwordService {
// Get Domain SID from user SID // Get Domain SID from user SID
$sambaDomains = $this->getDomains(); $sambaDomains = $this->getDomains();
if (sizeof($sambaDomains) == 0) { if (sizeof($sambaDomains) == 0) {
$return->addElement(new htmlStatusMessage("ERROR", _('No Samba 3 domains found in LDAP! Please create one first.')), true); $return->add(new htmlStatusMessage("ERROR", _('No Samba 3 domains found in LDAP! Please create one first.')), 12);
return $return; return $return;
} }
if (isset($this->attributes['sambaSID'][0]) && $this->attributes['sambaSID'][0] != '') { if (isset($this->attributes['sambaSID'][0]) && $this->attributes['sambaSID'][0] != '') {
@ -1118,24 +1118,24 @@ class sambaSamAccount extends baseModule implements passwordService {
$displayName = $personalAttributes['sn'][0]; $displayName = $personalAttributes['sn'][0];
} }
} }
$return->addElement(new htmlTableExtendedInputField(_('Display name'), 'displayName', $displayName, 'displayName'), true); $return->add(new htmlResponsiveInputField(_('Display name'), 'displayName', $displayName, 'displayName'), 12);
if ($this->get_scope()=='user') { if ($this->get_scope()=='user') {
// user account // user account
$return->addElement(new htmlHiddenInput('sambaAcctFlagsU', 'true'), true); $return->add(new htmlHiddenInput('sambaAcctFlagsU', 'true'), 12);
// no password // no password
$return->addElement(new htmlTableExtendedInputCheckbox('sambaAcctFlagsN', $this->nopwd, _('Use no password'), 'noPassword'), true); $return->add(new htmlResponsiveInputCheckbox('sambaAcctFlagsN', $this->nopwd, _('Use no password'), 'noPassword'), 12);
// no password expiry // no password expiry
$return->addElement(new htmlTableExtendedInputCheckbox('sambaAcctFlagsX', $this->noexpire, _('Password does not expire'), 'noExpire'), true); $return->add(new htmlResponsiveInputCheckbox('sambaAcctFlagsX', $this->noexpire, _('Password does not expire'), 'noExpire'), 12);
// account deactivated // account deactivated
$return->addElement(new htmlTableExtendedInputCheckbox('sambaAcctFlagsD', $this->deactivated, _('Account is deactivated'), 'deactivated'), true); $return->add(new htmlResponsiveInputCheckbox('sambaAcctFlagsD', $this->deactivated, _('Account is deactivated'), 'deactivated'), 12);
// account locked // account locked
$locked = false; $locked = false;
if (isset($this->attributes['sambaAcctFlags'][0]) && (strpos($this->attributes['sambaAcctFlags'][0], "L") !== false)) { if (isset($this->attributes['sambaAcctFlags'][0]) && (strpos($this->attributes['sambaAcctFlags'][0], "L") !== false)) {
$locked = true; $locked = true;
} }
$return->addElement(new htmlTableExtendedInputCheckbox('sambaAcctFlagsL', $locked, _('Account is locked'), 'locked'), true); $return->add(new htmlResponsiveInputCheckbox('sambaAcctFlagsL', $locked, _('Account is locked'), 'locked'), 12);
// password change at next login // password change at next login
$return->addElement(new htmlTableExtendedInputCheckbox('forcePasswordChangeOption', $this->expirePassword, _('Password change at next login'), 'passwordIsExpired'), true); $return->add(new htmlResponsiveInputCheckbox('forcePasswordChangeOption', $this->expirePassword, _('Password change at next login'), 'passwordIsExpired'), 12);
// last password change // last password change
if (!$this->isBooleanConfigOptionSet('sambaSamAccount_hideSambaPwdLastSet')) { if (!$this->isBooleanConfigOptionSet('sambaSamAccount_hideSambaPwdLastSet')) {
$sambaPwdLastSet = ''; $sambaPwdLastSet = '';
@ -1144,31 +1144,36 @@ class sambaSamAccount extends baseModule implements passwordService {
$time->setTimezone(getTimeZone()); $time->setTimezone(getTimeZone());
$sambaPwdLastSet = $time->format('d.m.Y H:i'); $sambaPwdLastSet = $time->format('d.m.Y H:i');
} }
$return->addElement(new htmlOutputText(_('Last password change'))); $return->addLabel(new htmlOutputText(_('Last password change')));
$return->addElement(new htmlOutputText($sambaPwdLastSet)); $sambaPwdLastSetGroup = new htmlGroup();
$return->addElement(new htmlHelpLink('sambaPwdLastSet'), true); $sambaPwdLastSetGroup->addElement(new htmlOutputText($sambaPwdLastSet));
$sambaPwdLastSetGroup->addElement(new htmlHelpLink('sambaPwdLastSet'));
$return->addField($sambaPwdLastSetGroup);
} }
// password can be changed // password can be changed
$return->addElement(new htmlOutputText(_('User can change password'))); $return->addLabel(new htmlOutputText(_('User can change password')));
$tempTable = new htmlTable(); $pwdCanChangeGroup = new htmlGroup();
$tempTable->addElement(new htmlOutputText($this->getPasswordCanChangeTime($sambaDomains, $sel_domain), false)); $pwdCanChangeGroup->addElement(new htmlOutputText($this->getPasswordCanChangeTime($sambaDomains, $sel_domain), false));
$return->addElement($tempTable); $pwdCanChangeGroup->addElement(new htmlSpacer('0.5rem', null));
$return->addElement(new htmlHelpLink('pwdCanChange'), true); $pwdCanChangeGroup->addElement(new htmlHelpLink('pwdCanChange'));
$return->addField($pwdCanChangeGroup);
// password must be changed // password must be changed
$return->addElement(new htmlOutputText(_('User must change password'))); $return->addLabel(new htmlOutputText(_('User must change password')));
$tempTable = new htmlTable(); $pwdMustChangeGroup = new htmlGroup();
$tempTable->addElement(new htmlOutputText($this->getPasswordMustChangeTime($sambaDomains, $sel_domain), false)); $pwdMustChangeGroup->addElement(new htmlOutputText($this->getPasswordMustChangeTime($sambaDomains, $sel_domain), false));
$return->addElement($tempTable); $pwdMustChangeGroup->addElement(new htmlSpacer('0.5rem', null));
$return->addElement(new htmlHelpLink('pwdMustChange'), true); $pwdMustChangeGroup->addElement(new htmlHelpLink('pwdMustChange'));
$return->addField($pwdMustChangeGroup);
// account expiration time // account expiration time
$dateValue = $this->formatAccountExpirationDate(); $dateValue = $this->formatAccountExpirationDate();
$return->addElement(new htmlOutputText(_('Account expiration date'))); $return->addLabel(new htmlOutputText(_('Account expiration date')));
$tempTable = new htmlTable(); $expireDateGroup = new htmlGroup();
$tempTable->addElement(new htmlOutputText($dateValue, false)); $expireDateGroup->addElement(new htmlOutputText($dateValue, false));
$tempTable->addSpace('5px'); $expireDateGroup->addElement(new htmlSpacer('0.5rem', null));
$tempTable->addElement(new htmlAccountPageButton(get_class($this), 'time', 'sambaKickoffTime', _('Change'))); $expireDateGroup->addElement(new htmlAccountPageButton(get_class($this), 'time', 'sambaKickoffTime', _('Change')));
$return->addElement($tempTable); $expireDateGroup->addElement(new htmlSpacer('0.5rem', null));
$return->addElement(new htmlHelpLink('expireDate'), true); $expireDateGroup->addElement(new htmlHelpLink('expireDate'), true);
$return->addField($expireDateGroup);
// home drive // home drive
if (!$this->isBooleanConfigOptionSet('sambaSamAccount_hideHomeDrive')) { if (!$this->isBooleanConfigOptionSet('sambaSamAccount_hideHomeDrive')) {
$drives = array('-'); $drives = array('-');
@ -1181,7 +1186,7 @@ class sambaSamAccount extends baseModule implements passwordService {
else { else {
$selected = array('-'); $selected = array('-');
} }
$return->addElement(new htmlTableExtendedSelect('sambaHomeDrive', $drives, $selected, _('Home drive'), 'homeDrive'), true); $return->add(new htmlResponsiveSelect('sambaHomeDrive', $drives, $selected, _('Home drive'), 'homeDrive'), 12);
} }
// home path // home path
if (!$this->isBooleanConfigOptionSet('sambaSamAccount_hideHomePath')) { if (!$this->isBooleanConfigOptionSet('sambaSamAccount_hideHomePath')) {
@ -1189,14 +1194,15 @@ class sambaSamAccount extends baseModule implements passwordService {
if (isset($this->attributes['sambaHomePath'][0])) { if (isset($this->attributes['sambaHomePath'][0])) {
$sambaHomePath = $this->attributes['sambaHomePath'][0]; $sambaHomePath = $this->attributes['sambaHomePath'][0];
} }
$return->addElement(new htmlTableExtendedInputField(_('Home path'), 'sambaHomePath', $sambaHomePath, 'homePath'), true); $return->add(new htmlResponsiveInputField(_('Home path'), 'sambaHomePath', $sambaHomePath, 'homePath'), 12);
} }
// profile path
if (!$this->isBooleanConfigOptionSet('sambaSamAccount_hideProfilePath')) { if (!$this->isBooleanConfigOptionSet('sambaSamAccount_hideProfilePath')) {
$sambaProfilePath = ''; $sambaProfilePath = '';
if (isset($this->attributes['sambaProfilePath'][0])) { if (isset($this->attributes['sambaProfilePath'][0])) {
$sambaProfilePath = $this->attributes['sambaProfilePath'][0]; $sambaProfilePath = $this->attributes['sambaProfilePath'][0];
} }
$return->addElement(new htmlOutputText(_('Profile path'))); $return->addLabel(new htmlOutputText(_('Profile path')));
$sambaProfilePathGroup = new htmlGroup(); $sambaProfilePathGroup = new htmlGroup();
$sambaProfilePathGroup->addElement(new htmlInputField('sambaProfilePath', $sambaProfilePath)); $sambaProfilePathGroup->addElement(new htmlInputField('sambaProfilePath', $sambaProfilePath));
if (($_SESSION['config']->get_scriptPath() != null) && ($_SESSION['config']->get_scriptPath() != '')) { if (($_SESSION['config']->get_scriptPath() != null) && ($_SESSION['config']->get_scriptPath() != '')) {
@ -1206,8 +1212,8 @@ class sambaSamAccount extends baseModule implements passwordService {
$sambaProfilePathGroup->addElement($sambaProfilePathButton); $sambaProfilePathGroup->addElement($sambaProfilePathButton);
} }
} }
$return->addElement($sambaProfilePathGroup); $sambaProfilePathGroup->addElement(new htmlHelpLink('profilePath'));
$return->addElement(new htmlHelpLink('profilePath'), true); $return->addField($sambaProfilePathGroup);
} }
// logon script // logon script
if (!$this->isBooleanConfigOptionSet('sambaSamAccount_hideLogonScript')) { if (!$this->isBooleanConfigOptionSet('sambaSamAccount_hideLogonScript')) {
@ -1215,12 +1221,15 @@ class sambaSamAccount extends baseModule implements passwordService {
if (isset($this->attributes['sambaLogonScript'][0])) { if (isset($this->attributes['sambaLogonScript'][0])) {
$sambaLogonScript = $this->attributes['sambaLogonScript'][0]; $sambaLogonScript = $this->attributes['sambaLogonScript'][0];
} }
$return->addElement(new htmlTableExtendedInputField(_('Logon script'), 'sambaLogonScript', $sambaLogonScript, 'scriptPath'), true); $return->add(new htmlResponsiveInputField(_('Logon script'), 'sambaLogonScript', $sambaLogonScript, 'scriptPath'), 12);
} }
if (!$this->isBooleanConfigOptionSet('sambaSamAccount_hideWorkstations')) { if (!$this->isBooleanConfigOptionSet('sambaSamAccount_hideWorkstations')) {
$return->addElement(new htmlOutputText(_('Samba workstations'))); $return->addLabel(new htmlOutputText(_('Samba workstations')));
$return->addElement(new htmlAccountPageButton(get_class($this), 'sambaUserWorkstations', 'open', _('Edit workstations'))); $userWorkstationsGroup = new htmlGroup();
$return->addElement(new htmlHelpLink('userWorkstations'), true); $userWorkstationsGroup->addElement(new htmlAccountPageButton(get_class($this), 'sambaUserWorkstations', 'open', _('Edit workstations')));
$userWorkstationsGroup->addElement(new htmlSpacer('0.5rem', null));
$userWorkstationsGroup->addElement(new htmlHelpLink('userWorkstations'));
$return->addField($userWorkstationsGroup);
} }
// Windows group // Windows group
$names = array_keys($this->groupRids); $names = array_keys($this->groupRids);
@ -1239,7 +1248,7 @@ class sambaSamAccount extends baseModule implements passwordService {
if (!$wrid) { if (!$wrid) {
$selected[] = $this->getGroupName($attrs['gidNumber'][0]); $selected[] = $this->getGroupName($attrs['gidNumber'][0]);
} }
$return->addElement(new htmlTableExtendedSelect('sambaPrimaryGroupSID', $options, $selected, _('Windows group'), 'group'), true); $return->add(new htmlResponsiveSelect('sambaPrimaryGroupSID', $options, $selected, _('Windows group'), 'group'), 12);
// display if group SID should be mapped to a well known SID // display if group SID should be mapped to a well known SID
$options = array_keys($this->userRids); $options = array_keys($this->userRids);
$options[] = '-'; $options[] = '-';
@ -1257,41 +1266,49 @@ class sambaSamAccount extends baseModule implements passwordService {
else { else {
$selected[] = "-"; $selected[] = "-";
} }
$return->addElement(new htmlTableExtendedSelect('sambaSID', $options, $selected, _('Special user'), 'specialUser'), true); $return->add(new htmlResponsiveSelect('sambaSID', $options, $selected, _('Special user'), 'specialUser'), 12);
} }
// domain // domain
$return->addElement(new htmlTableExtendedSelect('sambaDomainName', $sambaDomainNames, $sel_domain, _('Domain'), 'domain'), true); $return->add(new htmlResponsiveSelect('sambaDomainName', $sambaDomainNames, $sel_domain, _('Domain'), 'domain'), 12);
// logon hours and terminal server options // logon hours and terminal server options
if ($this->get_scope()=='user') { if ($this->get_scope()=='user') {
if (!$this->isBooleanConfigOptionSet('sambaSamAccount_hideLogonHours')) { if (!$this->isBooleanConfigOptionSet('sambaSamAccount_hideLogonHours')) {
$return->addElement(new htmlOutputText(_('Logon hours'))); $return->addLabel(new htmlOutputText(_('Logon hours')));
$return->addElement(new htmlAccountPageButton(get_class($this), 'logonHours', 'open', _('Edit'))); $logonHoursGroup = new htmlGroup();
$return->addElement(new htmlHelpLink('logonHours'), true); $logonHoursGroup->addElement(new htmlAccountPageButton(get_class($this), 'logonHours', 'open', _('Edit')));
$logonHoursGroup->addElement(new htmlSpacer('0.5rem', null));
$logonHoursGroup->addElement(new htmlHelpLink('logonHours'));
$return->addField($logonHoursGroup);
} }
if (!$this->isBooleanConfigOptionSet('sambaSamAccount_hideTerminalServer')) { if (!$this->isBooleanConfigOptionSet('sambaSamAccount_hideTerminalServer')) {
$return->addElement(new htmlOutputText(_('Terminal server options'))); $return->addLabel(new htmlOutputText(_('Terminal server options')));
$return->addElement(new htmlAccountPageButton(get_class($this), 'terminalServer', 'open', _('Edit'))); $terminalServerGroup = new htmlGroup();
$return->addElement(new htmlHelpLink('terminalServer'), true); $terminalServerGroup->addElement(new htmlAccountPageButton(get_class($this), 'terminalServer', 'open', _('Edit')));
$terminalServerGroup->addElement(new htmlSpacer('0.5rem', null));
$terminalServerGroup->addElement(new htmlHelpLink('terminalServer'));
$return->addField($terminalServerGroup);
} }
} }
// reset host password // reset host password
if ($this->get_scope()=='host') { if ($this->get_scope()=='host') {
// host account // host account
$return->addElement(new htmlHiddenInput('sambaAcctFlagsW', 'true'), true); $return->add(new htmlHiddenInput('sambaAcctFlagsW', 'true'), 12);
// password reset // password reset
$return->addElement(new htmlOutputText(_('Reset password'))); $return->addLabel(new htmlOutputText(_('Reset password')));
$return->addElement(new htmlButton('ResetSambaPassword', _('Reset'))); $resetPasswordGroup = new htmlGroup();
$return->addElement(new htmlHelpLink('resetPassword'), true); $resetPasswordGroup->addElement(new htmlButton('ResetSambaPassword', _('Reset')));
$resetPasswordGroup->addElement(new htmlSpacer('0.5rem', null));
$resetPasswordGroup->addElement(new htmlHelpLink('resetPassword'));
$return->addField($resetPasswordGroup);
} }
$return->addElement(new htmlSpacer(null, '10px'), true); $return->addVerticalSpacer('2rem');
$remButton = new htmlButton('remObjectClass', _('Remove Samba 3 extension')); $remButton = new htmlButton('remObjectClass', _('Remove Samba 3 extension'));
$remButton->colspan = 3; $return->add($remButton, 12, 12, 12, 'text-center');
$return->addElement($remButton);
} }
else { else {
$return->addElement(new htmlButton('addObjectClass', _('Add Samba 3 extension'))); $return->add(new htmlButton('addObjectClass', _('Add Samba 3 extension')), 12);
} }
return $return; return $return;
} }

View File

@ -84,6 +84,7 @@ table.padding5 td {
.module-content-row>.row { .module-content-row>.row {
max-width: 80rem; max-width: 80rem;
display: inline-block;
} }
select.auto-width { select.auto-width {