Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions LangCodes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
/**
* @author: Cesar Hernandez
* getLanguage: This method return the name of the language according to the language code
*/
class LangCodes{
public function getLanguage($code){
$all_lang=array(
'fr_FR'=>'fr_FR',
'en_US'=>'en_US'//,
//'zh_CN'=>'zh_CN',
//'zh_TW'=>'zh_TW',
//'de_DE'=>'de_DE'
);
return array_key_exists($code, $all_lang) ? $all_lang[$code] : "en_US";
}
public function getNameLang($code_lang){
$name_lang=array(
'fr_FR'=>'Français',
'en_US'=>'English'//,
//'zh_CN'=>'中文 (中国)',
//'zh_TW'=>'中文 (台灣)',
//'de_DE'=>'Deutsch'
);
return array_key_exists($code_lang, $name_lang) ? $name_lang[$code_lang] : "English";
}
}
?>
Binary file removed images/angelfishlogo.gif
Binary file not shown.
Binary file removed images/angelfishlogo_over.gif
Binary file not shown.
Binary file added images/authpage.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/back-header.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/background.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/bg-gray-texture.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed images/butterflyfishlogo.gif
Binary file not shown.
Binary file removed images/butterflyfishlogo_over.gif
Binary file not shown.
Binary file removed images/clownfishlogo.gif
Binary file not shown.
Binary file removed images/clownfishlogo_over.gif
Binary file not shown.
Binary file modified images/favicon.ico
Binary file not shown.
Binary file added images/icon-licensing-hover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon-licensing-off.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon-licensing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon-management-hover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon-management-off.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon-management.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon-organizations-hover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon-organizations-off.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon-organizations.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon-resources-hover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon-resources-off.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon-resources.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon-usage-hover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon-usage-off.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon-usage.png
Binary file added images/licensing-title-hover.png
Binary file added images/licensing-title-off.png
Binary file added images/licensing-title.png
Binary file modified images/licensing.gif
Binary file modified images/licensing_off.gif
Binary file modified images/licensing_over.gif
Binary file added images/login.gif
Binary file added images/logo-coral.jpg
Binary file added images/logo-powered-by.jpg
Binary file added images/organizations-title-hover.png
Binary file added images/organizations-title-off.png
Binary file added images/organizations-title.png
Binary file modified images/organizations.gif
Binary file modified images/organizations_off.gif
Binary file modified images/organizations_over.gif
Binary file added images/resources-title-hover.png
Binary file added images/resources-title-off.png
Binary file added images/resources-title.png
Binary file modified images/resources.gif
Binary file modified images/resources_off.gif
Binary file modified images/resources_over.gif
Binary file removed images/seahorselogo.gif
Diff not rendered.
Binary file removed images/seahorselogo.jpg
Diff not rendered.
Binary file removed images/seahorselogo_over.gif
Diff not rendered.
Binary file added images/title-main-small.png
Binary file added images/title-main.png
Binary file removed images/turtlelogo.gif
Diff not rendered.
Binary file removed images/turtlelogo_over.gif
Diff not rendered.
Binary file added images/usage-title-hover.png
Binary file added images/usage-title-off.png
Binary file added images/usage-title.png
Binary file modified images/usagestatistics.gif
Binary file modified images/usagestatistics_off.gif
Binary file modified images/usagestatistics_over.gif
224 changes: 175 additions & 49 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,82 +1,208 @@
<?php
//determine CORAL main path so we can check each module below to know which to display
$pagePath = $_SERVER["DOCUMENT_ROOT"];
//determine CORAL main path so we can check each module below to know which to display
$pagePath = $_SERVER["DOCUMENT_ROOT"];

$currentFile = $_SERVER["SCRIPT_NAME"];
$parts = Explode('/', $currentFile);
for($i=0; $i<count($parts) - 1; $i++){
$pagePath .= $parts[$i] . '/';
}
$currentFile = $_SERVER["SCRIPT_NAME"];
$parts = Explode('/', $currentFile);
for($i=0; $i<count($parts) - 1; $i++){
$pagePath .= $parts[$i] . '/';
}

session_start();

// Include file of language codes
include_once 'LangCodes.php';
$lang_name = new LangCodes();

// Verify the language of the browser
global $http_lang;
if(isset($_COOKIE["lang"])){
$http_lang = $_COOKIE["lang"];
}else{
$codeL = str_replace("-","_",substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,5));
$http_lang = $lang_name->getLanguage($codeL);
if($http_lang == "")
$http_lang = "en_US";
}
putenv("LC_ALL=$http_lang");
setlocale(LC_ALL, $http_lang.".utf8");
bindtextdomain("messages", dirname(__FILE__) . "/locale");
textdomain("messages");
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CORAL - Centralized Online Resources Acquisitions and Licensing</title>
<title>eRM - eResource Management</title>
<link rel="stylesheet" href="indexstyle.css" type="text/css" media="screen" />
<link rel="SHORTCUT ICON" href="images/favicon.ico" />
<script type="text/javascript" src="js/plugins/jquery.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="js/plugins/Gettext.js"></script>

<?php
// Add translation for the JavaScript files
global $http_lang;
$str = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,5);
$default_l = $lang_name->getLanguage($str);
if($default_l==null || empty($default_l)){$default_l=$str;}
if(isset($_COOKIE["lang"])){
if($_COOKIE["lang"]==$http_lang && $_COOKIE["lang"] != "en_US"){
echo "<link rel='gettext' type='application/x-po' href='./locale/".$http_lang."/LC_MESSAGES/messages.po' />";
}
}else if($default_l==$http_lang && $default_l != "en_US"){
echo "<link rel='gettext' type='application/x-po' href='./locale/".$http_lang."/LC_MESSAGES/messages.po' />";
}
?>

</head>
<body>
<center>
<table class="background">
<tr>
<td>
<center>
<table style='margin-top:123px;width:560px;height:420px;'>
<tr valign='top' style='height:356px;'>
<td>
<center>
<div style='margin-top:12px;'>
<table class='logos'>

<tr>

<div id="wrapper-main">

<div id="title-main">
<div id="main-page-title"><strong><?php echo _("eRM");?></strong> &bullet; <?php echo _("eResource Management");?></div>
<div class='boxRight'>
<p class="fontText"><?= _("Change language:");?></p>
<select name="lang" id="lang" class="dropDownLang">
<?php
// Get all translations on the 'locale' folder
$route='locale';
$lang[]="en_US"; // add default language
if (is_dir($route)) {
if ($dh = opendir($route)) {
while (($file = readdir($dh)) !== false) {
if (is_dir("$route/$file") && $file!="." && $file!=".."){
$lang[]=$file;
}
}
closedir($dh);
}
}else {
echo "<br>"._("Invalid translation route!");
}
// Get language of navigator
$defLang = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,5);

// Show an ordered list
sort($lang);
for($i=0; $i<count($lang); $i++){
if(isset($_COOKIE["lang"])){
if($_COOKIE["lang"]==$lang[$i]){
echo "<option value='".$lang[$i]."' selected='selected'>".$lang_name->getNameLang($lang[$i])."</option>";
}else{
echo "<option value='".$lang[$i]."'>".$lang_name->getNameLang($lang[$i])."</option>";
}
}else{
if($defLang==substr($lang[$i],0,5)){
echo "<option value='".$lang[$i]."' selected='selected'>".$lang_name->getNameLang($lang[$i])."</option>";
}else{
echo "<option value='".$lang[$i]."'>".$lang_name->getNameLang($lang[$i])."</option>";
}
}
}
?>
</select>
</div>
</div>
</div>

<div class="icons">

<div class='main-page-icons'>
<?php if (file_exists($pagePath . "resources/index.php")) {?>
<td style='width:52px;'><img src='images/butterflyfishlogo.gif' hover="images/butterflyfishlogo_over.gif" id="logo_butterflyfish" /></td><td style='width:194px;'><a href='resources/'><img src='images/resources.gif' hover="images/resources_over.gif" class="rollover" id="butterflyfish" /></a></td>
<a href='resources/'>
<img src='images/icon-resources.png' hover="images/icon-resources-hover.png" class="rollover" />
<span><?php echo _("Resources");?></span>
</a>
<?php } else { ?>
<td style='width:52px;'><img src='images/butterflyfishlogo.gif' /></td><td style='width:194px;'><img src='images/resources_off.gif' id="butterflyfish" /></td>
<div class='main-page-icons-off'>
<img src='images/icon-resources-off.png'>
<span><?php echo _("Resources");?></span>
</div>
<?php } ?>
</tr>
</div>

<tr>

<div class='main-page-icons'>
<?php if (file_exists($pagePath . "licensing/index.php")) {?>
<td style='width:52px;'><img src='images/angelfishlogo.gif' hover="images/angelfishlogo_over.gif" id="logo_angelfish" /></td><td style='width:194px;'><a href='licensing/'><img src='images/licensing.gif' hover="images/licensing_over.gif" class="rollover" id="angelfish" /></a></td>
<a href='licensing/'>
<img src='images/icon-licensing.png' hover="images/icon-licensing-hover.png" class="rollover" />
<span><?php echo _("Licensing");?></span>
</a>
<?php } else { ?>
<td style='width:52px;'><img src='images/angelfishlogo.gif' /></td><td style='width:194px;'><img src='images/licensing_off.gif' id="angelfish" /></td>
<div class='main-page-icons-off'>
<img src='images/icon-licensing-off.png' />
<span><?php echo _("Licensing");?></span>
</div>
<?php } ?>
</tr>
</div>

<tr>
<div class='main-page-icons'>
<?php if (file_exists($pagePath . "organizations/index.php")) {?>
<td style='width:52px;'><img src='images/turtlelogo.gif' hover="images/turtlelogo_over.gif" id="logo_turtle" /></td><td style='width:194px;'><a href='organizations/'><img src='images/organizations.gif' hover="images/organizations_over.gif" class="rollover" id="turtle" /></a></td>
<a href='organizations/'>
<img src='images/icon-organizations.png' hover="images/icon-organizations-hover.png" class="rollover" />
<span><?php echo _("Organizations");?></span>
</a>
<?php } else { ?>
<td style='width:52px;'><img src='images/turtlelogo.gif' /></td><td style='width:194px;'><img src='images/organizations_off.gif' id="angelfish" /></td>
<div class='main-page-icons-off'>
<img src='images/icon-organizations-off.png' />
<span><?php echo _("Organizations");?></span>
</div>
<?php } ?>
</tr>
</div>

<tr>
<div class='main-page-icons'>
<?php if (file_exists($pagePath . "usage/index.php")) {?>
<td style='width:52px;'><img src='images/seahorselogo.gif' hover="images/seahorselogo_over.gif" id="logo_seahorse" /></td><td style='width:194px;'><a href='usage/'><img src='images/usagestatistics.gif' hover="images/usagestatistics_over.gif" class="rollover" id="seahorse" /></a></td>
<a href='usage/'>
<img src='images/icon-usage.png' hover="images/icon-usage-hover.png" class="rollover" />
<span><?php echo _("Usage Statistics");?></span>
</a>
<?php } else { ?>
<div class='main-page-icons-off'>
<img src='images/icon-usage-off.png' />
<span><?php echo _("Usage Statistics");?></span>
</div>
<?php } ?>
</div>

<div class='main-page-icons'>
<?php if (file_exists($pagePath . "management/index.php")) {?>
<a href='management/'>
<img src='images/icon-management.png' hover="images/icon-management-hover.png" class="rollover" />
<span><?php echo _("Management");?></span>
</a>
<?php } else { ?>
<td style='width:52px;'><img src='images/seahorselogo.gif' /></td><td style='width:194px;'><img src='images/usagestatistics_off.gif' id="angelfish" /></td>
<div class='main-page-icons-off'>
<img src='images/icon-management-off.png' />
<span><?php echo _("Management");?></span>
</div>
<?php } ?>
</tr>
</table>

</div>
</center>
</td>
</tr>
</table>
</center>
</td>
</tr>
</table>

</center>
</div>

</div>

<div id="powered-by-text"><?php echo _("Powered by");?><img src="images/logo-coral.jpg" /></div>


<script>
/*
* Functions to change the language with the dropdown
*/
$("#lang").change(function() {
setLanguage($("#lang").val());
location.reload();
});
// Create a cookie with the code of language
function setLanguage(lang) {
var wl = window.location, now = new Date(), time = now.getTime();
var cookievalid=2592000000; // 30 days (1000*60*60*24*30)
time += cookievalid;
now.setTime(time);
document.cookie ='lang='+lang+';path=/'+';domain='+wl.host+';expires='+now;
}
</script>
</body>
</html>
Loading