1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
|
<?php
/*
$Id: ml_pulldown.inc,v 1.52.2.1 2005/03/10 02:30:07 cryptographite Exp $
Gallery - a web based photo album viewer and editor
Copyright (C) 2000-2005 Bharat Mediratta
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; either version 2 of the License, or (at
your option) any later version.
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.
*/
?>
<?php
global $GALLERY_EMBEDDED_INSIDE, $GALLERY_EMBEDDED_INSIDE_TYPE;
/* This "block" inserts either a combobox with available languages or show flags for them.
** Both are only displayed if at least 2 languages are available.
*/
if ($gallery->app->ML_mode == 3 && !$gallery->session->offline && sizeof($gallery->app->available_lang) > 1) {
if($gallery->app->show_flags !='yes') {?>
<script language="JavaScript" type="text/javascript">
function ML_reload() {
var newlang=document.MLForm.newlang[document.MLForm.newlang.selectedIndex].value ;
window.location.href=newlang;
}
</script>
<?php
}
?>
<form name="MLForm" action="#" style="margin-bottom: 0px;">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" align="right">
<?php
if($gallery->app->show_flags !='yes') {
echo "\t\t". '<select style="font-size:8pt;" name="newlang" onChange="ML_reload()" size="1">';
}
$nls = getNLS();
$count=0;
$half=sizeof($gallery->app->available_lang)/2;
foreach ($gallery->app->available_lang as $value) {
/*
** We only allow show languages which are available in gallery.
** These could differ to the languages defined in config.php.
*/
if (! isset($nls['language'][$value])) continue;
$count++;
$args = isset($_GET) ? $_GET : array();
if (isset($GALLERY_EMBEDDED_INSIDE) && $GALLERY_EMBEDDED_INSIDE=='nuke') {
if ($GALLERY_EMBEDDED_INSIDE_TYPE == 'postnuke') {
/* postnuke */
if (! isset($nls['postnuke'][$value])) continue;
$new_lang=$nls['postnuke'][$value];
}
else {
/* phpNuke, nsnNuke or cpgNuke */
if (! isset($nls['phpnuke'][$value])) continue;
$new_lang=$nls['phpnuke'][$value];
}
} else {
$new_lang=$value;
}
/* now we buil the URL according to the new language */
$request_url=$_SERVER['REQUEST_URI'];
$pos=strpos($request_url, "newlang");
if ($pos >0) {
$request_url=substr($request_url,0,$pos-1);
}
if (stristr($request_url,"?")) {
$url=$request_url ."&newlang=". $new_lang;
}
else {
$url=$request_url ."?newlang=". $new_lang;
}
$url = htmlspecialchars($url);
/* Show pulldown or flags */
if($gallery->app->show_flags !='yes') {
if ($gallery->language == $value) $selected="selected"; else $selected="";
echo "\n\t\t<option value=\"$url\" $selected>" . $nls['language'][$value] ."</option>";
} else {
$flagname=$value;
echo "\n\t\t";
if ($gallery->language != $value) {
$style="";
echo "<a href=\"$url\">";
}
else {
$style="style=\"margin:7px\"";
}
echo "<img $style src=\"". $gallery->app->photoAlbumURL . "/locale/$flagname/flagimage/$flagname.gif\" border=\"1\" alt=\"" .$nls['language'][$value] . "\" title=\"" .$nls['language'][$value] . "\">";
if ($gallery->language != $value) {
echo "</a>";
}
if ($count > $half && $half >10) {
echo "<br>";
$count=0;
}
}
}
if($gallery->app->show_flags !='yes') {
echo "\n\t\t</select>";
}
?>
</td>
</tr>
</table>
</form>
<?php } ?>
|