support custom label and icon in customFields module

This commit is contained in:
Roland Gruber 2013-09-29 08:08:56 +00:00
parent d738484948
commit c3f42c8e2d
8 changed files with 41 additions and 11 deletions

View File

@ -2,6 +2,7 @@ December 2013 4.4
- allow to set a custom label for each account type
- LAM Pro:
-> Samba/Shadow: display password change date in self service
-> Custom fields: support custom label and icon
25.09.2013 4.3

View File

@ -4050,6 +4050,24 @@ Run slapindex to rebuild the index.
</mediaobject>
</screenshot>
<para><emphasis role="bold">Setting label and icon:</emphasis></para>
<para>You may set the label that is displayed e.g. on the tab when
editing an account. It is also possible to specify an icon (must be a
valid URL like "/images/icon.png" or "http://server/images/icon.png").
The icon size should be 32x32 pixels.</para>
<para>LAM will display a default icon and "Custom fields" as label if
you do not enter any values.</para>
<screenshot>
<mediaobject>
<imageobject>
<imagedata fileref="images/customFields25.png" />
</imageobject>
</mediaobject>
</screenshot>
<para><emphasis role="bold">Defining groups:</emphasis></para>
<para>All input fields are devided into groups. A group may contain one

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -1626,8 +1626,8 @@ abstract class baseModule {
/**
* Returns the path to the module icon.
* The path must be releative to graphics (e.g. key.png). You can also set $this->meta['icon'].
* The preferred size is 32x32px.
* The path must be releative to graphics (e.g. key.png) or an URL (/icons/icon.png or http://server/icon.png).
* You can also set $this->meta['icon']. The preferred size is 32x32px.
*
* @return unknown
*

View File

@ -1073,7 +1073,10 @@ class accountContainer {
$printContainer = true;
$buttonImage = $module->getIcon();
if ($buttonImage != null) {
$moduleContainer->addElement(new htmlImage('../../graphics/' . $buttonImage, null, null, getModuleAlias($name, $this->type)));
if (!(strpos($buttonImage, 'http') === 0) && !(strpos($buttonImage, '/') === 0)) {
$buttonImage = '../../graphics/' . $buttonImage;
}
$moduleContainer->addElement(new htmlImage($buttonImage, null, null, getModuleAlias($name, $this->type)));
}
$moduleContainer->addElement(new htmlTableExtendedInputCheckbox('password_cb_' . $name, true, getModuleAlias($name, $this->type), null, false));
$moduleContainer->addElement(new htmlSpacer('10px', null));
@ -1382,7 +1385,10 @@ class accountContainer {
if ($buttonStatus == 'disabled') echo " disabled";
echo ' onmouseover="jQuery(this).addClass(\'tabs-hover\');" onmouseout="jQuery(this).removeClass(\'tabs-hover\');">';
if ($buttonImage != null) {
echo "<img height=32 width=32 class=\"align-middle\" style=\"padding: 3px;\" alt=\"\" src=\"../../graphics/$buttonImage\">&nbsp;";
if (!(strpos($buttonImage, 'http') === 0) && !(strpos($buttonImage, '/') === 0)) {
$buttonImage = '../../graphics/' . $buttonImage;
}
echo "<img height=32 width=32 class=\"align-middle\" style=\"padding: 3px;\" alt=\"\" src=\"$buttonImage\">&nbsp;";
}
echo $this->module[$this->order[$i]]->get_alias();
echo "&nbsp;</button>\n";

View File

@ -217,7 +217,10 @@ for ($i = 0; $i < sizeof($modules); $i++) {
$module = moduleCache::getModule($modules[$i], 'none');
$iconImage = $module->getIcon();
if ($iconImage != null) {
$icon = '<img align="middle" src="../../graphics/' . $iconImage . '" alt="' . $iconImage . '"> ';
if (!(strpos($iconImage, 'http') === 0) && !(strpos($iconImage, '/') === 0)) {
$iconImage = '../../graphics/' . $iconImage;
}
$icon = '<img align="middle" src="' . $iconImage . '" alt="' . $iconImage . '"> ';
}
echo "<legend>$icon" . getModuleAlias($modules[$i], "none") . "</legend>\n";
$configTypes = parseHtml($modules[$i], $options[$modules[$i]], $old_options, false, $tabindex, 'user');

View File

@ -171,7 +171,10 @@ for ($i = 0; $i < sizeof($types); $i++) {
echo $innerTable->addNewLine();
}
$module = moduleCache::getModule($modules[$m], $types[$i]);
$iconImage = '../graphics/' . $module->getIcon();
$iconImage = $module->getIcon();
if (!is_null($iconImage) && !(strpos($iconImage, 'http') === 0) && !(strpos($iconImage, '/') === 0)) {
$iconImage = '../graphics/' . $iconImage;
}
$innerTable->addElement(new htmlImage($iconImage));
$enabled = true;
if (is_base_module($modules[$m], $types[$i])) {
@ -348,11 +351,10 @@ function showMainPage($scope, $selectedModules) {
continue;
}
$columnContainer->addElement(new htmlSpacer(null, '10px'), true);
$icon = '';
$module = moduleCache::getModule($modules[$m], $scope);
$iconImage = $module->getIcon();
if ($iconImage != null) {
$icon = '../graphics/' . $iconImage;
$icon = $module->getIcon();
if (($icon != null) && !(strpos($icon, 'http') === 0) && !(strpos($icon, '/') === 0)) {
$icon = '../graphics/' . $icon;
}
$moduleTitle = new htmlSubTitle(getModuleAlias($modules[$m], $scope), $icon);
$moduleTitle->colspan = 20;

View File

@ -224,7 +224,7 @@ for ($m = 0; $m < sizeof($modules); $m++) {
if (sizeof($options[$modules[$m]]) < 1) continue;
$module = new $modules[$m]($type);
$icon = $module->getIcon();
if ($icon != null) {
if (($icon != null) && !(strpos($icon, 'http') === 0) && !(strpos($icon, '/') === 0)) {
$icon = '../../graphics/' . $icon;
}
$container = new htmlTable();