From 10f15336cbfb0b9f2af6b7066a79e8d0a2142a3f Mon Sep 17 00:00:00 2001
From: Oceatoon <oceatoon@gmail.com>
Date: Wed, 18 Dec 2019 13:13:18 +0400
Subject: [PATCH] reparing contextId switching

---
 components/CommunecterController.php | 11 +++++++---
 docs/process/costum.org              | 33 ++++++++++++++++++++++++++++
 docs/process/costumBuilder.org       |  2 +-
 3 files changed, 42 insertions(+), 4 deletions(-)
 create mode 100644 docs/process/costum.org

diff --git a/components/CommunecterController.php b/components/CommunecterController.php
index dd0ac323f..be8db7e68 100755
--- a/components/CommunecterController.php
+++ b/components/CommunecterController.php
@@ -692,14 +692,19 @@ class CommunecterController extends Controller
 
     
     if( isset($_POST["costumSlug"]) ){ 
-      //var_dump("okkkkkkkkkkkkk");exit;
+      //var_dump("okkkkkkkkkkkkk");
       //&& @Yii::app()->session[ "costum" ][ "slug" ] != $_POST["costumSlug"]
         if( isset($_POST["costumId"]) && isset($_POST["costumType"]) ){
             //cas d'un costum utilisé comme un template par plusieru element 
-            Costum::init( null, $_POST["costumId"], $_POST["costumType"] );
+            $el = Element::getElementById($_POST["costumId"], $_POST["costumType"]);
+            //regle un prob de surchagement des contextId donc on passe par le slug 
+            if(isset($el))
+              Costum::init( null, null, null,$el["slug"],null,null,null,null,"co2/components/CommunecterController.php 0" );
+            else
+              Costum::init( null, $_POST["costumId"], $_POST["costumType"],null,null,null,"co2/components/CommunecterController.php 1" );
         } 
         else //pas d'element fourni juste un slug de costum
-            Costum::init( null, $_POST["costumSlug"] );
+            Costum::init( null, $_POST["costumSlug"],null,null,null,null,"co2/components/CommunecterController.php 2" );
     } 
   //  var_dump("outside");exit;
     // discussion bouboule oceatoon
diff --git a/docs/process/costum.org b/docs/process/costum.org
new file mode 100644
index 000000000..6976badaa
--- /dev/null
+++ b/docs/process/costum.org
@@ -0,0 +1,33 @@
+always goes through
+CommunecterController.php
+
+
+main costum controler 
+[[~/d/modules/costum/controllers/actions/IndexAction.php]] 
+  Costum::init 
+    prepares all the context elements put into session 
+    * using $test
+      only loads the costum json and applies it to an element 
+    * using $id
+      loads the costum json 
+    * using $slug
+      loads the costum json defined on the element@slug 
+  * first Time or F5  
+    render "co2.views.app.welcome" using "//layouts/mainSearch";
+      $this->renderPartial( Yii::app()->session["costum"]["welcomeTpl"] );
+
+Costum.php:65:null
+Costum.php:66:null
+Costum.php:66:string 'administration-opal' (length=19)
+
+
+  * on reload using js loadByHash
+  api.js 
+    mylog.log("url","costum LBH", costum.slug, contextData );
+    
+    renderPartial "co2.views.app.welcome"
+      $this->renderPartial( Yii::app()->session["costum"]["welcomeTpl"] );
+
+Costum.php:65:string '5c6138c240bb4e0725d5ba87' (length=24)
+Costum.php:66:string 'projects' (length=8)
+Costum.php:66:null
diff --git a/docs/process/costumBuilder.org b/docs/process/costumBuilder.org
index bf2aa7c1a..c40641a28 100644
--- a/docs/process/costumBuilder.org
+++ b/docs/process/costumBuilder.org
@@ -9,7 +9,7 @@
   this forces the costum slug == campagne
 
 ** save choice 
-  [ ] sets on data of the element.costum.slug.campagne
+  sets on data of the element.costum.slug.campagne
 
 ** costumize the template 
   [ ] template have the particularity of carrying a "dynForm" attribute 
-- 
GitLab