From 29d36ffdc36bf20ab43840df9272fac160cbc476 Mon Sep 17 00:00:00 2001 From: patdenice Date: Mon, 29 Mar 2010 13:30:02 +0000 Subject: feature 1502: Allow to have configuration page for each theme.css. About string for theme has to be saved in language theme directory (about.html) git-svn-id: http://piwigo.org/svn/trunk@5446 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/include/themes.class.php | 39 +++++++++++++++--- admin/theme.php | 46 ++++++++++++++++++++++ admin/themes/default/default-layout.css | 5 ++- admin/themes/default/template/themes_installed.tpl | 10 +++-- 4 files changed, 90 insertions(+), 10 deletions(-) create mode 100644 admin/theme.php (limited to 'admin') diff --git a/admin/include/themes.class.php b/admin/include/themes.class.php index 524462306..41ee5f336 100644 --- a/admin/include/themes.class.php +++ b/admin/include/themes.class.php @@ -70,6 +70,8 @@ class themes $crt_db_theme = $this->db_themes_by_id[$theme_id]; } + $file_to_include = PHPWG_THEMES_PATH.'/'.$theme_id.'/admin/maintain.inc.php'; + $errors = array(); switch ($action) @@ -100,14 +102,26 @@ class themes break; } - - $query = " + + if (file_exists($file_to_include)) + { + include($file_to_include); + if (function_exists('theme_activate')) + { + theme_activate($theme_id, $this->fs_themes[$theme_id]['version'], $errors); + } + } + + if (empty($errors)) + { + $query = " INSERT INTO ".THEMES_TABLE." SET id = '".$theme_id."' , version = '".$this->fs_themes[$theme_id]['version']."' , name = '".$this->fs_themes[$theme_id]['name']."' ;"; - pwg_query($query); + pwg_query($query); + } break; case 'deactivate': @@ -150,7 +164,16 @@ SELECT $this->set_default_theme($new_theme); } - + + if (file_exists($file_to_include)) + { + include($file_to_include); + if (function_exists('theme_deactivate')) + { + theme_deactivate($theme_id); + } + } + $query = " DELETE FROM ".THEMES_TABLE." @@ -374,7 +397,13 @@ SELECT .'/images/missing_screenshot.png' ; } - + + $admin_file = $path.'/admin/admin.inc.php'; + if (file_exists($admin_file)) + { + $theme['admin_uri'] = get_root_url().'admin.php?page=theme&theme='.$file; + } + // IMPORTANT SECURITY ! $theme = array_map('htmlspecialchars', $theme); $this->fs_themes[$file] = $theme; diff --git a/admin/theme.php b/admin/theme.php new file mode 100644 index 000000000..88f3a03e3 --- /dev/null +++ b/admin/theme.php @@ -0,0 +1,46 @@ + \ No newline at end of file diff --git a/admin/themes/default/default-layout.css b/admin/themes/default/default-layout.css index 2df864c4b..10c7386d8 100644 --- a/admin/themes/default/default-layout.css +++ b/admin/themes/default/default-layout.css @@ -749,11 +749,12 @@ BODY#thePopuphelpPage { height: 4em; /* legend height (don't set auto to be Gecko friendly)*/ } -.themeBox {display:inline-block; text-align:center; height:180px; background-color:#eee; margin:5px; -moz-border-radius:5px;} +.themeBox {display:inline-table; text-align:center; height:192px; background-color:#eee; margin:5px; -moz-border-radius:5px; overflow:hidden; } .themeBox IMG {border:1px solid white; margin:0 15px;} .themeName {font-size:1.1em; margin:5px 0;} -.themeActions {margin:5px 0; font-size:12px;} +.themeActions {display: table-row; font-size:12px; height: 43px; } +.themeActions DIV {display: table-cell; vertical-align: middle; line-height:18px; } .themeActions A {} #themesContent .themeBox IMG {width:150px; height:120px;} diff --git a/admin/themes/default/template/themes_installed.tpl b/admin/themes/default/template/themes_installed.tpl index 5bb18ae57..9f972486f 100644 --- a/admin/themes/default/template/themes_installed.tpl +++ b/admin/themes/default/template/themes_installed.tpl @@ -13,7 +13,7 @@
{$theme.name}{if $theme.is_default} ({'default'|@translate}){/if}
- +
{if $theme.deactivable} {'Deactivate'|@translate} {else} @@ -23,6 +23,10 @@ {if not $theme.is_default} | {'Default'|@translate} {/if} +{if isset($theme.admin_uri)} +
{'Configuration'|@translate} +{/if} +
{/foreach} @@ -39,7 +43,7 @@
{$theme.name}
- +
{if $theme.activable} {'Activate'|@translate} {else} @@ -53,7 +57,7 @@ {else} {'Delete'|@translate} {/if} - +
-- cgit v1.2.3