diff --git a/Conjuro/Conjuro.php b/Conjuro/Conjuro.php index c999a6d..46cfc7d 100644 --- a/Conjuro/Conjuro.php +++ b/Conjuro/Conjuro.php @@ -34,7 +34,7 @@ function __construct($conf) { $this->conf=$conf; - $this->loadControls(); + //$this->loadControls(); } // Return data from database @@ -176,7 +176,7 @@ /** * Load a control library */ - private function loadControlLibrary($name){ + public function loadControlLibrary($name){ if (!isset($name) || strpos($name,".")!==false || strpos($name,"/")!==false){ throw new Exception("Name error"); } @@ -192,10 +192,10 @@ /** * Load control libraries installed */ - private function loadControls(){ + /*public function loadControls(){ // TODO- glob directoty to fetch all libraries. $this->loadControlLibrary("common"); - } + }*/ /** * Return a control diff --git a/content/fragment/layout-admin.php b/content/fragment/layout-admin.php index a89ceee..57e2273 100644 --- a/content/fragment/layout-admin.php +++ b/content/fragment/layout-admin.php @@ -7,8 +7,16 @@ -
Hola
-
Hola
+
+
Conjuro
+
data("username")?>
+ ñ +
+
+
+ showContent("header");?> +
+
diff --git a/content/modules/Page.php b/content/modules/Page.php index 58185a0..23a3c90 100644 --- a/content/modules/Page.php +++ b/content/modules/Page.php @@ -24,9 +24,10 @@ */ abstract class PageBase{ - private $meta; private $name; private $conf; + private $meta; + private $data; function __construct($name,$conf) { $this->meta=Conjuro::loadJson("content/pages/$name.json"); @@ -63,6 +64,13 @@ } /** + * Return the value defined for a page meta key + */ + public function data($name){ + return "{{$name}}";//$this->data[$name]; + } + + /** * Show the content defined for a section on page meta */ public function showContent($name){ @@ -74,6 +82,14 @@ } } } + + public function prepare(){ + if(isset($this->meta["control-libraries"])){ + foreach($this->meta["control-libraries"] as $clib){ + c()->loadControlLibrary($clib); + } + } + } public function needAuth(){ return isset($this->meta["auth"]); @@ -85,6 +101,7 @@ // Renders the page public function showPage(){ + self::prepare(); include(self::getLayoutFile()); } diff --git a/content/pages/admin/dashboard.json b/content/pages/admin/dashboard.json index 5434376..a587286 100644 --- a/content/pages/admin/dashboard.json +++ b/content/pages/admin/dashboard.json @@ -1,12 +1,12 @@ { "title": "Bienvenido a Conjuro", "layout": "layout-admin", - "custom-css": ".conj{font-family:sans-serif;font-size:50px;font-weight:bold;color:#009900}", + "control-libraries":["common","common-admin"], "header":[ { - "@": "html", + "@": "admin-title", "meta": { - "html": "Welcome to Conjuro!!" + "title": "Dashboard" } } ], diff --git a/content/pages/index.json b/content/pages/index.json index af0dc0c..ae47760 100644 --- a/content/pages/index.json +++ b/content/pages/index.json @@ -1,5 +1,6 @@ { "layout": "layout", + "control-libraries":["common"], "css": ".conj{font-family:sans-serif;font-size:20px;font-weight:bold;color:#009900}.title-panel{padding-top:1rem;}.center:{text-align:center}.conjuro-content{position:relative;background-image:url(media/megumin-bg.gif);background-position: center;background-repeat: no-repeat;background-size: cover;}", "header":[ { diff --git a/media/admin/style.css b/media/admin/style.css index 1b7f7ac..455c1eb 100644 --- a/media/admin/style.css +++ b/media/admin/style.css @@ -36,6 +36,19 @@ padding:0.5rem; } +#panel>#panel-title{ + text-align: center; +} +#panel>#panel-title>img{ + width:100%; + display:block; + margin:-1rem 0.5rem 0 -0.5rem; +} +#panel>#panel-user{ + text-align: right; + padding-bottom: 4rem; +} + #footer { position: absolute; bottom: 0;