...
 
Commits (3)
......@@ -21,6 +21,7 @@
class term extends simplePlugin
{
static function plInfo (): array
{
return [
......@@ -31,7 +32,7 @@ class term extends simplePlugin
'name' => _('Terms Lists'),
'icon' => 'geticon.php?context=applications&icon=term&size=16',
'ou' => get_ou('fdTaxonomyTermsRDN'),
'mainAttr' => 'fdTaxonomyTermCode',
'mainAttr' => 'fdTaxonomyTermCompleteCode',
]],
'plSearchAttrs' => ['description'],
'plProvidedAcls' => parent::generatePlProvidedAcls(static::getAttributesInfo(), TRUE)
......@@ -58,13 +59,9 @@ class term extends simplePlugin
_('Term Long Label'), _('Long Label of Term code'),
'fdTaxonomyTermLongLabel', FALSE
),
new HiddenAttribute('fdTaxonomyTermCompleteCode'),
new HiddenArrayAttribute('fdTaxonomyReferentiel',FALSE,[] ),
new HiddenArrayAttribute('fdTaxonomyName',FALSE,[]),
/*new StringAttribute(
_('Taxonomy Name'), _('Name of taxonomy belonging to the Referentiel'),
'fdTaxonomyName', FALSE
),*/
new TextAreaAttribute(
_('Description'), _('Short description of this terms'),
'description', FALSE
......@@ -89,24 +86,28 @@ class term extends simplePlugin
function __construct ($dn = NULL, $object = NULL, $parent = NULL, $mainTab = FALSE)
{
global $config;
parent::__construct($dn, $object, $parent, $mainTab);
foreach ($config->get_cfg_value('TaxonomyList', []) as $taxonomy) {
list($referentiel, $taxonomy,$policy,$startDate,$endDate) = explode(';', $taxonomy);
// TODO : test the policy and the start/end Date
$ref_tax[] = $referentiel.">".$taxonomy;
$ref_tax[] = $referentiel.$config->get_cfg_value('TaxonomySeparator').$taxonomy;
}
$initval=$this->fdTaxonomyReferentiel[0].">".$this->fdTaxonomyName[0];
$this->attributesAccess['ReferentielAndTaxonomy']->setValue($this->fdTaxonomyReferentiel[0].$config->get_cfg_value('TaxonomySeparator').$this->fdTaxonomyName[0]);
$this->attributesAccess['ReferentielAndTaxonomy']->setChoices($ref_tax);
}
protected function prepare_save (): array
{
global $config;
$refAndTex = $this->attributesAccess['ReferentielAndTaxonomy']->getValue();
$hRefAndTex = explode('>', $refAndTex);
$hRefAndTex = explode($config->get_cfg_value('TaxonomySeparator'), $refAndTex);
$this->fdTaxonomyReferentiel = $hRefAndTex[0];
$this->fdTaxonomyName = $hRefAndTex[1];
$this->ReferentielAndTaxonomy='';
$this->fdTaxonomyTermCompleteCode=$this->fdTaxonomyReferentiel."-".$this->fdTaxonomyName."-".$this->fdTaxonomyTermCode;
this->attributesAccess['fdTaxonomyTermCompleteCode'][0]=$this->fdTaxonomyReferentiel."-".$this->fdTaxonomyName."-".$this->fdTaxonomyTermCode;
var_dump($this->fdTaxonomyReferentiel."-".$this->fdTaxonomyName."-".$this->fdTaxonomyTermCode);
return parent::prepare_save();
}
}
......@@ -39,8 +39,8 @@ class taxonomyConfig extends simplePlugin
static function getAttributesInfo (): array
{
$taxonomyPolicy = [ 'opened' => 'opened', 'halfopened' => 'halfopened', 'closed' => 'closed'];
$taxonomyPolicy = [ 'opened' => 'opened', 'halfopened' => 'halfopened', 'closed' => 'closed'];
return [
'main' => [
......@@ -52,6 +52,12 @@ class taxonomyConfig extends simplePlugin
'fdTaxonomyTermsRDN', TRUE,
'ou=taxonomy'
),
new StringAttribute(
_('Taxonomy Separator'), _('String use for displaying Referential and taxonomy'),
'fdTaxonomySeparator', TRUE,
' > '
),
],
],
'taxonomies' => [
......@@ -87,8 +93,8 @@ class taxonomyConfig extends simplePlugin
'fdTaxonomyList_TaxonomyEndDate', FALSE,
'Ymd', '',
'today', NULL
),
),
],
';',
'',
......@@ -112,7 +118,7 @@ class taxonomyConfig extends simplePlugin
global $config;
parent::__construct($dn, $object, $parent, $mainTab);
}
}
......@@ -14,13 +14,19 @@ attributetype ( 1.3.6.1.4.1.38414.81.1.2 NAME 'fdTaxonomyList'
DESC 'FusionDirectory - Taxonomy List of Referential and taxonomy name'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)
attributetype ( 1.3.6.1.4.1.38414.81.1.3 NAME 'fdTaxonomySeparator'
DESC 'FusionDirectory - Separator for displaying Referentier and Taxonomy'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)
# Object Class
objectclass ( 1.3.6.1.4.1.38414.81.2.1 NAME 'fdTaxonomyPluginConf'
DESC 'FusionDirectory Taxonomy plugin configuration'
SUP top AUXILIARY
MUST ( cn )
MAY (
fdTaxonomyTermsRDN $ fdTaxonomyList
fdTaxonomyTermsRDN $ fdTaxonomyList $ fdTaxonomySeparator
) )
......@@ -40,10 +40,16 @@ attributetype ( 1.3.6.1.4.1.38414.81.10.6 NAME 'fdTaxonomyTermEndDate'
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)
attributetype ( 1.3.6.1.4.1.38414.81.10.7 NAME 'fdTaxonomyTermCompleteCode'
DESC 'FusionDirectory - Taxonomy Term complete Code with referentiel and taxonomy'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)
# Object Class
objectclass ( 1.3.6.1.4.1.38414.81.20.1 NAME 'fdTaxonomyTerms'
DESC 'FusionDirectory Taxonomy Terms Management'
MUST ( fdTaxonomyTermCode )
MAY (
fdTaxonomyTermLongLabel $ fdTaxonomyReferentiel $ fdTaxonomyName $ fdTaxonomyTermStartDate $ fdTaxonomyTermEndDate $ description
fdTaxonomyTermLongLabel $ fdTaxonomyReferentiel $ fdTaxonomyName $ fdTaxonomyTermStartDate $ fdTaxonomyTermEndDate $ description $ fdTaxonomyTermCompleteCode
) )