Skip to content

Commit

Permalink
Homepage: Added sidebar and macOS downloads page
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Mar 24, 2017
1 parent 716241d commit c73b10a
Show file tree
Hide file tree
Showing 6 changed files with 270 additions and 33 deletions.
6 changes: 6 additions & 0 deletions web2/.htaccess
@@ -0,0 +1,6 @@
RewriteEngine on
RewriteBase /web2

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) $1.php [L,QSA]
163 changes: 160 additions & 3 deletions web2/include/template.inc.php
@@ -1,19 +1,29 @@
<?php

require_once('config.inc.php');
require_once('class.session.php');
require_once(DENG_API_DIR.'/include/builds.inc.php');

function generate_page_header($title)
function generate_page_header($title = NULL)
{
if ($title) {
$title = " | ".$title;
}
echo("<!DOCTYPE html>\n"
."<html lang='en'>\n"
." <head>\n"
." <meta charset='UTF-8'>\n"
." <link href='".SITE_ROOT."/theme/stylesheets/site.css' rel='stylesheet' type='text/css'>\n"
." <title>$title</title>\n"
." <title>Doomsday Engine$title</title>\n"
."</head>\n");
}

function generate_page_title($title)
{
echo("<div id='page-title'>
<h1>$title</h1>
</div>");
}

function platform_download_link()
{
switch (detect_user_platform()) {
Expand Down Expand Up @@ -53,3 +63,150 @@ function generate_download_button()
}
cache_dump();
}

function generate_download_badge($db, $file_id)
{
// Fetch all information about this file.
$result = db_query($db, "SELECT * FROM ".DB_TABLE_FILES." WHERE id=$file_id");
$file = $result->fetch_assoc();

$build = db_get_build($db, $file['build']);
$build_type = ucwords(build_type_text($build['type']));
if ($build_type == 'Candidate') {
$build_type = 'RC';
}
$version = $build['version'];

$result = db_query($db, "SELECT * FROM ".DB_TABLE_PLATFORMS." WHERE id=$file[plat_id]");
$plat = $result->fetch_assoc();

$ext = pathinfo($file['name'], PATHINFO_EXTENSION);
// Special case for making a distinction between old .dmg files.
if ($ext == 'dmg' && strpos($file['name'], '_apps') != FALSE) {
$fext = 'Applications';
}
else if ($plat['os'] == 'macx') {
$fext = $ext;
}
else {
$fext = $ext." ($plat[cpu_bits]-bit)";
}

$title = "Doomsday ".omit_zeroes($version);
if ($build['type'] != BT_STABLE) {
$title = omit_zeroes($version).' '
.$build_type." #$build[build]";
}
if ($plat['platform'] == 'source') {
$title .= " (Source)";
}
else {
$title .= " &ndash; $fext";
}
$full_title = "Doomsday ".human_version($version, $build['build'], build_type_text($build['type']))
." for ".$plat['name']." (".$plat['cpu_bits']."-bit)";
$download_url = 'http://api.dengine.net/1/builds?dl='.$file['name'];

$metadata = '<span class="metalink">';
$metadata .= '<span title="Release Date">'
.substr($build['timestamp'], 0, 10)
.'</span> &middot; ';
if ($plat['os'] != 'any') {
$metadata .= $plat['cpu_bits'].'-bit '.$plat['name'].' (or later)';
}
else {
$metadata .= "Source code .tar.gz";
}
$metadata .= '</span>';

echo('<p><div class="package_badge">'
."<a class='package_name' href='$download_url' "
."title=\"Download $full_title\">$title</a><br />"
.$metadata
."</div></p>\n");
}

function generate_badges($platform, $type)
{
// Find the latest suitable files.
$db = Session::get()->database();
$result = db_latest_files($db, $platform, $type);
$latest_build = 0;
while ($row = $result->fetch_assoc()) {
// All suitable files of the latest build will be shown.
if ($latest_build == 0) {
$latest_build = $row['build'];
}
else if ($latest_build != $row['build']) {
break;
}
generate_download_badge($db, $row['id']);
}
}

function generate_sidebar()
{
echo(
"<div id='sidebar'>
<div class='heading'><a href='".SITE_ROOT."'>About Doomsday</a></div>
<div class='heading'>Downloads</div>
<ul>
<li><a href='windows'>Windows</a></li>
<li><a href='macos'>macOS</a></li>
<li><a href='linux'>Linux</a></li>
<li><a href='source'>Source</a></li>
<li><a href='/builds'>Recent builds</a></li>
</ul>
<div class='heading'><a href='/manual'>User Manual</a></div>
<ul>
<li><a href='/manual/getting_started'>Getting started</a></li>
<li><a href='/manual/multiplayer'>Multiplayer</a></li>
</ul>
<div class='heading'>Community</div>
<ul>
<li><a href='/talk'>Forums</a></li>
<li><a href='/support'>Tech support</a></li>
<li><a href='http://facebook.com/doomsday.engine'>Facebook page</a></li>
<li><a href='/manual/other_ports'>Other ports</a></li>
</ul>
<div class='heading'>Development</div>
<ul>
<li><a href='https://tracker.dengine.net/projects/deng'>Bug Tracker</a></li>
<li><a href='https://tracker.dengine.net/projects/deng/roadmap'>Roadmap</a></li>
<li><a href='https://github.com/skyjake/Doomsday-Engine.git'>GitHub</a></li>
<li><a href='/blog/'>Blog</a></li>
<li><a href='http://twitter.com/@dengteam'>@dengteam</a></li>
</ul>
<div class='heading'><a href='http://sourceforge.net/p/deng/donate/?source=navbar' title='Donate to support the Doomsday Engine Project'>Donate &#9825;</a></div>
</div>");
}

function generate_sitemap()
{
echo("<div id='site-map'>
<ul class='map-wrapper'>
<li>
<div>Latest News</div>
<div>Latest Builds</div>
</li>
<li>
Multiplayer Games
</li>
<li>
User Manual
</li>
<li>
<div>Go to...</div>
<div>Alternatives</div>
</li>
</ul>
<div id='credits'>
Doomsday Engine is <a href='https://github.com/skyjake/Doomsday-Engine.git'>open
source software</a> and distributed under
the <a href='http://www.gnu.org/licenses/gpl.html'>GNU General Public License</a> (applications) and <a href='http://www.gnu.org/licenses/lgpl.html'>LGPL</a> (core libraries).
Assets from the original games remain under their original copyright.
Doomsday logo created by Daniel Swanson.
Website design by Jaakko Ker&auml;nen &copy; 2017.
</div>
</div>");
}
28 changes: 2 additions & 26 deletions web2/index.php
@@ -1,6 +1,6 @@
<?php
require_once('include/template.inc.php');
generate_page_header('Doomsday Engine');
generate_page_header();
?>
<body>
<?php include('include/topbar.inc.php'); ?>
Expand Down Expand Up @@ -41,29 +41,5 @@
</article>
</div>
</div>
<div id='site-map'>
<ul class='map-wrapper'>
<li>
Manual
</li>
<li>
<div>Latest news</div>
<div>Latest builds</div>
</li>
<li>
Multiplayer servers
</li>
<li>
Go to...
</li>
</ul>
<div id="credits">
Doomsday Engine is <a href="https://github.com/skyjake/Doomsday-Engine.git">open
source software</a> and distributed under
the <a href="http://www.gnu.org/licenses/gpl.html">GNU General Public License</a> (applications) and <a href="http://www.gnu.org/licenses/lgpl.html">LGPL</a> (core libraries).
Assets from the original games remain under their original copyright.
Doomsday logo created by Daniel Swanson.
Website design by Jaakko Ker&auml;nen &copy; 2017.
</div>
</div>
<?php generate_sitemap(); ?>
</body>
42 changes: 42 additions & 0 deletions web2/macos.php
@@ -0,0 +1,42 @@
<?php
require_once('include/template.inc.php');
$page_title = 'macOS Downloads';
generate_page_header($page_title);
?>
<body>
<?php
include('include/topbar.inc.php');
generate_page_title($page_title);
?>
<div id='content'>
<div id='page-content'>
<div class="block">
<article id="overview">
<p>Doomsday Engine can run on recent 64-bit versions of macOS. If your macOS is more than two years old, please check out the <a href="http://wiki.dengine.net/w/Supported_platforms">older Doomsday releases</a>.</p>
</article>
</div>
<div class="block">
<article>
<h1>Stable</h1>
<?php generate_badges('mac10_8-x86_64', BT_STABLE); ?>
</article>
</div>
<div class="block">
<article>
<h1>Release Candidate</h1>
<p>Release candidate of the next upcoming stable build.</p>
<?php generate_badges('mac10_10-x86_64', BT_CANDIDATE); ?>
</article>
</div>
<div class="block">
<article>
<h1>Unstable / Nightly</h1>
<p>Unstable builds are made automatically every day when changes are committed to the <a href="http://dengine.net/source">source repository</a>. They contain work-in-progress code and sometimes may crash on you.</p>
<?php generate_badges('mac10_10-x86_64', BT_UNSTABLE); ?>
</article>
</div>
</div>
<?php generate_sidebar(); ?>
</div>
<?php generate_sitemap(); ?>
</body>
Binary file added web2/theme/images/site-banner.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 60 additions & 4 deletions web2/theme/stylesheets/site.css
@@ -1,4 +1,4 @@
@import url("http://fonts.googleapis.com/css?family=Open+Sans:400italic,400,300,700");
@import url("http://fonts.googleapis.com/css?family=Open+Sans:300,400,700");
@import url("topbar.css");

body {
Expand All @@ -11,8 +11,25 @@ body {
margin: 0;
}

#page-title {
width: 100%;
height: 14em;
text-align: center;
text-shadow: 0 0 1em black;
background: #282D2B url("../images/site-banner.jpg") no-repeat;
background-size: cover;
}
#page-title h1 {
margin: 0;
padding-top: 3.5em;
padding-bottom: 3.5em;
font-weight: bold;
font-size: 200%;
color: white;
}

#content {
max-width: 65em;
max-width: 60em;
margin: 1em auto 0 auto;
}
#content a {
Expand Down Expand Up @@ -90,20 +107,59 @@ body {
font-size: 60%;
}

#hero, #features {
margin: 5em 0em;
}

div.block {
margin: 5em 1em;
margin: 0 0 1em 0;
background-color: rgba(0, 0, 0, 0.15);
padding: 2em;
}
div.block:not(:first-child) {
margin-top: 1em;
}
div.block h1 {
text-transform: uppercase;
font-weight: 400;
margin-left: 0;
margin-top: 0;
color: #eee;
}
div.block p {
color: #b0b0b0;
}

#page-content {
float: right;
max-width: 45em;
width: 75%;
}

#overview p {
margin: 0;
}

#sidebar {
font-size: 95%;
width: 20em;
margin: 0 1em;
}
#sidebar .heading {
text-transform: uppercase;
margin: 1em 0 0 0;
font-size: 90%;
font-weight: bold;
}
#sidebar ul {
list-style-type: none;
padding: 0;
padding-left: 1em;
margin-top: 0.5ex;
margin-bottom: 1em;
}

#site-map {
clear: both;
width: 100%;
margin: 5em 0 0 0;
padding: 2em 0 2em 0;
Expand Down

0 comments on commit c73b10a

Please sign in to comment.