From 7649b9b82668646f46e3f792dd0b0ccd2c5a1879 Mon Sep 17 00:00:00 2001 From: Deon George Date: Sat, 14 May 2011 10:42:12 +1000 Subject: [PATCH] SF Feature #3298820 - Only custom templates --- lib/PageRender.php | 12 +++++++++++- lib/TemplateRender.php | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/PageRender.php b/lib/PageRender.php index 2c08389..c3e290c 100644 --- a/lib/PageRender.php +++ b/lib/PageRender.php @@ -331,7 +331,17 @@ class PageRender extends Visitor { if (DEBUGTMP) printf('%s:%s
',__METHOD__,'Choosing the DEFAULT template, no other template applicable'); # Since getTemplate() returns a default template if the one we want doesnt exist, we can return $templates->getID(), it should be the default. - return $template->getID(); + if ($_SESSION[APPCONFIG]->getValue('appearance','disable_default_template') AND $this->getMode() == 'creation') { + + system_message(array( + 'title'=>_('No available templates'), + 'body'=>_('There are no available active templates for this container.'), + 'type'=>'warn')); + + return 'invalid'; + + } else + return $template->getID(); # If there is only 1 defined template, and no default available, then that is our template. } elseif ((count($templates->getTemplates($this->getMode(),$this->getModeContainer(),true)) == 1) && ! $this->haveDefaultTemplate()) { diff --git a/lib/TemplateRender.php b/lib/TemplateRender.php index d6e80bd..4ff946d 100644 --- a/lib/TemplateRender.php +++ b/lib/TemplateRender.php @@ -48,7 +48,7 @@ class TemplateRender extends PageRender { $this->page = get_request('page','REQUEST',false,1); - if ($this->template_id) { + if ($this->template_id AND $this->template_id != 'invalid') { if (! $this->template) parent::accept();