diff --git a/htdocs/create.php b/htdocs/create.php index 8bb41fb..e2dd673 100644 --- a/htdocs/create.php +++ b/htdocs/create.php @@ -36,9 +36,6 @@ if (! $request['container']) $request['container'] = $tree->getEntry($request['template']->getContainer()); -if ($request['container']->isLeaf()) - error(sprintf(_('The container (%s) is a leaf.'),$request['template']->getContainer()),'error','index.php'); - # Check our RDN if (! count($request['template']->getRDNAttrs())) error(_('The were no attributes marked as an RDN attribute.'),'error','index.php'); diff --git a/htdocs/create_confirm.php b/htdocs/create_confirm.php index 44646d5..9732166 100644 --- a/htdocs/create_confirm.php +++ b/htdocs/create_confirm.php @@ -30,9 +30,6 @@ if (! $request['container']) $request['container'] = $tree->getEntry($request['template']->getContainer()); -if ($request['container']->isLeaf()) - error(sprintf(_('The container (%s) is a leaf.'),$request['template']->getContainer()),'error','index.php'); - # Check our RDN if (! count($request['template']->getRDNAttrs())) error(_('The were no attributes marked as an RDN attribute.'),'error','index.php'); diff --git a/lib/Template.php b/lib/Template.php index f040e4d..4279e14 100644 --- a/lib/Template.php +++ b/lib/Template.php @@ -45,6 +45,8 @@ class Template extends xmlTemplate { private $dn; # Where this template will store its data protected $container; + # Does this template prohibit children being created + private $noleaf = false; # A regexp that determines if this template is valid in the container. private $regexp; # Template Title @@ -54,6 +56,14 @@ class Template extends xmlTemplate { # Template RDN attributes private $rdn; + public function __construct($server_id,$name=null,$filename=null,$type=null,$id=null) { + parent::__construct($server_id,$name,$filename,$type,$id); + + # If this is the default template, we might disable leafs by default. + if (is_null($filename)) + $this->noleaf = $_SESSION[APPCONFIG]->getValue('appearance','disable_default_leaf'); + } + public function __clone() { if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); @@ -1501,5 +1511,9 @@ class Template extends xmlTemplate { masort($attributes,'name'); return $attributes; } + + public function isNoLeaf() { + return $this->noleaf; + } } ?> diff --git a/lib/TemplateRender.php b/lib/TemplateRender.php index 9d6f14d..db20ba4 100644 --- a/lib/TemplateRender.php +++ b/lib/TemplateRender.php @@ -902,7 +902,7 @@ class TemplateRender extends PageRender { return ''; case 'childcreate': - if ($_SESSION[APPCONFIG]->isCommandAvailable('script','create') && ! $this->template->isReadOnly()) + if ($_SESSION[APPCONFIG]->isCommandAvailable('script','create') && ! $this->template->isReadOnly() && ! $this->template->isNoLeaf()) return $this->getMenuItemCreate(); else return ''; diff --git a/lib/config_default.php b/lib/config_default.php index 5e1e4d3..3d5764e 100644 --- a/lib/config_default.php +++ b/lib/config_default.php @@ -87,6 +87,10 @@ class Config { 'desc'=>'Disabled the Default Template', 'default'=>false); + $this->default->appearance['disable_default_leaf'] = array( + 'desc'=>'Disabled creating leaf entries in the Default Template', + 'default'=>false); + $this->default->appearance['friendly_attrs'] = array( 'desc'=>'Friendly names for attributes', 'default'=>array());