aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2010-03-31 13:10:09 +0000
committerplegall <plg@piwigo.org>2010-03-31 13:10:09 +0000
commit8a7a223af0823e9974092e95f6e0eb6fed67096e (patch)
tree10fdb9c5473bc5268930e160e7d964afd0d7573d
parent30500c8d56fa570d01d79bddafc5b44cb1a58fad (diff)
feature 1535: apply the plugin/theme managers look&feel to language manager.
git-svn-id: http://piwigo.org/svn/trunk@5496 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--admin/languages_installed.php53
-rw-r--r--admin/themes/clear/theme.css4
-rw-r--r--admin/themes/default/default-layout.css6
-rw-r--r--admin/themes/default/template/footer.tpl2
-rw-r--r--admin/themes/default/template/languages_installed.tpl64
-rw-r--r--admin/themes/roma/theme.css6
6 files changed, 100 insertions, 35 deletions
diff --git a/admin/languages_installed.php b/admin/languages_installed.php
index abe088467..74023a34b 100644
--- a/admin/languages_installed.php
+++ b/admin/languages_installed.php
@@ -52,17 +52,56 @@ if (isset($_GET['action']) and isset($_GET['language']) and !is_adviser())
// +-----------------------------------------------------------------------+
$default_language = get_default_language();
+$tpl_languages = array();
+
foreach($languages->fs_languages as $language_id => $language_name)
{
- $template->append('languages', array(
- 'ID' => $language_id,
- 'NAME' => $language_name,
- 'U_ACTION' => $base_url.'&amp;language='.$language_id,
- 'STATE' => isset($languages->db_languages[$language_id]) ? 'active' : '',
- 'IS_DEFAULT' => $language_id == $default_language,
+ $language = array(
+ 'id' => $language_id,
+ 'name' => $language_name,
+ 'u_action' => $base_url.'&amp;language='.$language_id,
+ );
+
+ if (in_array($language_id, array_keys($languages->db_languages)))
+ {
+ $language['state'] = 'active';
+ $language['deactivable'] = true;
+
+ if (count($languages->db_languages) <= 1)
+ {
+ $language['deactivable'] = false;
+ $language['deactivate_tooltip'] = l10n('Impossible to deactivate this language, you need at least one language.');
+ }
+
+ if ($language_id == $default_language)
+ {
+ $language['deactivable'] = false;
+ $language['deactivate_tooltip'] = l10n('Impossible to deactivate this language, first set another language as default.');
+ }
+ }
+ else
+ {
+ $language['state'] = 'inactive';
+ }
+
+ if ($language_id == $default_language)
+ {
+ $language['is_default'] = true;
+ array_unshift($tpl_languages, $language);
+ }
+ else
+ {
+ array_push($tpl_languages, $language);
+ }
+}
+
+$template->assign(
+ array(
+ 'languages' => $tpl_languages,
)
);
-}
+$template->append('language_states', 'active');
+$template->append('language_states', 'inactive');
$missing_language_ids = array_diff(
diff --git a/admin/themes/clear/theme.css b/admin/themes/clear/theme.css
index 0e70b4b20..e7018f585 100644
--- a/admin/themes/clear/theme.css
+++ b/admin/themes/clear/theme.css
@@ -236,3 +236,7 @@ html>body #menubar {min-height:477px; height:477px;} /* IE 7 and modern browsers
.pluginBox {background-color:#ddd;color:#333}
.pluginBoxNameCell {font-weight:bold;}
+
+.languageBox {background-color:#ddd;}
+.languageName {color:black;}
+.languageDefault {background-color:#dbe8f3;} \ No newline at end of file
diff --git a/admin/themes/default/default-layout.css b/admin/themes/default/default-layout.css
index 0bebba5ea..638269d37 100644
--- a/admin/themes/default/default-layout.css
+++ b/admin/themes/default/default-layout.css
@@ -808,3 +808,9 @@ h2:lang(en) { text-transform:capitalize; }
.pluginBox table {width:99%}
.pluginBox td {text-align:left;}
.pluginBoxNameCell {width:150px; vertical-align:top;}
+
+.languageBoxes {min-height:0;text-align:left;}
+.languageBox {display:inline-table; text-align:center; width:200px; height:40px; margin:5px; -moz-border-radius:5px; overflow:hidden; }
+.languageName {font-size:1.1em; margin:5px 0;}
+.languageActions {display: table-row; font-size:12px; }
+.languageActions DIV {display: table-cell; vertical-align: middle; line-height:18px; }
diff --git a/admin/themes/default/template/footer.tpl b/admin/themes/default/template/footer.tpl
index f1c3694a8..f287bab0e 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, .themeActions SPAN').tipTip({
+ $('#pwgHead A, #footer A, .themeActions A, .themeActions SPAN, .languageActions A, .languageActions SPAN').tipTip({
'delay' : 0,
'fadeIn' : 200,
'fadeOut' : 200,
diff --git a/admin/themes/default/template/languages_installed.tpl b/admin/themes/default/template/languages_installed.tpl
index 493d1edda..381e87e8e 100644
--- a/admin/themes/default/template/languages_installed.tpl
+++ b/admin/themes/default/template/languages_installed.tpl
@@ -2,33 +2,45 @@
<h2>{'Installed Languages'|@translate}</h2>
</div>
-<table class="table2 languages">
-<thead>
- <tr class="throw">
- <td>{'Language'|@translate}</td>
- <td>{'Actions'|@translate}</td>
- </tr>
-</thead>
+{foreach from=$language_states item=language_state}
+<fieldset>
+ <legend>
+ {if $language_state == 'active'}
+ {'Active Languages'|@translate}
-{foreach from=$languages item=language name=languages_loop}
- <tr class="{if $smarty.foreach.languages_loop.index is odd}row1{else}row2{/if}">
- <td class="{$language.STATE}">
- {$language.NAME}
- {if $language.IS_DEFAULT}<i>({'Default'|@translate})</i>{/if}
- </td>
- <td style="text-align: center;">
- {if !$language.IS_DEFAULT}
- {if $language.STATE == 'active' or $language.STATE == 'missing'}
- <a href="{$language.U_ACTION}&amp;action=deactivate">{'Deactivate'|@translate}</a> |
- <a href="{$language.U_ACTION}&amp;action=set_default">{'Default'|@translate}</a>
- {else}
- <a href="{$language.U_ACTION}&amp;action=activate">{'Activate'|@translate}</a> |
- <a href="{$language.U_ACTION}&amp;action=delete" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Delete'|@translate}</a>
+ {elseif $language_state == 'inactive'}
+ {'Inactive Languages'|@translate}
+
+ {/if}
+ </legend>
+ <div class="languageBoxes">
+ {foreach from=$languages item=language}
+ {if $language.state == $language_state}
+ <div class="languageBox{if $language.is_default} languageDefault{/if}">
+ <div class="languageName">{$language.name}{if $language.is_default} <em>({'default'|@translate})</em>{/if}</div>
+ <div class="languageActions">
+ <div>
+ {if $language_state == 'active'}
+ {if $language.deactivable}
+ <a href="{$language.u_action}&amp;action=deactivate" title="{'Forbid this language to users'|@translate}">{'Deactivate'|@translate}</a>
+ {else}
+ <span title="{$language.deactivate_tooltip}">{'Deactivate'|@translate}</span>
+ {/if}
+
+ {if not $language.is_default}
+ | <a href="{$language.u_action}&amp;action=set_default" title="{'Set as default language for unregistered and new users'|@translate}">{'Default'|@translate}</a>
+ {/if}
+ {/if}
+
+ {if $language_state == 'inactive'}
+ <a href="{$language.u_action}&amp;action=activate" title="{'Make this language available to users'|@translate}">{'Activate'|@translate}</a>
+ | <a href="{$language.u_action}&amp;action=delete" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');" title="{'Delete this language'|@translate}">{'Delete'|@translate}</a>
{/if}
- {else}
- ---
+ </div>
+ </div> <!-- languageActions -->
+ </div> <!-- languageBox -->
{/if}
- </td>
- </tr>
+ {/foreach}
+ </div> <!-- languageBoxes -->
+</fieldset>
{/foreach}
-</table> \ No newline at end of file
diff --git a/admin/themes/roma/theme.css b/admin/themes/roma/theme.css
index 54630a4b9..722f1770b 100644
--- a/admin/themes/roma/theme.css
+++ b/admin/themes/roma/theme.css
@@ -230,7 +230,7 @@ html>body #menubar {min-height:522px; height:522px;} /* IE 7 and modern browsers
.themeBox {background-color:#333;}
.themeBox IMG {border:1px solid #666;}
-.themeName {color:white;}
+.themeName {color:#ccc;}
.themeActions A {border-bottom:none;}
.themeDefault {background-color:#555;}
@@ -242,3 +242,7 @@ html>body #menubar {min-height:522px; height:522px;} /* IE 7 and modern browsers
.pluginBox {background-color:#333;color:#999}
.pluginBoxNameCell {color:#ccc;}
+
+.languageBox {background-color:#333;}
+.languageName {color:#ccc;}
+.languageDefault {background-color:#555; color:#aaa;} \ No newline at end of file