diff --git a/lam/HISTORY b/lam/HISTORY
index fa88b0a2..482d5a4c 100644
--- a/lam/HISTORY
+++ b/lam/HISTORY
@@ -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
diff --git a/lam/docs/manual-sources/howto.xml b/lam/docs/manual-sources/howto.xml
index cfb1c92d..922ad8e3 100644
--- a/lam/docs/manual-sources/howto.xml
+++ b/lam/docs/manual-sources/howto.xml
@@ -4050,6 +4050,24 @@ Run slapindex to rebuild the index.
+ Setting label and icon:
+
+ 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.
+
+ LAM will display a default icon and "Custom fields" as label if
+ you do not enter any values.
+
+
+
+
+
+
+
+
+
Defining groups:
All input fields are devided into groups. A group may contain one
diff --git a/lam/docs/manual-sources/images/customFields25.png b/lam/docs/manual-sources/images/customFields25.png
new file mode 100644
index 00000000..fa6536b8
Binary files /dev/null and b/lam/docs/manual-sources/images/customFields25.png differ
diff --git a/lam/lib/baseModule.inc b/lam/lib/baseModule.inc
index f1e27adf..5afaeb2f 100644
--- a/lam/lib/baseModule.inc
+++ b/lam/lib/baseModule.inc
@@ -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
*
diff --git a/lam/lib/modules.inc b/lam/lib/modules.inc
index 5688fca9..3de54cec 100644
--- a/lam/lib/modules.inc
+++ b/lam/lib/modules.inc
@@ -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 " ";
+ if (!(strpos($buttonImage, 'http') === 0) && !(strpos($buttonImage, '/') === 0)) {
+ $buttonImage = '../../graphics/' . $buttonImage;
+ }
+ echo " ";
}
echo $this->module[$this->order[$i]]->get_alias();
echo " \n";
diff --git a/lam/templates/config/moduleSettings.php b/lam/templates/config/moduleSettings.php
index d5943efc..7432fcb6 100644
--- a/lam/templates/config/moduleSettings.php
+++ b/lam/templates/config/moduleSettings.php
@@ -217,7 +217,10 @@ for ($i = 0; $i < sizeof($modules); $i++) {
$module = moduleCache::getModule($modules[$i], 'none');
$iconImage = $module->getIcon();
if ($iconImage != null) {
- $icon = ' ';
+ if (!(strpos($iconImage, 'http') === 0) && !(strpos($iconImage, '/') === 0)) {
+ $iconImage = '../../graphics/' . $iconImage;
+ }
+ $icon = ' ';
}
echo "\n";
$configTypes = parseHtml($modules[$i], $options[$modules[$i]], $old_options, false, $tabindex, 'user');
diff --git a/lam/templates/masscreate.php b/lam/templates/masscreate.php
index 6cba1a48..c674b6ea 100644
--- a/lam/templates/masscreate.php
+++ b/lam/templates/masscreate.php
@@ -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;
diff --git a/lam/templates/profedit/profilepage.php b/lam/templates/profedit/profilepage.php
index 0a4209ae..f9d1bfd3 100644
--- a/lam/templates/profedit/profilepage.php
+++ b/lam/templates/profedit/profilepage.php
@@ -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();