diff --git a/lam/HISTORY b/lam/HISTORY index 06fcfb68..568fcf4f 100644 --- a/lam/HISTORY +++ b/lam/HISTORY @@ -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 diff --git a/lam/docs/manual-sources/chapter-selfService.xml b/lam/docs/manual-sources/chapter-selfService.xml index a52223e9..ad73d464 100644 --- a/lam/docs/manual-sources/chapter-selfService.xml +++ b/lam/docs/manual-sources/chapter-selfService.xml @@ -241,6 +241,13 @@ code is permitted. + + Base color + + Here you can change the background color for the user + pages. + + Additional CSS links diff --git a/lam/help/help.inc b/lam/help/help.inc index c9d29e82..516f2a75 100644 --- a/lam/help/help.inc +++ b/lam/help/help.inc @@ -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"), diff --git a/lam/lib/html.inc b/lam/lib/html.inc index 648d619a..a947f903 100644 --- a/lam/lib/html.inc +++ b/lam/lib/html.inc @@ -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 ''; + 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. * diff --git a/lam/lib/selfService.inc b/lam/lib/selfService.inc index 422a2ebe..5c79ebd5 100644 --- a/lam/lib/selfService.inc +++ b/lam/lib/selfService.inc @@ -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 = '

'; $this->additionalCSS = ''; + $this->baseColor = '#fffde2'; $this->loginCaption = '' . _("Welcome to LAM self service. Please enter your user name and password.") . ''; $this->loginAttributeText = _('User name'); $this->passwordLabel = '';