allow types to define their custom icon
This commit is contained in:
parent
f24fcf853b
commit
b78dc34d36
|
@ -5,7 +5,7 @@ use LAM\TYPES\ConfiguredType;
|
||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||||
Copyright (C) 2005 - 2016 Roland Gruber
|
Copyright (C) 2005 - 2017 Roland Gruber
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -201,6 +201,26 @@ class baseType {
|
||||||
return $this->type;
|
return $this->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the file name of the type icon.
|
||||||
|
* It needs to be 16x16px and located in graphics folder.
|
||||||
|
* By default this is "{type name}.png"
|
||||||
|
*
|
||||||
|
* @return string file name
|
||||||
|
*/
|
||||||
|
public function getIcon() {
|
||||||
|
return get_class($this) . '.png';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the scope name.
|
||||||
|
*
|
||||||
|
* @return string scope
|
||||||
|
*/
|
||||||
|
public function getScope() {
|
||||||
|
return get_class($this);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -297,6 +297,17 @@ class ConfiguredType {
|
||||||
return explode(',', $modules);
|
return explode(',', $modules);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the file name of the type icon.
|
||||||
|
* It is 16x16px and located in graphics folder.
|
||||||
|
*
|
||||||
|
* @return string file name
|
||||||
|
*/
|
||||||
|
public function getIcon() {
|
||||||
|
$baseType = $this->getBaseType();
|
||||||
|
return $baseType->getIcon();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -306,7 +306,7 @@ function config_showAccountModules($type, &$container) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// add account module selection
|
// add account module selection
|
||||||
$container->addElement(new htmlSubTitle($type->getAlias(), '../../graphics/' . $type->getScope() . '.png'), true);
|
$container->addElement(new htmlSubTitle($type->getAlias(), '../../graphics/' . $type->getIcon()), true);
|
||||||
$container->addElement(new htmlOutputText(_("Selected modules")));
|
$container->addElement(new htmlOutputText(_("Selected modules")));
|
||||||
$container->addElement(new htmlOutputText(''));
|
$container->addElement(new htmlOutputText(''));
|
||||||
$container->addElement(new htmlOutputText(_("Available modules")), true);
|
$container->addElement(new htmlOutputText(_("Available modules")), true);
|
||||||
|
|
|
@ -15,7 +15,7 @@ use \htmlTableExtendedInputCheckbox;
|
||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||||
Copyright (C) 2004 - 2016 Roland Gruber
|
Copyright (C) 2004 - 2017 Roland Gruber
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -129,10 +129,10 @@ $availableScopes = array();
|
||||||
foreach ($allScopes as $scope) {
|
foreach ($allScopes as $scope) {
|
||||||
$scopeObj = new $scope(null);
|
$scopeObj = new $scope(null);
|
||||||
if (!in_array($scope, $activeScopes) || $scopeObj->supportsMultipleConfigs()) {
|
if (!in_array($scope, $activeScopes) || $scopeObj->supportsMultipleConfigs()) {
|
||||||
$availableScopes[$scope] = $scopeObj->getAlias();
|
$availableScopes[] = $scopeObj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
natcasesort($availableScopes);
|
usort($availableScopes, '\LAM\CONFIG\compareTypesByAlias');
|
||||||
|
|
||||||
echo $_SESSION['header'];
|
echo $_SESSION['header'];
|
||||||
|
|
||||||
|
@ -246,12 +246,12 @@ $container = new htmlTable();
|
||||||
if (sizeof($availableScopes) > 0) {
|
if (sizeof($availableScopes) > 0) {
|
||||||
$container->addElement(new htmlSubTitle(_("Available account types")), true);
|
$container->addElement(new htmlSubTitle(_("Available account types")), true);
|
||||||
$availableContainer = new htmlTable();
|
$availableContainer = new htmlTable();
|
||||||
foreach ($availableScopes as $key => $value) {
|
foreach ($availableScopes as $availableScope) {
|
||||||
$availableContainer->addElement(new htmlImage('../../graphics/' . $key . '.png'));
|
$availableContainer->addElement(new htmlImage('../../graphics/' . $availableScope->getIcon()));
|
||||||
$availableContainer->addElement(new htmlOutputText($value));
|
$availableContainer->addElement(new htmlOutputText($availableScope->getAlias()));
|
||||||
$availableContainer->addElement(new htmlSpacer('10px', null));
|
$availableContainer->addElement(new htmlSpacer('10px', null));
|
||||||
$availableContainer->addElement(new htmlOutputText(\LAM\TYPES\getTypeDescription($key)));
|
$availableContainer->addElement(new htmlOutputText($availableScope->getDescription()));
|
||||||
$button = new htmlButton('add_' . $key, 'add.png', true);
|
$button = new htmlButton('add_' . $availableScope->getScope(), 'add.png', true);
|
||||||
$button->setTitle(_("Add"));
|
$button->setTitle(_("Add"));
|
||||||
$availableContainer->addElement($button, true);
|
$availableContainer->addElement($button, true);
|
||||||
}
|
}
|
||||||
|
@ -268,7 +268,7 @@ if (sizeof($activeTypes) > 0) {
|
||||||
// title
|
// title
|
||||||
$titleGroup = new htmlGroup();
|
$titleGroup = new htmlGroup();
|
||||||
$titleGroup->colspan = 6;
|
$titleGroup->colspan = 6;
|
||||||
$titleGroup->addElement(new htmlImage('../../graphics/' . $activeType->getScope() . '.png'));
|
$titleGroup->addElement(new htmlImage('../../graphics/' . $activeType->getIcon()));
|
||||||
$titleText = new htmlOutputText($activeType->getAlias());
|
$titleText = new htmlOutputText($activeType->getAlias());
|
||||||
$titleText->setIsBold(true);
|
$titleText->setIsBold(true);
|
||||||
$titleGroup->addElement($titleText);
|
$titleGroup->addElement($titleText);
|
||||||
|
@ -490,8 +490,14 @@ function checkInput() {
|
||||||
return $errors;
|
return $errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares types by alias for sorting.
|
||||||
|
*
|
||||||
|
* @param \baseType $a first type
|
||||||
|
* @param \baseType $b second type
|
||||||
|
*/
|
||||||
|
function compareTypesByAlias($a, $b) {
|
||||||
|
return strnatcasecmp($a->getAlias(), $b->getAlias());
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -214,7 +214,7 @@ function printTypeTabs($headerPrefix) {
|
||||||
}
|
}
|
||||||
$link = '<a href="' . $headerPrefix . 'lists/list.php?type=' . $type->getId() .
|
$link = '<a href="' . $headerPrefix . 'lists/list.php?type=' . $type->getId() .
|
||||||
'" onmouseover="jQuery(this).addClass(\'tabs-hover\');" onmouseout="jQuery(this).removeClass(\'tabs-hover\');">' .
|
'" onmouseover="jQuery(this).addClass(\'tabs-hover\');" onmouseout="jQuery(this).removeClass(\'tabs-hover\');">' .
|
||||||
'<img height="16" width="16" alt="' . $type->getId() . '" src="' . $headerPrefix . '../graphics/' . $type->getScope() . '.png"> ' .
|
'<img height="16" width="16" alt="' . $type->getId() . '" src="' . $headerPrefix . '../graphics/' . $type->getIcon() . '"> ' .
|
||||||
$type->getAlias() . '</a>';
|
$type->getAlias() . '</a>';
|
||||||
echo '<li id="tab_' . $type->getId() . '" class="ui-state-default ui-corner-top">';
|
echo '<li id="tab_' . $type->getId() . '" class="ui-state-default ui-corner-top">';
|
||||||
echo $link;
|
echo $link;
|
||||||
|
|
|
@ -194,6 +194,7 @@ foreach ($sortedTypes as $typeId => $title) {
|
||||||
'typeId' => $type->getId(),
|
'typeId' => $type->getId(),
|
||||||
'scope' => $type->getScope(),
|
'scope' => $type->getScope(),
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
|
'icon' => $type->getIcon(),
|
||||||
'templates' => "");
|
'templates' => "");
|
||||||
$availableTypes[$title] = $type->getId();
|
$availableTypes[$title] = $type->getId();
|
||||||
}
|
}
|
||||||
|
@ -250,7 +251,7 @@ include '../main_header.php';
|
||||||
$existingContainer->addElement(new htmlSpacer(null, '10px'), true);
|
$existingContainer->addElement(new htmlSpacer(null, '10px'), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$existingContainer->addElement(new htmlImage('../../graphics/' . $templateClasses[$i]['scope'] . '.png'));
|
$existingContainer->addElement(new htmlImage('../../graphics/' . $templateClasses[$i]['icon']));
|
||||||
$existingContainer->addElement(new htmlSpacer('3px', null));
|
$existingContainer->addElement(new htmlSpacer('3px', null));
|
||||||
$existingContainer->addElement(new htmlOutputText($templateClasses[$i]['title']));
|
$existingContainer->addElement(new htmlOutputText($templateClasses[$i]['title']));
|
||||||
$existingContainer->addElement(new htmlSpacer('3px', null));
|
$existingContainer->addElement(new htmlSpacer('3px', null));
|
||||||
|
|
|
@ -79,6 +79,7 @@ foreach ($types as $type) {
|
||||||
'typeId' => $type->getId(),
|
'typeId' => $type->getId(),
|
||||||
'scope' => $type->getScope(),
|
'scope' => $type->getScope(),
|
||||||
'title' => $type->getAlias(),
|
'title' => $type->getAlias(),
|
||||||
|
'icon' => $type->getIcon(),
|
||||||
'profiles' => "");
|
'profiles' => "");
|
||||||
}
|
}
|
||||||
$profileClassesKeys = array_keys($profileClassesTemp);
|
$profileClassesKeys = array_keys($profileClassesTemp);
|
||||||
|
@ -229,7 +230,7 @@ for ($i = 0; $i < sizeof($profileClasses); $i++) {
|
||||||
$existingContainer->addElement(new htmlSpacer(null, '10px'), true);
|
$existingContainer->addElement(new htmlSpacer(null, '10px'), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$existingContainer->addElement(new htmlImage('../../graphics/' . \LAM\TYPES\getScopeFromTypeId($profileClasses[$i]['typeId']) . '.png'));
|
$existingContainer->addElement(new htmlImage('../../graphics/' . $profileClasses[$i]['icon']));
|
||||||
$existingContainer->addElement(new htmlSpacer('3px', null));
|
$existingContainer->addElement(new htmlSpacer('3px', null));
|
||||||
$existingContainer->addElement(new htmlOutputText($profileClasses[$i]['title']));
|
$existingContainer->addElement(new htmlOutputText($profileClasses[$i]['title']));
|
||||||
$existingContainer->addElement(new htmlSpacer('3px', null));
|
$existingContainer->addElement(new htmlSpacer('3px', null));
|
||||||
|
|
Loading…
Reference in New Issue