diff options
author | plegall <plg@piwigo.org> | 2010-03-22 14:11:10 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2010-03-22 14:11:10 +0000 |
commit | 15499d5dc13cb4680fa2a683f459bbfe785d70a5 (patch) | |
tree | e665409a80a6f934925a09f9742ccb2a0624c0c0 /admin/themes | |
parent | cf9af7d0628053b16c3bfc82c2146c3cd7ecec8f (diff) |
feature 1514: improvement, impossible to delete a theme that is required
by another installed theme.
git-svn-id: http://piwigo.org/svn/trunk@5258 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | admin/themes/default/template/footer.tpl | 2 | ||||
-rw-r--r-- | admin/themes/default/template/themes_installed.tpl | 15 | ||||
-rw-r--r-- | admin/themes_installed.php | 18 |
3 files changed, 30 insertions, 5 deletions
diff --git a/admin/themes/default/template/footer.tpl b/admin/themes/default/template/footer.tpl index 3b6b8af43..763942e60 100644 --- a/admin/themes/default/template/footer.tpl +++ b/admin/themes/default/template/footer.tpl @@ -45,7 +45,7 @@ {literal} <script type='text/javascript'> $(function() { - $('#pwgHead A, #footer A, .themeActions A').tipTip({ + $('#pwgHead A, #footer A, .themeActions A, .themeActions SPAN').tipTip({ 'delay' : 0, 'fadeIn' : 200, 'fadeOut' : 200, diff --git a/admin/themes/default/template/themes_installed.tpl b/admin/themes/default/template/themes_installed.tpl index a231f39ff..0a5a0cc85 100644 --- a/admin/themes/default/template/themes_installed.tpl +++ b/admin/themes/default/template/themes_installed.tpl @@ -4,7 +4,8 @@ <div id="themesContent"> -<h3>Active Themes</h3> +<fieldset> +<legend>Active Themes</legend> {if isset($active_themes)} <div class="themeBoxes"> {foreach from=$active_themes item=theme} @@ -21,9 +22,11 @@ {/foreach} </div> <!-- themeBoxes --> {/if} +</fieldset> {if isset($inactive_themes)} -<h3>Inactive Themes</h3> +<fieldset> +<legend>Inactive Themes</legend> <div class="themeBoxes"> {foreach from=$inactive_themes item=theme} <div class="themeBox"> @@ -31,12 +34,18 @@ <div class="themeShot"><img src="{$theme.screenshot}"></div> <div class="themeActions"> <a href="{$activate_baseurl}{$theme.id}" title="{'Make this theme available to users'|@translate}">{'Activate'|@translate}</a> - | <a href="{$delete_baseurl}{$theme.id}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');" title="{'Delete this theme'|@translate}">{'Delete'|@translate}</a> + | + {if $theme.deletable} + <a href="{$delete_baseurl}{$theme.id}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');" title="{'Delete this theme'|@translate}">{'Delete'|@translate}</a> + {else} + <span title="{$theme.delete_tooltip}">{'Delete'|@translate}</span> + {/if} </div> </div> {/foreach} </div> <!-- themeBoxes --> +</fieldset> {/if} </div> <!-- themesContent -->
\ No newline at end of file diff --git a/admin/themes_installed.php b/admin/themes_installed.php index 68510354f..82efe569a 100644 --- a/admin/themes_installed.php +++ b/admin/themes_installed.php @@ -68,7 +68,7 @@ foreach ($db_themes as $db_theme) $active_themes = array(); $inactive_themes = array(); -foreach($themes->fs_themes as $theme_id => $fs_theme) +foreach ($themes->fs_themes as $theme_id => $fs_theme) { if ($theme_id == 'default') { @@ -89,6 +89,22 @@ foreach($themes->fs_themes as $theme_id => $fs_theme) } else { + $children = $themes->get_children_themes($theme_id); + + if (count($children) > 0) + { + $fs_theme['deletable'] = false; + + $fs_theme['delete_tooltip'] = sprintf( + l10n('Impossible to delete this theme. Other themes depends on it: %s'), + implode(', ', $children) + ); + } + else + { + $fs_theme['deletable'] = true; + } + array_push($inactive_themes, $fs_theme); } } |