diff options
author | Bharat Mediratta <bharat@menalto.com> | 2008-11-25 02:17:53 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2008-11-25 02:17:53 +0000 |
commit | dcf3693b3ebcb75436da7df5d2171891357703aa (patch) | |
tree | 9d67c2613072f974d3a6b6c39b82647b9a84773b | |
parent | 85bdb606bf56a71b4b02fa353129b6c2cfe2b527 (diff) |
Add theme debugging. Activate it in the [info] tab in the
scaffolding, then browse around your Gallery3 to see where you can add
visible elements via modules.
-rw-r--r-- | core/controllers/welcome.php | 4 | ||||
-rw-r--r-- | core/libraries/Theme.php | 24 | ||||
-rw-r--r-- | core/views/welcome.html.php | 11 | ||||
-rw-r--r-- | themes/default/css/screen.css | 43 |
4 files changed, 58 insertions, 24 deletions
diff --git a/core/controllers/welcome.php b/core/controllers/welcome.php index 9f42c1c4..e4473f06 100644 --- a/core/controllers/welcome.php +++ b/core/controllers/welcome.php @@ -252,8 +252,8 @@ class Welcome_Controller extends Template_Controller { url::redirect("welcome"); } - public function profiler() { - Session::instance()->set("use_profiler", $this->input->get("use_profiler", false)); + public function session($key) { + Session::instance()->set($key, $this->input->get("value", false)); $this->auto_render = false; url::redirect("welcome"); } diff --git a/core/libraries/Theme.php b/core/libraries/Theme.php index df657ad1..68c48587 100644 --- a/core/libraries/Theme.php +++ b/core/libraries/Theme.php @@ -62,7 +62,6 @@ class Theme_Core { */ public function __call($function, $args) { switch ($function) { - case "admin": case "head": case "page_top": case "page_bottom": @@ -80,23 +79,26 @@ class Theme_Core { case "photo_top": case "photo_blocks": case "photo_bottom": - if (empty($this->block_helpers[$function])) { - foreach (module::get_list() as $module) { - $helper_class = "{$module->name}_block"; - if (method_exists($helper_class, $function)) { - $this->block_helpers[$function][] = $helper_class; - } - } - } + // @todo: restrict access to this option + $debug = Session::instance()->get("debug", false); $blocks = array(); - if (!empty($this->block_helpers[$function])) { - foreach ($this->block_helpers[$function] as $helper_class) { + foreach (module::get_list() as $module) { + $helper_class = "{$module->name}_block"; + if (method_exists($helper_class, $function)) { $blocks[] = call_user_func_array( array($helper_class, $function), array_merge(array($this), $args)); } } + if ($debug) { + if ($function != "head") { + array_unshift( + $blocks, "<div class=\"gAnnotatedThemeBlock gAnnotatedThemeBlock_$function\">" . + "<div class=\"title\">$function</div>"); + $blocks[] = "</div>"; + } + } return implode("\n", $blocks); default: diff --git a/core/views/welcome.html.php b/core/views/welcome.html.php index c9277efd..7b34927f 100644 --- a/core/views/welcome.html.php +++ b/core/views/welcome.html.php @@ -239,9 +239,16 @@ <? endif ?> <li> Profiling: <? if (Session::instance()->get("use_profiler", false)): ?> - <b>on</b> <?= html::anchor("welcome/profiler?use_profiler=0", "off") ?> + <b>on</b> <?= html::anchor("welcome/session/profiler?value=0", "off") ?> <? else: ?> - <?= html::anchor("welcome/profiler?use_profiler=1", "on") ?> <b>off</b> + <?= html::anchor("welcome/session/profiler?value=1", "on") ?> <b>off</b> + <? endif ?> + </li> + <li> Debug: + <? if (Session::instance()->get("debug", false)): ?> + <b>on</b> <?= html::anchor("welcome/session/debug?value=0", "off") ?> + <? else: ?> + <?= html::anchor("welcome/session/debug?value=1", "on") ?> <b>off</b> <? endif ?> </li> </ul> diff --git a/themes/default/css/screen.css b/themes/default/css/screen.css index 276c7211..dfbd5f66 100644 --- a/themes/default/css/screen.css +++ b/themes/default/css/screen.css @@ -4,15 +4,16 @@ * @requires YUI reset, font, grids CSS * * Sheet organization: - * 1) Basic HTML elements - * 2) Base text styles - * 3) Layout containers - * 4) Generic content containers - * 5) Specific content blocks - * 6) Navigation and menus - * 7) Generic styles - * 8) Forms - * 9) Browser hacks + * 1) Basic HTML elements + * 2) Base text styles + * 3) Layout containers + * 4) Generic content containers + * 5) Specific content blocks + * 6) Navigation and menus + * 7) Generic styles + * 8) Forms + * 9) Browser hacks + * 10) Debugging information */ /** ******************************************************************* @@ -807,3 +808,27 @@ li.gError select { height: 0; visibility: hidden; } + + +/** ******************************************************************* + * 10) Debugging information + *********************************************************************/ + +div.gAnnotatedThemeBlock { + position: relative; + padding: 1em; + margin: 1em; + border: 1px solid #C00; + clear: both; +} + +div.gAnnotatedThemeBlock div.title { + position: absolute; + top: -1em; + right: -1em; + border: 1px solid black; + background: #C00; + color: white; + text-align: left; + padding: 4px; +} |