color for self service

This commit is contained in:
Roland Gruber 2018-10-22 21:11:31 +02:00
parent a804f94d6f
commit 1b198403d7
5 changed files with 136 additions and 0 deletions

View File

@ -2,6 +2,8 @@ December 2018 6.6
- New import/export in tools menu
- YubiKey support
- Windows users: manage "departmentNumber" (needs to be activated via LAM server profile)
- LAM Pro:
-> Easy setting of background color in self service profile
25.09.2018 6.5

View File

@ -241,6 +241,13 @@
code is permitted.</entry>
</row>
<row>
<entry>Base color</entry>
<entry>Here you can change the background color for the user
pages.</entry>
</row>
<row>
<entry>Additional CSS links</entry>

View File

@ -309,6 +309,8 @@ $helpArray = array (
"Text" => _('Please enter the site and secret key you got from Google reCAPTCHA.')),
"522" => array ("Headline" => _('Secure login'),
"Text" => _('Protect the self service login with a captcha.')),
"523" => array ("Headline" => _('Base color'),
"Text" => _('Background color for self service pages.')),
"550" => array ("Headline" => _("From address"),
"Text" => _("This email address will be set as sender address of all password mails. If empty the system default (php.ini) will be used.")),
"551" => array ("Headline" => _("Subject"),

View File

@ -2656,6 +2656,127 @@ class htmlTableExtendedInputTextarea extends htmlInputTextarea {
}
/**
* Prints the HTML code for a color picker field.
*
* @package metaHTML
*/
class htmlInputColorPicker extends htmlElement {
/** unique name of input element */
private $name;
/** color value */
private $color;
/** enabled or disabled */
private $isEnabled = true;
/**
* Constructor.
*
* @param string $name unique name
* @param string $colorValue color value (e.g. #000000)
*/
public function __construct($name, $colorValue = '#000000') {
$this->name = htmlspecialchars($name);
$this->color = htmlspecialchars($colorValue);
}
/**
* {@inheritDoc}
* @see htmlElement::generateHTML()
*/
public function generateHTML($module, $input, $values, $restricted, &$tabindex, $scope) {
$tabindexValue = ' tabindex="' . $tabindex . '"';
$tabindex++;
$disabled = '';
if (!$this->isEnabled) {
$disabled = ' disabled';
}
echo '<input type="color" value="' . $this->color . '" id="' . $this->name . '" name="' . $this->name . '"' . $tabindexValue . $disabled . '>';
return array($this->name => 'file');
}
/**
* Specifies if this component is enabled and accepts user modification.
*
* @param boolean $isEnabled enabled if true
*/
public function setIsEnabled($isEnabled) {
$this->isEnabled = $isEnabled;
}
}
/**
* Color picker with descriptive label and help link.
*
* @package metaHTML
*/
class htmlResponsiveInputColorPicker extends htmlInputColorPicker {
/** descriptive label */
private $label;
/** help ID */
private $helpID;
/** help module */
private $helpModule = null;
/** render HTML of parent class */
private $renderParentHtml = false;
/**
* Constructor.
*
* @param string $name unique name
* @param string $colorValue color value (e.g. #000000)
* @param string $label descriptive label
* @param string $helpID help ID
*/
public function __construct($name, $colorValue, $label, $helpID = null) {
parent::__construct($name, $colorValue);
$this->label = htmlspecialchars($label);
if (is_string($helpID)) {
$this->helpID = $helpID;
}
elseif (is_array($helpID)) {
$this->helpID = $helpID[0];
$this->helpModule = $helpID[1];
}
}
/**
* {@inheritDoc}
* @see htmlInputColorPicker::generateHTML()
*/
public function generateHTML($module, $input, $values, $restricted, &$tabindex, $scope) {
if ($this->renderParentHtml) {
return parent::generateHTML($module, $input, $values, $restricted, $tabindex, $scope);
}
// HTML of parent class is rendered on second call (done by htmlResponsiveRow)
$this->renderParentHtml = true;
$row = new htmlResponsiveRow();
// label text
$labelGroup = new htmlGroup();
$labelGroup->addElement(new htmlOutputText($this->label));
if (!empty($this->helpID)) {
$helpLinkLabel = new htmlHelpLink($this->helpID, $this->helpModule);
$helpLinkLabel->setCSSClasses(array('hide-on-tablet', 'margin-left5'));
$labelGroup->addElement($helpLinkLabel);
}
$row->add($labelGroup, 12, 6, 6, 'responsiveLabel');
// input field
$fieldGroup = new htmlGroup();
$fieldGroup->addElement($this);
if (!empty($this->helpID)) {
$helpLinkField = new htmlHelpLink($this->helpID, $this->helpModule);
$helpLinkField->setCSSClasses(array('hide-on-mobile'));
$fieldGroup->addElement($helpLinkField);
}
$row->add($fieldGroup, 12, 6, 6, 'responsiveField nowrap');
return $row->generateHTML($module, $input, $values, $restricted, $tabindex, $scope);
}
}
/**
* Prints the HTML code for an image.
*

View File

@ -335,6 +335,9 @@ class selfServiceProfile {
/** header for self service pages */
public $pageHeader;
/** base color */
public $baseColor = '#fffde2';
/** list of additional CSS links (separated by \n) */
public $additionalCSS;
@ -416,6 +419,7 @@ class selfServiceProfile {
$this->httpAuthentication = false;
$this->pageHeader = '<table border=0 width="100%" class="lamHeader ui-corner-all"><tr><td align="left" height="30"><a class="lamLogo" href="http://www.ldap-account-manager.org/" target="new_window">LDAP Account Manager</a></td></tr></table><br>';
$this->additionalCSS = '';
$this->baseColor = '#fffde2';
$this->loginCaption = '<b>' . _("Welcome to LAM self service. Please enter your user name and password.") . '</b>';
$this->loginAttributeText = _('User name');
$this->passwordLabel = '';