diff options
author | vdigital <vdigital@piwigo.org> | 2009-05-29 21:26:27 +0000 |
---|---|---|
committer | vdigital <vdigital@piwigo.org> | 2009-05-29 21:26:27 +0000 |
commit | b31faf23b521417ca2bc5dbcea24f5f13608214b (patch) | |
tree | 1b805fc3703f6a1997f9cae2312693b247b96598 /plugins/language_switch | |
parent | b6ed391396c02b2ccaf67a65649cbe363b644442 (diff) |
+ Language Switch enhanced design and concepts.
git-svn-id: http://piwigo.org/svn/branches/2.0@3368 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'plugins/language_switch')
42 files changed, 134 insertions, 32 deletions
diff --git a/plugins/language_switch/flags.tpl b/plugins/language_switch/flags.tpl new file mode 100644 index 000000000..7a30553ee --- /dev/null +++ b/plugins/language_switch/flags.tpl @@ -0,0 +1,48 @@ +</ul> +<ul class="categoryActions"> +<li class="menuf"> + <div> + <ul> + <li> + <a rel="nofollow" href="#"> + <img class="flags" src="{$lang_switch.Active.img}" alt="{$lang_switch.Active.alt}" title="{$lang_switch.Active.alt}"/> + </a> + <!--[if lte IE 6]> + <a rel="nofollow" href="#"> + <img class="flags" src="{$lang_switch.Active.img}" alt="{$lang_switch.Active.alt}" title="{$lang_switch.Active.alt}"/> + <table> + <tr> + <td> + <![endif]--> + <ul class="flag-pan"> + {foreach from=$lang_switch.flags key=code item=flag name=f} + <li> + <a rel="nofollow" href="{$flag.url}"> + <img class="flags" src="{$flag.img}" alt="{$flag.alt}" title="{$flag.alt}"/> + </a> + </li> + {/foreach} + </ul> + <!--[if lte IE 6]> + </td> + </tr> + </table> + </a> + <![endif]--> + </li> + </ul> + </div> +</li> +{html_head} +{if $themeconf.template=='yoga' and $themeconf.theme=='Sylvia'} +<link rel="stylesheet" type="text/css" href="{$LANGUAGE_SWITCH_PATH|@cat:'language_switch.css'}"> +{else} +<link rel="stylesheet" type="text/css" href="{$LANGUAGE_SWITCH_PATH|@cat:'language_switch-default.css'}"> +{/if} +{if Componant_exists($LANGUAGE_SWITCH_PATH, 'language_switch-local.css')} +<link rel="stylesheet" type="text/css" href="{$LANGUAGE_SWITCH_PATH|@cat:'language_switch-local.css'}"> +{/if} +<!--[if lte IE 6]> +<link rel="stylesheet" type="text/css" href="{$LANGUAGE_SWITCH_PATH|@cat:'language_switch-ie6.css'}"> +<![endif]--> +{/html_head}
\ No newline at end of file diff --git a/plugins/language_switch/icons/bg_BG.gif b/plugins/language_switch/icons/bg_BG.gif Binary files differdeleted file mode 100644 index 87b63669e..000000000 --- a/plugins/language_switch/icons/bg_BG.gif +++ /dev/null diff --git a/plugins/language_switch/icons/bg_BG.jpg b/plugins/language_switch/icons/bg_BG.jpg Binary files differnew file mode 100644 index 000000000..1cad87973 --- /dev/null +++ b/plugins/language_switch/icons/bg_BG.jpg diff --git a/plugins/language_switch/icons/cz_CZ.gif b/plugins/language_switch/icons/cz_CZ.gif Binary files differdeleted file mode 100644 index 89686c417..000000000 --- a/plugins/language_switch/icons/cz_CZ.gif +++ /dev/null diff --git a/plugins/language_switch/icons/cz_CZ.jpg b/plugins/language_switch/icons/cz_CZ.jpg Binary files differnew file mode 100644 index 000000000..3222866cd --- /dev/null +++ b/plugins/language_switch/icons/cz_CZ.jpg diff --git a/plugins/language_switch/icons/da_DK.jpg b/plugins/language_switch/icons/da_DK.jpg Binary files differnew file mode 100644 index 000000000..8c98a892b --- /dev/null +++ b/plugins/language_switch/icons/da_DK.jpg diff --git a/plugins/language_switch/icons/de_DE.gif b/plugins/language_switch/icons/de_DE.gif Binary files differdeleted file mode 100644 index 9b3009565..000000000 --- a/plugins/language_switch/icons/de_DE.gif +++ /dev/null diff --git a/plugins/language_switch/icons/de_DE.jpg b/plugins/language_switch/icons/de_DE.jpg Binary files differnew file mode 100644 index 000000000..da843ade8 --- /dev/null +++ b/plugins/language_switch/icons/de_DE.jpg diff --git a/plugins/language_switch/icons/en_UK.gif b/plugins/language_switch/icons/en_UK.gif Binary files differdeleted file mode 100644 index 51b20e3c1..000000000 --- a/plugins/language_switch/icons/en_UK.gif +++ /dev/null diff --git a/plugins/language_switch/icons/en_UK.jpg b/plugins/language_switch/icons/en_UK.jpg Binary files differnew file mode 100644 index 000000000..ad551d898 --- /dev/null +++ b/plugins/language_switch/icons/en_UK.jpg diff --git a/plugins/language_switch/icons/es_AR.gif b/plugins/language_switch/icons/es_AR.gif Binary files differdeleted file mode 100644 index 677979bc5..000000000 --- a/plugins/language_switch/icons/es_AR.gif +++ /dev/null diff --git a/plugins/language_switch/icons/es_AR.jpg b/plugins/language_switch/icons/es_AR.jpg Binary files differnew file mode 100644 index 000000000..c4cb89682 --- /dev/null +++ b/plugins/language_switch/icons/es_AR.jpg diff --git a/plugins/language_switch/icons/es_ES.gif b/plugins/language_switch/icons/es_ES.gif Binary files differdeleted file mode 100644 index d0d5adbbb..000000000 --- a/plugins/language_switch/icons/es_ES.gif +++ /dev/null diff --git a/plugins/language_switch/icons/es_ES.jpg b/plugins/language_switch/icons/es_ES.jpg Binary files differnew file mode 100644 index 000000000..2f3b9ceb4 --- /dev/null +++ b/plugins/language_switch/icons/es_ES.jpg diff --git a/plugins/language_switch/icons/fr_FR.gif b/plugins/language_switch/icons/fr_FR.gif Binary files differdeleted file mode 100644 index 9080a66bf..000000000 --- a/plugins/language_switch/icons/fr_FR.gif +++ /dev/null diff --git a/plugins/language_switch/icons/fr_FR.jpg b/plugins/language_switch/icons/fr_FR.jpg Binary files differnew file mode 100644 index 000000000..c93b5e61e --- /dev/null +++ b/plugins/language_switch/icons/fr_FR.jpg diff --git a/plugins/language_switch/icons/hr_HR.gif b/plugins/language_switch/icons/hr_HR.gif Binary files differdeleted file mode 100644 index 08b574745..000000000 --- a/plugins/language_switch/icons/hr_HR.gif +++ /dev/null diff --git a/plugins/language_switch/icons/hr_HR.jpg b/plugins/language_switch/icons/hr_HR.jpg Binary files differnew file mode 100644 index 000000000..9089cd608 --- /dev/null +++ b/plugins/language_switch/icons/hr_HR.jpg diff --git a/plugins/language_switch/icons/hu_HU.gif b/plugins/language_switch/icons/hu_HU.gif Binary files differdeleted file mode 100644 index 4eb513589..000000000 --- a/plugins/language_switch/icons/hu_HU.gif +++ /dev/null diff --git a/plugins/language_switch/icons/hu_HU.jpg b/plugins/language_switch/icons/hu_HU.jpg Binary files differnew file mode 100644 index 000000000..e9bbc459e --- /dev/null +++ b/plugins/language_switch/icons/hu_HU.jpg diff --git a/plugins/language_switch/icons/index.php b/plugins/language_switch/icons/index.php deleted file mode 100644 index 871b52b6a..000000000 --- a/plugins/language_switch/icons/index.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php -// +-----------------------------------------------------------------------+ -// | Piwigo - a PHP based picture gallery | -// +-----------------------------------------------------------------------+ -// | Copyright(C) 2008-2009 Piwigo Team http://piwigo.org | -// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | -// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | -// +-----------------------------------------------------------------------+ -// | This program is free software; you can redistribute it and/or modify | -// | it under the terms of the GNU General Public License as published by | -// | the Free Software Foundation | -// | | -// | This program is distributed in the hope that it will be useful, but | -// | WITHOUT ANY WARRANTY; without even the implied warranty of | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | -// | General Public License for more details. | -// | | -// | You should have received a copy of the GNU General Public License | -// | along with this program; if not, write to the Free Software | -// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | -// | USA. | -// +-----------------------------------------------------------------------+ - -// Recursive call -$url = '../'; -header( 'Request-URI: '.$url ); -header( 'Content-Location: '.$url ); -header( 'Location: '.$url ); -exit(); -?> diff --git a/plugins/language_switch/icons/it_IT.gif b/plugins/language_switch/icons/it_IT.gif Binary files differdeleted file mode 100644 index 0ee512d4c..000000000 --- a/plugins/language_switch/icons/it_IT.gif +++ /dev/null diff --git a/plugins/language_switch/icons/it_IT.jpg b/plugins/language_switch/icons/it_IT.jpg Binary files differnew file mode 100644 index 000000000..dd9bbb95c --- /dev/null +++ b/plugins/language_switch/icons/it_IT.jpg diff --git a/plugins/language_switch/icons/ja_JP.gif b/plugins/language_switch/icons/ja_JP.gif Binary files differdeleted file mode 100644 index b582257d2..000000000 --- a/plugins/language_switch/icons/ja_JP.gif +++ /dev/null diff --git a/plugins/language_switch/icons/ja_JP.jpg b/plugins/language_switch/icons/ja_JP.jpg Binary files differnew file mode 100644 index 000000000..02336b394 --- /dev/null +++ b/plugins/language_switch/icons/ja_JP.jpg diff --git a/plugins/language_switch/icons/mg_MG.gif b/plugins/language_switch/icons/mg_MG.gif Binary files differdeleted file mode 100644 index 1c840948d..000000000 --- a/plugins/language_switch/icons/mg_MG.gif +++ /dev/null diff --git a/plugins/language_switch/icons/mg_MG.jpg b/plugins/language_switch/icons/mg_MG.jpg Binary files differnew file mode 100644 index 000000000..c2c96df83 --- /dev/null +++ b/plugins/language_switch/icons/mg_MG.jpg diff --git a/plugins/language_switch/icons/nl_NL.gif b/plugins/language_switch/icons/nl_NL.gif Binary files differdeleted file mode 100644 index 520e994b7..000000000 --- a/plugins/language_switch/icons/nl_NL.gif +++ /dev/null diff --git a/plugins/language_switch/icons/nl_NL.jpg b/plugins/language_switch/icons/nl_NL.jpg Binary files differnew file mode 100644 index 000000000..0c90262fe --- /dev/null +++ b/plugins/language_switch/icons/nl_NL.jpg diff --git a/plugins/language_switch/icons/pl_PL.gif b/plugins/language_switch/icons/pl_PL.gif Binary files differdeleted file mode 100644 index 66f140606..000000000 --- a/plugins/language_switch/icons/pl_PL.gif +++ /dev/null diff --git a/plugins/language_switch/icons/pl_PL.jpg b/plugins/language_switch/icons/pl_PL.jpg Binary files differnew file mode 100644 index 000000000..34a1ff3c5 --- /dev/null +++ b/plugins/language_switch/icons/pl_PL.jpg diff --git a/plugins/language_switch/icons/pt_PT.gif b/plugins/language_switch/icons/pt_PT.gif Binary files differdeleted file mode 100644 index c3127b148..000000000 --- a/plugins/language_switch/icons/pt_PT.gif +++ /dev/null diff --git a/plugins/language_switch/icons/pt_PT.jpg b/plugins/language_switch/icons/pt_PT.jpg Binary files differnew file mode 100644 index 000000000..b9dd503d4 --- /dev/null +++ b/plugins/language_switch/icons/pt_PT.jpg diff --git a/plugins/language_switch/icons/ru_RU.gif b/plugins/language_switch/icons/ru_RU.gif Binary files differdeleted file mode 100644 index 39e20a8ba..000000000 --- a/plugins/language_switch/icons/ru_RU.gif +++ /dev/null diff --git a/plugins/language_switch/icons/ru_RU.jpg b/plugins/language_switch/icons/ru_RU.jpg Binary files differnew file mode 100644 index 000000000..f2286f8e3 --- /dev/null +++ b/plugins/language_switch/icons/ru_RU.jpg diff --git a/plugins/language_switch/icons/zh_CN.gif b/plugins/language_switch/icons/zh_CN.gif Binary files differdeleted file mode 100644 index bfcae5cce..000000000 --- a/plugins/language_switch/icons/zh_CN.gif +++ /dev/null diff --git a/plugins/language_switch/icons/zh_CN.jpg b/plugins/language_switch/icons/zh_CN.jpg Binary files differnew file mode 100644 index 000000000..fbcb52df5 --- /dev/null +++ b/plugins/language_switch/icons/zh_CN.jpg diff --git a/plugins/language_switch/language_switch-default.css b/plugins/language_switch/language_switch-default.css new file mode 100644 index 000000000..4f7872db3 --- /dev/null +++ b/plugins/language_switch/language_switch-default.css @@ -0,0 +1,15 @@ +.flag-pan { width:132px; z-index:100; border-width:1px; border-style: solid; background-color: #999; padding: 2px 5px 10px 5px; } +.content ul.categoryActions .flag-pan a img.flags { margin: 5px 2px 10px; } +.content ul.categoryActions .flag-pan a { margin: 0; } +.menuf { width:30px; height:24px; display: inline; } +.menuf ul li a, .menuf ul li a:visited {display:block; text-decoration:none; width:44px; height:27px; text-align:center; line-height:27px; overflow:hidden;} +.menuf ul {padding:0; margin:0; list-style: none;} +.menuf ul li {float:left; position:relative; right: 0; top: 0;} +.menuf ul li ul {display: none;}/* specific to non IE browsers */ +.menuf li a:hover { border:0 !important;} +.menuf .flags {border-width:1px !important; ; border-style: solid !important; } +.menuf ul li:hover ul {display:block; position:absolute; top:0px; left:-96px; } +.menuf ul li:hover ul li ul {display: none;} +.menuf ul li:hover ul li {display: block;} +.menuf ul li:hover ul li a {display:block;} +.menuf ul li:hover ul li:hover ul {display:block; position:absolute; left:0px; top:0;}
\ No newline at end of file diff --git a/plugins/language_switch/language_switch-ie6.css b/plugins/language_switch/language_switch-ie6.css new file mode 100644 index 000000000..73b92a6a2 --- /dev/null +++ b/plugins/language_switch/language_switch-ie6.css @@ -0,0 +1,6 @@ +.menuf ul li a.hide, .menuf ul li a:visited.hide {display:none;} +.menuf ul li a:hover ul li a.hide {display:none;} +.menuf ul li a:hover ul { display:block; position:absolute; top:-15%; left:-85%; } +.menuf ul li a:hover ul li a {display:block; } +.menuf ul li a:hover ul li a ul {visibility:hidden;} +.menuf ul li a:hover ul li a:hover ul {visibility:visible; position:absolute; left:105px; top:0;}
\ No newline at end of file diff --git a/plugins/language_switch/language_switch.css b/plugins/language_switch/language_switch.css new file mode 100644 index 000000000..434368366 --- /dev/null +++ b/plugins/language_switch/language_switch.css @@ -0,0 +1,16 @@ +.flag-pan { width:132px; z-index:100; border:2px solid; background-color: #111; padding: 2px 5px 10px 5px; +-moz-border-radius-bottomleft:8px; -moz-border-radius-bottomright:8px; -moz-border-radius-topleft:8px; -moz-border-radius-topright:8px;} +.content ul.categoryActions .flag-pan a img.flags { margin: 5px 2px 10px; } +.content ul.categoryActions .flag-pan a { margin: 0; } +.menuf { width:30px; height:24px; display: inline; } +.menuf ul li a, .menuf ul li a:visited {display:block; text-decoration:none; width:44px; height:27px; text-align:center; line-height:27px; overflow:hidden;} +.menuf ul {padding:0; margin:0; list-style: none;} +.menuf ul li {float:left; position:relative; right: 0; top: 0;} +.menuf ul li ul {display: none;}/* specific to non IE browsers */ +.menuf li a:hover { border:0 !important;} +.menuf .flags {border:1px solid #000 !important; } +.menuf ul li:hover ul {display:block; position:absolute; top:0px; left:-96px; } +.menuf ul li:hover ul li ul {display: none;} +.menuf ul li:hover ul li {display: block;} +.menuf ul li:hover ul li a {display:block;} +.menuf ul li:hover ul li:hover ul {display:block; position:absolute; left:0px; top:0;}
\ No newline at end of file diff --git a/plugins/language_switch/language_switch.inc.php b/plugins/language_switch/language_switch.inc.php index 21a112567..07ba1e1ab 100644 --- a/plugins/language_switch/language_switch.inc.php +++ b/plugins/language_switch/language_switch.inc.php @@ -20,6 +20,8 @@ // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | // | USA. | // +-----------------------------------------------------------------------+ +if (!defined('LANGUAGE_SWITCH_PATH')) +define('LANGUAGE_SWITCH_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/'); function language_switch() { global $user, $template, $conf, $lang; @@ -66,11 +68,56 @@ function language_switch() } } //if ( isset( $_GET['lang']) ) { redirect( make_index_url() ); } - function Lang_flags() { global $user, $template; $available_lang = get_languages(); + $lsw = array(); + foreach ( $available_lang as $code => $displayname ) + { + $qlc_url = add_url_params( make_index_url(), array( 'lang' => $code ) ); + $qlc_alt = ucwords( $displayname ); + $qlc_img = 'plugins/language_switch/icons/' + . $code . '.jpg'; + if ( $code !== $user['language'] and file_exists(PHPWG_ROOT_PATH.$qlc_img) ) + { + $lsw['flags'][$code] = Array( + 'url' => $qlc_url, + 'alt' => $qlc_alt, + 'img' => $qlc_img, + ) ; + } else { + $lsw['Active'] = Array( + 'url' => $qlc_url, + 'alt' => $qlc_alt, + 'img' => $qlc_img, + ); + } + } + $template->set_filename('language_flags', dirname(__FILE__) . '/flags.tpl'); + $lsw['side'] = ceil(sqrt(count($available_lang))); + $template->assign(array( + 'lang_switch'=> $lsw, + 'LANGUAGE_SWITCH_PATH' => LANGUAGE_SWITCH_PATH, + )); + $flags = $template->parse('language_flags',true); + $template->clear_assign('lang_switch'); + $template->concat( 'PLUGIN_INDEX_ACTIONS', $flags); + // In state of making a $flags each time TODO Caching $flags[$user['language']] +} + +if (!function_exists('Componant_exists')) { + function Componant_exists($path, $file) + { + return file_exists( $path . $file); + } +} + +// Should be deleted later +function Lang_flags_previous_function() +{ + global $user, $template; + $available_lang = get_languages(); foreach ( $available_lang as $code => $displayname ) { $qlc_url = add_url_params( make_index_url(), array( 'lang' => $code ) ); diff --git a/plugins/language_switch/main.inc.php b/plugins/language_switch/main.inc.php index aaf3f20c1..c5887c364 100644 --- a/plugins/language_switch/main.inc.php +++ b/plugins/language_switch/main.inc.php @@ -23,7 +23,7 @@ /* Plugin Name: Language Switch -Version: 2.0.2 +Version: 2.0.2a Description: Switch to another language from flags on your gallery home page. Plugin URI: http://piwigo.org/ext/extension_view.php?eid=123 Author: Piwigo team |