Added rendering attribute hints

This commit is contained in:
2023-03-02 14:41:38 +11:00
parent 35596ec867
commit c0c9a5576e
8 changed files with 125 additions and 139 deletions

View File

@@ -430,49 +430,6 @@ class PageRender extends Visitor {
return '';
}
#@todo this function shouldnt re-calculate requiredness, it should be known in the template already - need to set the ldaptype when initiating the attribute.
protected function getNoteRequiredAttribute($attribute) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$required_by = '';
$sattr_required = '';
# Is this attribute required by an objectClass ?
$sattr = $this->getServer()->getSchemaAttribute($attribute->getName());
if ($sattr)
$sattr_required = $sattr->getRequiredByObjectClasses();
if ($sattr_required) {
$oc = $this->template->getAttribute('objectclass');
if ($oc)
foreach ($oc->getValues() as $objectclass) {
# If this objectclass is in our required list
if (in_array_ignore_case($objectclass,$sattr_required)) {
$required_by .= sprintf('%s ',$objectclass);
continue;
}
# If not, see if it is in our parent.
$sattr = $this->getServer()->getSchemaObjectClass($objectclass);
if (array_intersect($sattr->getParents(),$sattr_required))
$required_by .= sprintf('%s ',$objectclass);
}
else
debug_dump_backtrace('How can there be no objectclasses?',1);
}
if ($required_by)
return sprintf('<acronym title="%s %s">%s</acronym>',_('Required attribute for objectClass(es)'),$required_by,_('required'));
else
return '';
}
protected function getNoteRDNAttribute($attribute) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);

View File

@@ -1766,34 +1766,6 @@ function random_salt($length) {
return $str;
}
/**
* Given a DN string, this returns the 'RDN' portion of the string.
* For example. given 'cn=Manager,dc=example,dc=com', this function returns
* 'cn=Manager' (it is really the exact opposite of ds_ldap::getContainer()).
*
* @param string The DN whose RDN to return.
* @param boolean If true, include attributes in the RDN string. See http://php.net/ldap_explode_dn for details
* @return string The RDN
*/
function get_rdn($dn,$include_attrs=0,$decode=false) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (is_null($dn))
return null;
$rdn = pla_explode_dn($dn,$include_attrs);
if (! count($rdn) || ! isset($rdn[0]))
return $dn;
if ($decode)
$rdn = dn_unescape($rdn[0]);
else
$rdn = $rdn[0];
return $rdn;
}
/**
* Split an RDN into its attributes
*/