responsive account edit page

This commit is contained in:
Roland Gruber 2019-02-23 18:42:21 +01:00
parent 5f32b829b6
commit 34ffbb4f36
7 changed files with 69 additions and 317 deletions

View File

@ -1055,44 +1055,47 @@ class accountContainer {
}
echo "<tr class=\"" . $this->type->getScope() . "-bright\" valign=\"top\"><td style=\"padding: 15px;\">";
// print title bar
echo '<div class="titleBar ui-corner-top">';
echo '<table width="100%"><tr>';
echo '<td><div class="titleBarTitle">';
echo $this->titleBarTitle;
echo '</div></td>';
echo '<td align="right">';
$group = new htmlGroup();
// suffix
$group->addElement(new htmlOutputText(_('Suffix')));
$group->addElement(new htmlSpacer('2px', null));
$suffixList = array();
foreach ($this->getOUs() as $suffix) {
$suffixList[getAbstractDN($suffix)] = $suffix;
}
if (!($this->dnSuffix == '') && !in_array($this->dnSuffix, $this->getOUs())) {
$suffixList[getAbstractDN($this->dnSuffix)] = $this->dnSuffix;
}
$selectedSuffix = array($this->dnSuffix);
$suffixSelect = new htmlSelect('accountContainerSuffix', $suffixList, $selectedSuffix);
$suffixSelect->setHasDescriptiveElements(true);
$suffixSelect->setRightToLeftTextDirection(true);
$group->addElement($suffixSelect);
$group->addElement(new htmlSpacer('10px', null));
// RDN selection
$group->addElement(new htmlOutputText(_('RDN identifier')));
$group->addElement(new htmlSpacer('2px', null));
$rdnlist = getRDNAttributes($this->type->getId());
$group->addElement(new htmlSelect('accountContainerRDN', $rdnlist, array($this->rdn)));
$group->addElement(new htmlHelpLink('301'));
parseHtml(null, $group, array(), true, $tabindex, $this->type->getScope());
echo '</td>';
echo '</tr></table>';
if ($this->titleBarSubtitle != null) {
echo '<div class="titleBarSubtitle">';
echo $this->titleBarSubtitle;
echo '</div>';
$titleBarContainer = new htmlResponsiveRow();
$titleBarContainer->setCSSClasses(array('maxrow'));
$titleBarTitleText = new htmlOutputText($this->titleBarTitle, false);
$titleBarContainer->add(new htmlDiv(null, $titleBarTitleText, array('titleBarTitle', 'text-left')), 12);
$titleBarContainer->addVerticalSpacer('0.5rem');
$titleBarSubtitleText = new htmlOutputText($this->titleBarSubtitle, false);
$titleBarContainer->add(new htmlDiv(null, $titleBarSubtitleText, array('titleBarSubtitle', 'text-left')), 12);
$titleBarContainer->addVerticalSpacer('1rem');
$titleBarSuffixRdn = new htmlResponsiveRow();
// suffix
$suffixList = array();
foreach ($this->getOUs() as $suffix) {
$suffixList[getAbstractDN($suffix)] = $suffix;
}
echo '</div>';
if (!($this->dnSuffix == '') && !in_array($this->dnSuffix, $this->getOUs())) {
$suffixList[getAbstractDN($this->dnSuffix)] = $this->dnSuffix;
}
$selectedSuffix = array($this->dnSuffix);
$suffixGroup = new htmlGroup();
$suffixGroup->addElement(new htmlOutputText(_('Suffix')));
$suffixSelect = new htmlSelect('accountContainerSuffix', $suffixList, $selectedSuffix);
$suffixSelect->setHasDescriptiveElements(true);
$suffixSelect->setRightToLeftTextDirection(true);
$suffixSelect->setCSSClasses(array('auto-width'));
$suffixGroup->addElement($suffixSelect);
$suffixGroup->addElement(new htmlHelpLink('361'));
$titleBarSuffixRdn->add($suffixGroup, 12, 6, 6, 'nowrap maxrow');
// RDN selection
$rdnGroup = new htmlGroup();
$rdnGroup->addElement(new htmlOutputText(_('RDN identifier')));
$rdnlist = getRDNAttributes($this->type->getId());
$rdnSelect = new htmlSelect('accountContainerRDN', $rdnlist, array($this->rdn));
$rdnSelect->setCSSClasses(array('auto-width'));
$rdnGroup->addElement($rdnSelect);
$rdnGroup->addElement(new htmlHelpLink('301'), 1);
$titleBarSuffixRdn->add($rdnGroup, 12, 6, 6, 'nowrap maxrow');
$titleBarContainer->add($titleBarSuffixRdn, 12);
$titleBarDiv = new htmlDiv(null, $titleBarContainer, array('titleBar', 'ui-corner-top'));
parseHtml(null, $titleBarDiv, array(), false, $tabindex, $this->type->getScope());
echo '<div id="lamVerticalTabs" class="ui-tabs ui-widget ui-widget-content ui-corner-bottom ui-helper-clearfix">';
echo '<table>';
echo '<tr><td>';
@ -1298,7 +1301,8 @@ class accountContainer {
* @param int $tabindex tabindex for GUI elements
*/
private function printCommonControls(&$tabindex) {
$table = new htmlTable('100%');
$row = new htmlResponsiveRow();
$row->setCSSClasses(array('maxrow'));
$leftButtonGroup = new htmlGroup();
$leftButtonGroup->alignment = htmlElement::ALIGN_LEFT;
// save button
@ -1322,14 +1326,15 @@ class accountContainer {
. getSecurityTokenName() . '\',\'' . getSecurityTokenValue() . '\');');
$leftButtonGroup->addElement($passwordButton);
}
$table->addElement($leftButtonGroup);
$row->add($leftButtonGroup, 12, 7);
$rightGroup = new htmlGroup();
$rightGroup->alignment = htmlElement::ALIGN_RIGHT;
// profile selection
$profilelist = \LAM\PROFILES\getAccountProfiles($this->type->getId());
if (sizeof($profilelist) > 0) {
$rightGroup->addElement(new htmlSelect('accountContainerSelectLoadProfile', $profilelist, array($this->lastLoadedProfile)));
$profilesSelect = new htmlSelect('accountContainerSelectLoadProfile', $profilelist, array($this->lastLoadedProfile));
$profilesSelect->setCSSClasses(array('auto-width'));
$rightGroup->addElement($profilesSelect);
$profileButton = new htmlButton('accountContainerLoadProfile', _('Load profile'));
$profileButton->setIconClass('loadProfileButton');
if (!$this->isNewAccount) {
@ -1340,9 +1345,9 @@ class accountContainer {
$rightGroup->addElement(new htmlSpacer('1px', null));
$rightGroup->addElement(new htmlHelpLink('401'));
}
$table->addElement($rightGroup);
$row->add($rightGroup, 12, 5, 5, 'text-right');
parseHtml(null, $table, array(), false, $tabindex, $this->type->getScope());
parseHtml(null, $row, array(), false, $tabindex, $this->type->getScope());
}
/**
@ -1366,7 +1371,7 @@ class accountContainer {
if (!empty($_POST)) {
validateSecurityToken();
}
include '../main_header.php';
include '../../lib/adminHeader.inc';
echo '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#inputForm").validationEngine();
@ -1382,7 +1387,7 @@ class accountContainer {
*/
private function printPageFooter() {
echo "</form>\n";
include '../main_footer.php';
include '../../lib/adminFooter.inc';
}
/**

View File

@ -3,7 +3,7 @@
/*
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2005 - 2018 Roland Gruber
Copyright (C) 2005 - 2019 Roland Gruber
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
@ -413,7 +413,7 @@ class user extends baseType {
&& (!$ppolicyAvailable || $ppolicyLocked)
&& (!$windowsAvailable || $windowsLocked || $windowsPasswordLocked);
$container = new htmlTable();
$container = new htmlResponsiveRow();
// show radio buttons for lock/unlock
$radioDisabled = true;
@ -436,16 +436,16 @@ class user extends baseType {
if (!$radioDisabled) {
$radio = new htmlRadio('lam_accountStatusAction', array(_('Lock') => 'lock', _('Unlock') => 'unlock'), $selectedRadio);
$radio->setOnchangeEvent($onchange);
$container->addElement($radio, true);
$container->add($radio, 12);
}
else {
$radio = new htmlRadio('lam_accountStatusActionDisabled', array(_('Lock') => 'lock', _('Unlock') => 'unlock'), $selectedRadio);
$radio->setIsEnabled(false);
$container->addElement($radio, true);
$container->addElement(new htmlHiddenInput('lam_accountStatusAction', $selectedRadio), true);
$container->add($radio, 12);
$container->add(new htmlHiddenInput('lam_accountStatusAction', $selectedRadio), 12);
}
$container->addElement(new htmlHiddenInput('lam_accountStatusResult', 'cancel'), true);
$container->add(new htmlHiddenInput('lam_accountStatusResult', 'cancel'), 12);
// locking part
if (!$fullyLocked) {
@ -484,7 +484,7 @@ class user extends baseType {
if ($fullyLocked || $partiallyLocked) {
$lockDiv->setCSSClasses(array('hidden'));
}
$container->addElement($lockDiv, true);
$container->add($lockDiv, 12);
}
// unlocking part
if ($partiallyLocked) {
@ -527,7 +527,7 @@ class user extends baseType {
if (!$fullyLocked && !$partiallyLocked) {
$unlockDiv->setCSSClasses(array('hidden'));
}
$container->addElement($unlockDiv, true);
$container->add($unlockDiv, 12);
}
$div = new htmlDiv('lam_accountStatusDialog', $container);

View File

@ -2,7 +2,7 @@
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2003 Leonhard Walchshaeusl
Copyright (C) 2005 - 2018 Roland Gruber
Copyright (C) 2005 - 2019 Roland Gruber
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
@ -536,7 +536,7 @@ tr.account {
}
#lamVerticalTabs .ui-tabs-nav li {
margin: 0 -1px .2em 0;
margin: 0 -1px .2em 1 !important;
clear: left;
width: 100%;
border-right-width: 0 !important;
@ -551,7 +551,8 @@ tr.account {
#lamVerticalTabs .ui-tabs-nav {
float: left;
padding: .2em .1em .2em .2em !IMPORTANT;
padding: .2em 0em .2em .2em !IMPORTANT;
border-right: 0px;
}
#lamVerticalTabs .ui-tabs-panel {

View File

@ -1,7 +1,7 @@
/*
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2017 - 2018 Roland Gruber
Copyright (C) 2017 - 2019 Roland Gruber
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
@ -74,6 +74,10 @@ table.padding5 td {
max-width: none;
}
select.auto-width {
width: auto;
}
table.responsive-table {
margin-top: 1rem;
table-layout: fixed;

View File

@ -764,10 +764,10 @@ window.lam.gui = window.lam.gui || {};
* Resizes input fields etc. when they are marked as equally high.
*/
window.lam.gui.equalHeight = function() {
var maxHeight = 0;
var maxHeight = 20;
jQuery('.lamEqualHeightTabContent').each(function() {
if (jQuery(this).height() > maxHeight) {
maxHeight = jQuery(this).height();
maxHeight = jQuery(this).height() + 20;
}
});
jQuery('.lamEqualHeightTabContent').each(function() {

View File

@ -1,34 +0,0 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2010 Roland Gruber
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* Footer part of page which closes the tab content area etc.
*
* @package main
* @author Roland Gruber
*/
?>
</div>
</body>
</html>

View File

@ -1,224 +0,0 @@
<?php
namespace LAM\HEADER;
/*
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2003 - 2018 Roland Gruber
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* Head part of page which includes links to lists etc.
*
* @package main
* @author Roland Gruber
*/
$headerPrefix = "";
if (is_file("../login.php")) $headerPrefix = "../";
elseif (is_file("../../login.php")) $headerPrefix = "../../";
/** tool definitions */
include_once(__DIR__ . "/../lib/tools.inc");
$pro = '';
if (isLAMProVersion()) {
$pro = ' Pro';
}
// HTML header and title
echo $_SESSION['header'];
echo "<link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"" . $headerPrefix . "../graphics/favicon.ico\">\n";
echo "<link rel=\"icon\" href=\"" . $headerPrefix . "../graphics/logo136.png\">\n";
echo "<title>LDAP Account Manager" . $pro . " (" . str_replace(array('ldap://', 'ldaps://'), array('', ''), $_SESSION['config']->get_ServerURL()) . ")</title>\n";
// include all CSS files
$cssDirName = dirname(__FILE__) . '/../style';
$cssDir = dir($cssDirName);
$cssFiles = array();
$cssEntry = $cssDir->read();
while ($cssEntry !== false) {
if (substr($cssEntry, strlen($cssEntry) - 4, 4) == '.css') {
$cssFiles[] = $cssEntry;
}
$cssEntry = $cssDir->read();
}
sort($cssFiles);
foreach ($cssFiles as $cssEntry) {
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . $headerPrefix . "../style/" . $cssEntry . "\">\n";
}
echo "</head><body>\n";
// include all JavaScript files
$jsDirName = dirname(__FILE__) . '/lib';
$jsDir = dir($jsDirName);
$jsFiles = array();
while ($jsEntry = $jsDir->read()) {
if ((substr($jsEntry, strlen($jsEntry) - 3, 3) != '.js') && (substr($jsEntry, strlen($jsEntry) - 4, 4) != '.php')) {
continue;
}
$jsFiles[] = $jsEntry;
}
sort($jsFiles);
foreach ($jsFiles as $jsEntry) {
echo "<script type=\"text/javascript\" src=\"" . $headerPrefix . "lib/" . $jsEntry . "\"></script>\n";
}
// get tool list
$availableTools = getTools();
$toolSettings = $_SESSION['config']->getToolSettings();
// sort tools
$toSort = array();
foreach ($availableTools as $toolClass) {
$myTool = new $toolClass();
if ($myTool->getRequiresWriteAccess() && !checkIfWriteAccessIsAllowed()) {
continue;
}
if ($myTool->getRequiresPasswordChangeRights() && !checkIfPasswordChangeIsAllowed()) {
continue;
}
// check visibility
if (!$myTool->isVisible()) {
continue;
}
// check if hidden by config
$toolName = substr($toolClass, strrpos($toolClass, '\\') + 1);
if (isset($toolSettings['tool_hide_' . $toolName]) && ($toolSettings['tool_hide_' . $toolName] == 'true')) {
continue;
}
$toSort[$toolClass] = $myTool->getPosition();
}
asort($toSort);
$tools = array();
foreach ($toSort as $key => $value) {
$tools[] = new $key();
}
?>
<table border=0 width="100%" class="lamHeader ui-corner-all">
<tr>
<td align="left" height="30" class="nowrap">
<a class="lamLogo" href="http://www.ldap-account-manager.org/" target="new_window">
LDAP Account Manager
<?php
echo $pro . " - " . LAMVersion();
?>
</a>
</td>
<td align="left" height="30" class="nowrap">
<?php
$userData = $_SESSION['ldap']->decrypt_login();
echo '&nbsp;&nbsp;<small title="' . $userData[0] . '">';
printf('(' . _('Logged in as: %s') . ')', extractRDNValue($userData[0]));
$userData = null;
echo '</small>';
?>
</td>
<td align="right" height=30 width="100%">
<ul id="dropmenu" class="dropmenu">
<li><a href="<?php echo $headerPrefix; ?>logout.php" target="_top"><img class="align-middle" height="16" width="16" alt="logout" src="<?php echo $headerPrefix; ?>../graphics/exit.png">&nbsp;<?php echo _("Logout") ?></a></li>
<?php
if (is_dir(dirname(__FILE__) . '/../docs/manual')) {
?>
<li>
<a target="_blank" href="<?php echo $headerPrefix; ?>../docs/manual/index.html"><img class="align-middle" width="16" height="16" alt="help" src="<?php echo $headerPrefix; ?>../graphics/help.png">&nbsp;<?php echo _("Help") ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
</li>
<?php
}
if (sizeof($tools) > 0) {
?>
<li>
<a href="<?php echo $headerPrefix; ?>tools.php"><img class="align-middle" height="16" width="16" alt="tools" src="<?php echo $headerPrefix; ?>../graphics/tools.png">&nbsp;<?php echo _("Tools") ?></a>
<ul>
<?php
foreach ($tools as $tool) {
$subTools = $tool->getSubTools();
echo '<li title="' . $tool->getDescription() . '">';
$link = $headerPrefix . $tool->getLink();
echo '<a href="' . $link . "\">\n";
echo '<img height="16" width="16" alt="" src="' . $headerPrefix . '../graphics/' . $tool->getImageLink() . '"> ' . $tool->getName();
echo "</a>\n";
if (sizeof($subTools) > 0) {
echo "<ul>\n";
foreach ($subTools as $subTool) {
echo "<li title=\"" . $subTool->description . "\">\n";
echo "<a href=\"" . $headerPrefix . $subTool->link . "\">\n";
echo '<img width=16 height=16 alt="" src="' . $headerPrefix . '../graphics/' . $subTool->image . '"> ' . $subTool->name;
echo "</a>\n";
echo "</li>\n";
}
echo "</ul>\n";
}
echo "</li>\n";
}
?>
</ul>
</li>
<?php
}
if ($_SESSION['config']->get_Suffix('tree') != "") {
?>
<li>
<a href="<?php echo $headerPrefix; ?>tree/treeViewContainer.php"><img class="align-middle" height="16" width="16" alt="tree" src="<?php echo $headerPrefix; ?>../graphics/process.png">&nbsp;<?php echo _("Tree view") ?></a>
</li>
<?php
}
?>
</ul>
</td>
</tr>
</table>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#dropmenu').dropmenu({
effect : 'slide',
nbsp : true,
timeout : 350,
speed : 'fast'
});
});
</script>
<br>
<div class="ui-tabs ui-corner-all ui-widget ui-widget-content">
<ul class="ui-tabs-nav ui-corner-all ui-helper-reset ui-helper-clearfix ui-widget-header">
<?php
printTypeTabs($headerPrefix);
?>
</ul>
<?php
function printTypeTabs($headerPrefix) {
$typeManager = new \LAM\TYPES\TypeManager();
$types = $typeManager->getConfiguredTypes();
foreach ($types as $type) {
if ($type->isHidden()) {
continue;
}
$link = '<a class="ui-tabs-anchor" href="' . $headerPrefix . 'lists/list.php?type=' . $type->getId() .
'" onmouseover="jQuery(this).addClass(\'tabs-hover\');" onmouseout="jQuery(this).removeClass(\'tabs-hover\');">' .
'<img height="16" width="16" alt="' . $type->getId() . '" src="' . $headerPrefix . '../graphics/' . $type->getIcon() . '">&nbsp;' .
$type->getAlias() . '</a>';
echo '<li id="tab_' . $type->getId() . '" class="ui-tabs-tab ui-corner-top ui-state-default ui-tab">';
echo $link;
echo "</li>\n";
}
}