From 392e2513f9c202ca5d6937bc5f70fb82e350cb06 Mon Sep 17 00:00:00 2001
From: Henning Leutz <leutz@pcsg.de>
Date: Mon, 16 Mar 2015 13:50:19 +0100
Subject: [PATCH] quiqqer-module; event smarty fix

---
 composer.json              | 2 +-
 lib/QUI/Bricks/Events.php  | 7 ++++++-
 lib/QUI/Bricks/Manager.php | 4 ++++
 locale.xml                 | 4 ++--
 4 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/composer.json b/composer.json
index 13b0e81..2e61d69 100644
--- a/composer.json
+++ b/composer.json
@@ -1,6 +1,6 @@
 {
     "name" : "quiqqer/bricks",
-    "type" : "quiqqer-plugin",
+    "type" : "quiqqer-module",
     "description" : "Bricks Module",
 
     "version" : "dev-dev",
diff --git a/lib/QUI/Bricks/Events.php b/lib/QUI/Bricks/Events.php
index 78172d8..1f88ce3 100644
--- a/lib/QUI/Bricks/Events.php
+++ b/lib/QUI/Bricks/Events.php
@@ -99,7 +99,12 @@ static function onSiteSave($Site)
     static function onSmartyInit($Smarty)
     {
         // {brickarea}
-        $Smarty->registerPlugin("function", "brickarea", "\QUI\Bricks\Events::brickarea");
+        if ( !isset( $Smarty->registered_plugins['function'] ) ||
+             !isset( $Smarty->registered_plugins['function']['brickarea'] )
+        )
+        {
+            $Smarty->registerPlugin("function", "brickarea", "\QUI\Bricks\Events::brickarea");
+        }
     }
 
     /**
diff --git a/lib/QUI/Bricks/Manager.php b/lib/QUI/Bricks/Manager.php
index 0fdc4cf..dba619a 100644
--- a/lib/QUI/Bricks/Manager.php
+++ b/lib/QUI/Bricks/Manager.php
@@ -100,6 +100,10 @@ public function getAreasByProject(Project $Project, $layoutType=false)
 //            $layoutType = $Project->getAttribute( 'layout' );
 //        }
 
+        if ( $Project->getAttribute( 'template' ) ) {
+            $templates[] = $Project->getAttribute( 'template' );
+        }
+
         // get all vhosts, and the used templates of the project
         $vhosts = QUI::getRewrite()->getVHosts();
 
diff --git a/locale.xml b/locale.xml
index 3374c67..cc55db1 100644
--- a/locale.xml
+++ b/locale.xml
@@ -139,8 +139,8 @@
     <groups name="quiqqer/bricks" datatype="php">
 
         <locale name="site.panel.bricks.category.title">
-            <de><![CDATA[Bausteine]]></de>
-            <en><![CDATA[Bricks]]></en>
+            <de><![CDATA[Bausteine...]]></de>
+            <en><![CDATA[Bricks...]]></en>
         </locale>
         <locale name="continue.reading">
             <de><![CDATA[weiterlesen]]></de>
-- 
GitLab