From 678148b9aa98ffb0b174aceb2e30f79ea116a566 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 1 Sep 2016 13:48:11 -0700 Subject: more work on theme select backend --- Zotlabs/Module/Theme.php | 44 ----------------------------- Zotlabs/Module/Theme_info.php | 64 ++++++++++++++++++++++++++++++++++++++++++ view/tpl/field_themeselect.tpl | 10 +++++-- 3 files changed, 71 insertions(+), 47 deletions(-) delete mode 100644 Zotlabs/Module/Theme.php create mode 100644 Zotlabs/Module/Theme_info.php diff --git a/Zotlabs/Module/Theme.php b/Zotlabs/Module/Theme.php deleted file mode 100644 index da23d9c15..000000000 --- a/Zotlabs/Module/Theme.php +++ /dev/null @@ -1,44 +0,0 @@ -get_theme_config_file($theme)) != null){ - require_once($themeconfigfile); - if(class_exists(ucfirst($theme) . 'Config')) { - $clsname = ucfirst($theme) . 'Config'; - $th_config = new $clsname(); - $schemas = $th_config->get_schemas(); - } - $theme_config = theme_content($a); - } - - $ret = array('theme' => $theme, 'schemas' => $schemas,'config' => $theme_config); - json_return_and_die($ret); - - } - - - function get_theme_config_file($theme){ - - $base_theme = \App::$theme_info['extends']; - - if (file_exists("view/theme/$theme/php/config.php")){ - return "view/theme/$theme/php/config.php"; - } - if (file_exists("view/theme/$base_theme/php/config.php")){ - return "view/theme/$base_theme/php/config.php"; - } - return null; - } - - -} \ No newline at end of file diff --git a/Zotlabs/Module/Theme_info.php b/Zotlabs/Module/Theme_info.php new file mode 100644 index 000000000..054ab6447 --- /dev/null +++ b/Zotlabs/Module/Theme_info.php @@ -0,0 +1,64 @@ +get_theme_config_file($theme)) != null){ + require_once($themeconfigfile); + if(class_exists(ucfirst($theme) . 'Config')) { + $clsname = ucfirst($theme) . 'Config'; + $th_config = new $clsname(); + $schemas = $th_config->get_schemas(); + } + $theme_config = theme_content($a); + } + $info = get_theme_info($theme); + if($info) { + // unfortunately there will be no translation for this string + $desc = $info['description']; + $version = $info['version']; + $credits = $info['credits']; + } + else { + $desc = ''; + $version = ''; + $credits = ''; + } + + $ret = [ + 'theme' => $theme, + 'img' => get_theme_screenshot($theme), + 'desc' => $desc, + 'version' => $version, + 'credits' => $credits, + 'schemas' => $schemas, + 'config' => $theme_config + ]; + json_return_and_die($ret); + + } + + + function get_theme_config_file($theme){ + + $base_theme = \App::$theme_info['extends']; + + if (file_exists("view/theme/$theme/php/config.php")){ + return "view/theme/$theme/php/config.php"; + } + if (file_exists("view/theme/$base_theme/php/config.php")){ + return "view/theme/$base_theme/php/config.php"; + } + return null; + } + + +} \ No newline at end of file diff --git a/view/tpl/field_themeselect.tpl b/view/tpl/field_themeselect.tpl index 250f9fcf1..7a529774c 100755 --- a/view/tpl/field_themeselect.tpl +++ b/view/tpl/field_themeselect.tpl @@ -1,9 +1,13 @@ - {{if $field.5=='preview'}}{{/if}} + {{if $field.5 == 'preview'}} + + {{/if}}
- {{foreach $field.4 as $opt=>$val}}{{/foreach}} {{$field.3}} - {{if $field.5=='preview'}}
{{/if}} + {{if $field.5=='preview'}} +
+ {{/if}}
-- cgit v1.2.3