Skip to content

Commit

Permalink
Changed logon screen
Browse files Browse the repository at this point in the history
- Moved logon HTML to a template
- Created a separate CSS file for logon
- Added two default background images
- Made first scaffolding to display the background images

Issue #72
  • Loading branch information
jeroenrnl committed Apr 4, 2016
1 parent efa7aa0 commit 8271bf1
Show file tree
Hide file tree
Showing 9 changed files with 189 additions and 26 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@
# Unittests
UnitTests export-ignore
sonar-project.properties export-ignore
# binary files
*.jpg binary diff=exif
*.gif binary diff=exif
*.png binary diff=exif
3 changes: 3 additions & 0 deletions php/auth.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@
if (defined("IMAGE_PHP") && conf::get("share.enable") && !empty($hash)) {
require_once "classes/anonymousUser.inc.php";
$user = new anonymousUser();
} else if (defined("IMAGE_BG")) {
require_once "classes/anonymousUser.inc.php";
$user = new anonymousUser();
} else {
$uname = getvar("uname");
$pword = getvar("pword");
Expand Down
6 changes: 4 additions & 2 deletions php/css.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@
if (isset($_GET['logged_on'])) {
define("LOGON", true);
echo "/* This is the default CSS, the user is not logged on */";
$cssfile="logon.css";
} else {
echo "/* This is the customized CSS, user is logged on */";
$cssfile="css.php";
}
require_once "include.inc.php";
$tpl=conf::get("interface.template");
$css="templates/" . $tpl . "/css.php";
$css="templates/" . $tpl . "/" . $cssfile;
if (!file_exists($css)) {
$css="templates/default/css.php";
$css="templates/default/" . $cssfile;
}
require_once $css;

Expand Down
5 changes: 4 additions & 1 deletion php/image.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@
require_once "variables.inc.php";
$hash = getvar("hash");
$annotated = getvar('annotated');
$type = getvar("type");
if($type == "background") {
define("IMAGE_BG", 1);
}
define("IMAGE_PHP", 1);
require_once "include.inc.php";

$photo_id = getvar("photo_id");
$type = getvar("type");

if (($type=="import_thumb" || $type=="import_mid") &&
($user->isAdmin() || $user->get("import"))) {
Expand Down
30 changes: 7 additions & 23 deletions php/logon.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,10 @@

$user = new user();
$lang=$user->loadLanguage();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link TYPE="text/css" REL="stylesheet" HREF="css.php?logged_on=no">
<title><?php echo conf::get("interface.title") . ' - ' . translate("logon",0) ?></title>
</head>
<body>
<h1><?php echo translate("logon",0) ?></h1>
<div class="main" id="logon">
<form action="zoph.php" method="POST">
<h2 class="logon"><?php echo conf::get("interface.title") ?></h2>
<label for="uname"><?php echo translate("username",0) ?></label>
<input type="text" name="uname" id="uname"><br>
<label for="pword"><?php echo translate("password",0) ?></label>
<input type="password" name="pword" id="pword"><br>
<input type="hidden" name="redirect" value="<?php echo $redirect ?>">
<input type="submit" value="<?php echo translate("submit",0); ?>">
</form>
</div>
</body>
</html>

$tpl=new template("logon", array(
"title" => conf::get("interface.title"),
"redirect" => $redirect
));

echo $tpl;
Binary file added php/templates/default/images/backgrounds/fir.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
118 changes: 118 additions & 0 deletions php/templates/default/logon.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<?php
/**
* This file is part of Zoph.
*
* Zoph 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.
*
* Zoph 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 Zoph; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @author Jeroen Roos
* @package ZophTemplates
*
*/
?>

body {
font-family: Verdana, Arial, Sans-serif;
padding: 0;
margin: 0;
font-size: 10px;
}

img.background {
width: 100%;
height: 100%;
object-fit: cover;
}

body > h1 {
position: absolute;
left: 15px;
top: 0px;
font-size: 6em;
text-align: left;
color: rgba(0,0,0,0.3);
margin: 0;
}

div.logon {
position: absolute;
left: 0;
top: 0;
bottom: 0;
right: 0;
margin: auto;
background: white;
width: 300px;
height: 220px;
border-radius: 15px;
opacity: 0.95;
box-shadow: 5px 5px 5px 5px rgba(0,0,0,0.5);
background: linear-gradient(to bottom, #1e5799 0%,#7db9e8 100%);
}

div.logon h1 {
background: #1e5799;
color: white;
border-radius: 15px 15px 0 0;
padding: 10px;
margin: 0;
text-align: center;
font-size: 1.5em;
font-weight: bold;
}

div.logon label {
color: rgba(0,0,0,0.8);
display: block;
clear: both;
font-size: 1.5em;
margin: 5px 20px 0 20px;
}

div.logon input {
opacity: 0.6;
display: block;
clear: both;
}

div.logon input[type=text],
div.logon input[type=password] {
width: 256px;
height: 35px;
padding: 8px;
margin: 0 20px 5px 20px;
border: 1px solid rgba(0,0,0,0.5);
border-radius: 5px;
background: rgba(0,0,0,0.1);

}

div.logon input[type=submit] {
position: absolute;
border: none;
width: 300px;
padding: 10px;
margin: auto 0 0 0;
background: #1e5799;
color: white;
font-size: 1.5em;
font-weight: bold;
top: auto;
bottom: 0;
height: 35px;
border-radius: 0 0 15px 15px;
}

div.logon input[type=submit]:hover {
background: #7db9e8;
}
49 changes: 49 additions & 0 deletions php/templates/default/logon.tpl.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php
/**
* Template for logon screen
*
* Zoph 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.
*
* Zoph 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 Zoph; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @author Jeroen Roos
* @package ZophTemplates
*/
if (!ZOPH) {
die("Illegal call");
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link TYPE="text/css" REL="stylesheet" HREF="css.php?logged_on=no">
<title><?= $tpl_title . ' - ' . translate("logon",0) ?></title>
</head>
<body>
<img class="background" srcset="image.php?type=background 2x, image.php?type=background 1x">
<h1><?= $tpl_title ?></h1>
<div class="logon">
<h1><?= translate("logon",0)?></h1>
<form action="zoph.php" method="POST">
<label for="uname"><?= translate("username",0) ?></label>
<input type="text" name="uname" id="uname"><br>
<label for="pword"><?= translate("password",0) ?></label>
<input type="password" name="pword" id="pword"><br>
<input type="hidden" name="redirect" value="<?= $tpl_redirect ?>">
<input type="submit" value="<?= translate("submit",0); ?>">
</form>
</div>
</body>
</html>

0 comments on commit 8271bf1

Please sign in to comment.