Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SirsiDynix UI Update #13

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
0904bd9
First-Pass CSS Merge. Tabs have been replaced. I think git will take …
pontifechs Oct 7, 2015
4d8a955
CAMP-786 Removed the fish icons
DavidRappleye Nov 10, 2015
29b717f
CAMP-786 Updated the favicon links
DavidRappleye Nov 13, 2015
92d0f55
Merged localization functionality (French) into our branch
Mar 14, 2016
269f753
Language Selection Fixes for Login Screen
chisumism Mar 14, 2016
0d1da2d
Language Normalization in Drop-down
Apr 4, 2016
f572ae6
New French Translations
Apr 6, 2016
0cd80fb
Changes for additional languages
Apr 6, 2016
d0e5fab
Fixed bindtextdomain path
Apr 7, 2016
429baac
Adjusted Layout to Login Screen
chisumism Apr 8, 2016
070fc98
Merge branch 'master' of https://github.com/pontifechs/auth
chisumism Apr 8, 2016
30af909
Ryan Fixed Login Screen
Apr 8, 2016
dbb791c
Merge branch 'master' of https://github.com/pontifechs/auth
Apr 11, 2016
df12777
fixed changed default locale to get 5 characters instead of 2
Apr 11, 2016
556a5ec
Patched Security Hole
May 4, 2016
0d71fdb
Fixed Language Code -- changed all references to look at 5 characters…
Jun 13, 2016
62b3d07
Merge branch 'master' of https://github.com/pontifechs/auth
chisumism Jun 13, 2016
2379e77
Changed Title Bar to Be Translatable
chisumism Jun 13, 2016
3e8f452
Updated French Language
Jun 13, 2016
d161f3b
New Image for Title Bar
chisumism Jun 13, 2016
3d111f6
Merge branch 'master' of https://github.com/pontifechs/auth
chisumism Jun 13, 2016
f60d951
Fix for locales missing in LangCodes.php arrays
Jun 16, 2016
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
Binary file removed .DS_Store
Binary file not shown.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
admin/configuration.ini
admin/configuration.ini
.DS_Store
4 changes: 2 additions & 2 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Other restrictions
Order Allow,Deny
# Other restrictions
Order Allow,Deny
Allow from all
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";
}
}
?>
112 changes: 94 additions & 18 deletions admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@

if (isset($_SESSION['loginID'])){
$loginID=$_SESSION['loginID'];
$user = new User(new NamedArguments(array('primaryKey' => $loginID)));
}

$user = new User(new NamedArguments(array('primaryKey' => $loginID)));


if (($user->isAdmin) && ($user->getOpenSession())){
if (isset($user) && ($user->isAdmin) && ($user->getOpenSession())){

?>

Expand All @@ -42,38 +40,98 @@
<title>CORAL Authentication</title>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" />
<link rel="stylesheet" href="css/thickbox.css" type="text/css" media="screen" />
<link rel="SHORTCUT ICON" href="images/clownfishfavicon.ico" />
<link rel="SHORTCUT ICON" href="images/favicon.ico" />
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<link href='https://fonts.googleapis.com/css?family=Open+Sans:100,400,300,600,700' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="js/plugins/jquery.js"></script>
<script type="text/javascript" src="js/plugins/thickbox.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>
<noscript><font face=arial>JavaScript must be enabled in order for you to use CORAL. However, it seems JavaScript is either disabled or not supported by your browser. To use CORAL, enable JavaScript by changing your browser options, then <a href="">try again</a>. </font></noscript>
<noscript><font face=arial><?= _("JavaScript must be enabled in order for you to use CORAL. However, it seems JavaScript is either disabled or not supported by your browser. To use CORAL, enable JavaScript by changing your browser options, then")." <a href=''>"._("try again")."</a>."?></font></noscript>

<center>
<form name="reportlist" method="post" action="report.php">

<br />

<div id="title-div">
<div id="img-title"><img src="images/authtitle.png" /></div>
<div id="text-title"><?php echo _("eRM Authentication"); ?></div>
<div class="clear"></div>
</div>

<div style="width:451px; height:91px;background-image:url('images/authtitle.gif');background-repeat:no-repeat;text-align:right;">
</div>

<div class='bordered' style='width:447px;margin-left:2px;'>
<div class='bordered' style='width:416px;'>

<br />
<div class='headerText' style='text-align: left;margin:0px 60px 3px 60px;'>Users</div>
<div class='smallDarkRedText' style='margin-bottom:5px;'>* Login ID must match the login ID set up in the modules</div>
<div class='headerText' style='text-align: left;margin:0 0 3px 60px;'><?= _("Users")?></div>
<div class='smallDarkRedText' style='margin-bottom:5px;'>* <?= _("Login ID must match the login ID set up in the modules")?></div>


<div style='text-align:left;margin:0px 60px 60px 60px;' id='div_users'>
<div style='text-align:left;margin:0px 60px 60px 38px;' id='div_users'>
<br />
<br />
<img src='images/circle.gif'> <span style='font-size:90%'>Processing...</span>
<img src='images/circle.gif'> <span style='font-size:90%'><?= _("Processing...")?></span>
</div>
</div>

<div class='smallerText' style='text-align:center; margin-top:13px;'><a href='index.php'>Login page</a></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(substr($lang[$i],0,5))."</option>";
}else{
echo "<option value='".$lang[$i]."'>".$lang_name->getNameLang(substr($lang[$i],0,5))."</option>";
}
}else{
if($defLang==substr($lang[$i],0,5)){
echo "<option value='".$lang[$i]."' selected='selected'>".$lang_name->getNameLang(substr($lang[$i],0,5))."</option>";
}else{
echo "<option value='".$lang[$i]."'>".$lang_name->getNameLang(substr($lang[$i],0,5))."</option>";
}
}
}
?>
</select>
</div>
<div class='smallerText' style='text-align:center; margin-top:13px;'><a href='index.php' id='login-link'><?= _("Login page")?></a></div>


</form>
Expand All @@ -86,7 +144,23 @@
</center>
<br />
<br />

<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>
<script type="text/javascript" src="js/admin.js"></script>

</body>
Expand All @@ -97,10 +171,12 @@

}else{

if ($user->getOpenSession()){
if (isset($user) && $user->getOpenSession()){
header('Location: index.php?service=admin.php&invalid');
exit; //PREVENT SECURITY HOLE
}else{
header('Location: index.php?service=admin.php&admin');
exit; //PREVENT SECURITY HOLE
}
}

Expand Down
2 changes: 1 addition & 1 deletion admin/.htaccess
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
order deny,allow
order deny,allow
deny from all
62 changes: 31 additions & 31 deletions admin/classes/common/Configuration.php
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
<?php
/*
**************************************************************************************************************************
** CORAL Usage Statistics Reporting Module v. 1.0
**
** Copyright (c) 2010 University of Notre Dame
**
** This file is part of CORAL.
**
** CORAL 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 3 of the License, or (at your option) any later version.
**
** CORAL 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 CORAL. If not, see <http://www.gnu.org/licenses/>.
**
**************************************************************************************************************************
*/


class Configuration extends DynamicObject {

public function init(NamedArguments $arguments) {
$arguments->setDefaultValueForArgumentName('filename', BASE_DIR . '/admin/configuration.ini');
$config = parse_ini_file($arguments->filename, true);
foreach ($config as $section => $entries) {
$this->$section = Utility::objectFromArray($entries);
}
}

}

<?php
/*
**************************************************************************************************************************
** CORAL Usage Statistics Reporting Module v. 1.0
**
** Copyright (c) 2010 University of Notre Dame
**
** This file is part of CORAL.
**
** CORAL 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 3 of the License, or (at your option) any later version.
**
** CORAL 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 CORAL. If not, see <http://www.gnu.org/licenses/>.
**
**************************************************************************************************************************
*/
class Configuration extends DynamicObject {
public function init(NamedArguments $arguments) {
$arguments->setDefaultValueForArgumentName('filename', BASE_DIR . '/admin/configuration.ini');
$config = parse_ini_file($arguments->filename, true);
foreach ($config as $section => $entries) {
$this->$section = Utility::objectFromArray($entries);
}
}
}
?>
Loading