aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
Diffstat (limited to 'admin')
-rw-r--r--admin/themes/default/template/themes_installed.tpl120
-rw-r--r--admin/themes/default/theme.css7
-rw-r--r--admin/themes_installed.php76
3 files changed, 124 insertions, 79 deletions
diff --git a/admin/themes/default/template/themes_installed.tpl b/admin/themes/default/template/themes_installed.tpl
index c1c5eb66b..d2f0401fb 100644
--- a/admin/themes/default/template/themes_installed.tpl
+++ b/admin/themes/default/template/themes_installed.tpl
@@ -1,8 +1,18 @@
{include file='include/colorbox.inc.tpl'}
+
{footer_script}{literal}
jQuery(document).ready(function() {
- $("a.preview-box").colorbox();
-});
+ $("a.preview-box").colorbox();
+
+ jQuery('.showInfo').tipTip({
+ 'delay' : 0,
+ 'fadeIn' : 200,
+ 'fadeOut' : 200,
+ 'maxWidth':'300px',
+ 'keepAlive':true,
+ 'activation':'click'
+ });
+});
{/literal}{/footer_script}
<div class="titrePage">
@@ -11,66 +21,80 @@ jQuery(document).ready(function() {
<div id="themesContent">
-<fieldset>
-<legend>{'Active Themes'|@translate}</legend>
-{if isset($active_themes)}
-<div class="themeBoxes">
-{foreach from=$active_themes item=theme}
- <div class="themeBox{if $theme.is_default} themeDefault{/if}">
- <div class="themeName">{$theme.name}{if $theme.is_default} <em>({'default'|@translate})</em>{/if} {if $theme.mobile} <em>({'Mobile'|@translate})</em>{/if}</div>
- <div class="themeShot"><a href="{$theme.screenshot}" class="preview-box" title="{$theme.name}"><img src="{$theme.screenshot}" alt=""></a></div>
- <div class="themeActions">
- <div>
-{if $theme.deactivable}
- <a href="{$deactivate_baseurl}{$theme.id}" class="tiptip" title="{'Forbid this theme to users'|@translate}">{'Deactivate'|@translate}</a>
-{else}
- <span title="{$theme.deactivate_tooltip}" class="tiptip">{'Deactivate'|@translate}</span>
-{/if}
-
-{if not $theme.is_default}
- | <a href="{$set_default_baseurl}{$theme.id}" class="tiptip" title="{'Set as default theme for unregistered and new users'|@translate}">{'Default'|@translate}</a>
-{/if}
-{if isset($theme.admin_uri)}
- <br><a href="{$theme.admin_uri}" class="tiptip" title="{'Configuration'|@translate}">{'Configuration'|@translate}</a>
-{/if}
- </div>
- </div> <!-- themeActions -->
- </div>
-{/foreach}
-</div> <!-- themeBoxes -->
+{assign var='field_name' value='null'} {* <!-- 'counter' for fieldset management --> *}
+{foreach from=$tpl_themes item=theme}
+
+{if $field_name != $theme.STATE}
+ {if $field_name != 'null'}
+ </div>
+ </fieldset>
+ {/if}
+
+ <fieldset>
+ <legend>
+ {if $theme.STATE == 'active'}
+ {'Active Themes'|@translate}
+ {else}
+ {'Inactive Themes'|@translate}
+ {/if}
+ </legend>
+ <div class="themeBoxes">
+ {assign var='field_name' value=$theme.STATE}
{/if}
-</fieldset>
-{if isset($inactive_themes)}
-<fieldset>
-<legend>{'Inactive Themes'|@translate}</legend>
-<div class="themeBoxes">
-{foreach from=$inactive_themes item=theme}
- <div class="themeBox">
- <div class="themeName">{$theme.name}{if $theme.mobile} <em>({'Mobile'|@translate})</em>{/if}</div>
- <div class="themeShot"><a href="{$theme.screenshot}" class="preview-box" title="{$theme.name}"><img src="{$theme.screenshot}" alt=""></a></div>
+ {if not empty($theme.AUTHOR)}
+ {if not empty($theme.AUTHOR_URL)}
+ {assign var='author' value="<a href='%s'>%s</a>"|@sprintf:$theme.AUTHOR_URL:$theme.AUTHOR}
+ {else}
+ {assign var='author' value='<u>'|cat:$theme.AUTHOR|cat:'</u>'}
+ {/if}
+ {/if}
+ {if not empty($theme.VISIT_URL)}
+ {assign var='version' value="<a class='externalLink' href='"|cat:$theme.VISIT_URL|cat:"'>"|cat:$theme.VERSION|cat:"</a>"}
+ {else}
+ {assign var='version' value=$theme.VERSION}
+ {/if}
+
+ <div class="themeBox{if $theme.IS_DEFAULT} themeDefault{/if}">
+ <div class="themeName">
+ {$theme.NAME} {if $theme.IS_DEFAULT}<em>({'default'|@translate})</em>{/if} {if $theme.IS_MOBILE}<em>({'Mobile'|@translate})</em>{/if}
+ <a class="showInfo" title="{if !empty($author)}{'By %s'|@translate|@sprintf:$author} | {/if}{'Version'|@translate} {$version}<br/>{$theme.DESC|@escape:'html'}">i</a>
+ </div>
+ <div class="themeShot"><a href="{$theme.SCREENSHOT}" class="preview-box" title="{$theme.NAME}"><img src="{$theme.SCREENSHOT}" alt=""></a></div>
<div class="themeActions">
<div>
- {if $theme.activable}
- <a href="{$activate_baseurl}{$theme.id}" title="{'Make this theme available to users'|@translate}" class="tiptip">{'Activate'|@translate}</a>
+{if $theme.STATE == 'active'}
+ {if $theme.DEACTIVABLE}
+ <a href="{$deactivate_baseurl}{$theme.ID}" class="tiptip" title="{'Forbid this theme to users'|@translate}">{'Deactivate'|@translate}</a>
{else}
- <span title="{$theme.activate_tooltip}" class="tiptip">{'Activate'|@translate}</span>
+ <span title="{$theme.DEACTIVATE_TOOLTIP}" class="tiptip">{'Deactivate'|@translate}</span>
{/if}
+ {if not $theme.IS_DEFAULT}
+ | <a href="{$set_default_baseurl}{$theme.ID}" class="tiptip" title="{'Set as default theme for unregistered and new users'|@translate}">{'Default'|@translate}</a>
+ {/if}
+ {if $theme.ADMIN_URI}
+ <br><a href="{$theme.ADMIN_URI}" class="tiptip" title="{'Configuration'|@translate}">{'Configuration'|@translate}</a>
+ {/if}
+{else}
+ {if $theme.ACTIVABLE}
+ <a href="{$activate_baseurl}{$theme.ID}" title="{'Make this theme available to users'|@translate}" class="tiptip">{'Activate'|@translate}</a>
+ {else}
+ <span title="{$theme.ACTIVATE_TOOLTIP}" class="tiptip">{'Activate'|@translate}</span>
+ {/if}
|
-
- {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>
+ {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}" class="tiptip">{'Delete'|@translate}</span>
+ <span title="{$theme.DELETE_TOOLTIP}" class="tiptip">{'Delete'|@translate}</span>
{/if}
+{/if}
</div>
- </div>
-
+ </div> <!-- themeActions -->
</div>
+
{/foreach}
</div> <!-- themeBoxes -->
</fieldset>
-{/if}
</div> <!-- themesContent -->
diff --git a/admin/themes/default/theme.css b/admin/themes/default/theme.css
index a3b27e309..ce8b78b9e 100644
--- a/admin/themes/default/theme.css
+++ b/admin/themes/default/theme.css
@@ -758,10 +758,10 @@ html, body {height:100%; margin:0; padding:0;}
#thePopuphelpPage #pwgHead {display:none}
#thePopuphelpPage #footer {display:none}
-.themeBox {display:inline-table; text-align:center; height:192px; background-color:#eee; margin:5px; -moz-border-radius:5px; overflow:hidden; }
+.themeBox {display:inline-table; text-align:center; height:192px; background-color:#eee; margin:5px; border-radius:5px; overflow:hidden; }
.themeBox IMG {border:1px solid white; margin:0 15px;}
-.themeName {font-size:1.1em; margin:5px 0;}
+.themeName {font-size:1em; margin:5px 0; position:relative; }
.themeActions {display: table-row; font-size:12px; height: 43px; }
.themeActions DIV {display: table-cell; vertical-align: middle; line-height:18px; }
.themeActions A {}
@@ -864,7 +864,7 @@ h2:lang(en) { text-transform:capitalize; }
.languageActions {display: table-row; font-size:12px; }
.languageActions DIV {display: table-cell; vertical-align: middle; line-height:18px; }
-#ui-datepicker-div {-moz-border-radius:5px;}
+#ui-datepicker-div {-moz-border-radius:5px; border-radius:5px;}
#ui-datepicker-div .ui-icon-circle-triangle-w, #ui-datepicker-div .ui-icon-circle-triangle-e {color:transparent;}
#ui-datepicker-div A.ui-datepicker-prev, #ui-datepicker-div A.ui-datepicker-next {background-color:transparent;}
#ui-datepicker-div A.ui-datepicker-prev:hover, #ui-datepicker-div A.ui-datepicker-next:hover {-moz-border-radius:5px;}
@@ -1100,7 +1100,6 @@ input[type="text"].dError {border-color:#ff7070; background-color:#FFe5e5;}
border-radius:10px;
-moz-border-radius:10px;
-webkit-border-radius:10px;
- -border-radius:10px;
margin-left:5px;
}
diff --git a/admin/themes_installed.php b/admin/themes_installed.php
index c1dcdaf52..8371edc48 100644
--- a/admin/themes_installed.php
+++ b/admin/themes_installed.php
@@ -65,8 +65,7 @@ foreach ($db_themes as $db_theme)
array_push($db_theme_ids, $db_theme['id']);
}
-$active_themes = array();
-$inactive_themes = array();
+$tpl_themes = array();
foreach ($themes->fs_themes as $theme_id => $fs_theme)
{
@@ -74,46 +73,55 @@ foreach ($themes->fs_themes as $theme_id => $fs_theme)
{
continue;
}
+
+ $tpl_theme = array(
+ 'ID' => $theme_id,
+ 'NAME' => $fs_theme['name'],
+ 'VISIT_URL' => $fs_theme['uri'],
+ 'VERSION' => $fs_theme['version'],
+ 'DESC' => $fs_theme['description'],
+ 'AUTHOR' => $fs_theme['author'],
+ 'AUTHOR_URL' => @$fs_theme['author uri'],
+ 'PARENT' => @$fs_theme['parent'],
+ 'SCREENSHOT' => $fs_theme['screenshot'],
+ 'IS_MOBILE' => $fs_theme['mobile'],
+ 'ADMIN_URI' => @$fs_theme['admin_uri'],
+ );
if (in_array($theme_id, $db_theme_ids))
{
- $fs_theme['deactivable'] = true;
+ $tpl_theme['STATE'] = 'active';
+ $tpl_theme['DEACTIVABLE'] = true;
if (count($db_theme_ids) <= 1)
{
- $fs_theme['deactivable'] = false;
- $fs_theme['deactivate_tooltip'] = l10n('Impossible to deactivate this theme, you need at least one theme.');
- }
-
- if ($theme_id == $default_theme)
- {
- $fs_theme['is_default'] = true;
- array_unshift($active_themes, $fs_theme);
- }
- else
- {
- $fs_theme['is_default'] = false;
- array_push($active_themes, $fs_theme);
+ $tpl_theme['DEACTIVABLE'] = false;
+ $tpl_theme['DEACTIVATE_TOOLTIP'] = l10n('Impossible to deactivate this theme, you need at least one theme.');
}
+
+ $tpl_theme['IS_DEFAULT'] = ($theme_id == $default_theme);
}
else
{
+ $tpl_theme['STATE'] = 'inactive';
+
// is the theme "activable" ?
if (isset($fs_theme['activable']) and !$fs_theme['activable'])
{
- $fs_theme['activate_tooltip'] = l10n('This theme was not designed to be directly activated');
+ $tpl_theme['ACTIVABLE'] = false;
+ $tpl_theme['ACTIVABLE_TOOLTIP'] = l10n('This theme was not designed to be directly activated');
}
else
{
- $fs_theme['activable'] = true;
+ $tpl_theme['ACTIVABLE'] = true;
}
$missing_parent = $themes->missing_parent_theme($theme_id);
if (isset($missing_parent))
{
- $fs_theme['activable'] = false;
+ $tpl_theme['ACTIVABLE'] = false;
- $fs_theme['activate_tooltip'] = sprintf(
+ $tpl_theme['ACTIVABLE_TOOLTIP'] = sprintf(
l10n('Impossible to activate this theme, the parent theme is missing: %s'),
$missing_parent
);
@@ -122,21 +130,36 @@ foreach ($themes->fs_themes as $theme_id => $fs_theme)
// is the theme "deletable" ?
$children = $themes->get_children_themes($theme_id);
- $fs_theme['deletable'] = true;
+ $tpl_theme['DELETABLE'] = true;
if (count($children) > 0)
{
- $fs_theme['deletable'] = false;
+ $tpl_theme['DELETABLE'] = false;
- $fs_theme['delete_tooltip'] = sprintf(
+ $tpl_theme['DELETE_TOOLTIP'] = sprintf(
l10n('Impossible to delete this theme. Other themes depends on it: %s'),
implode(', ', $children)
);
}
-
- array_push($inactive_themes, $fs_theme);
}
+
+ array_push($tpl_themes, $tpl_theme);
+}
+
+// sort themes by state then by name
+function cmp($a, $b)
+{
+ $s = array('active' => 0, 'inactive' => 1);
+
+ if (@$a['IS_DEFAULT']) return -1;
+ if (@$b['IS_DEFAULT']) return 1;
+
+ if($a['STATE'] == $b['STATE'])
+ return strcasecmp($a['NAME'], $b['NAME']);
+ else
+ return $s[$a['STATE']] >= $s[$b['STATE']];
}
+usort($tpl_themes, 'cmp');
$template->assign(
array(
@@ -145,8 +168,7 @@ $template->assign(
'set_default_baseurl' => $base_url.'&amp;action=set_default&amp;theme=',
'delete_baseurl' => $base_url.'&amp;action=delete&amp;theme=',
- 'active_themes' => $active_themes,
- 'inactive_themes' => $inactive_themes,
+ 'tpl_themes' => $tpl_themes,
)
);