Enable control of creating children in templates
This commit is contained in:
parent
d062308f32
commit
f0a6d312ab
@ -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');
|
||||
|
@ -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');
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -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 '';
|
||||
|
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user