Skip to content

Commit

Permalink
Homepage: Added more pages, improved layout responsiveness
Browse files Browse the repository at this point in the history
New pages for recent blog posts and donating.
  • Loading branch information
skyjake committed Mar 24, 2017
1 parent 54d3868 commit a9a8160
Show file tree
Hide file tree
Showing 35 changed files with 324 additions and 55 deletions.
2 changes: 2 additions & 0 deletions web2/.htaccess
@@ -1,3 +1,5 @@
ErrorDocument 404 index.php

RewriteEngine on
RewriteBase /web2

Expand Down
36 changes: 36 additions & 0 deletions web2/donate.php
@@ -0,0 +1,36 @@
<?php
require_once('include/template.inc.php');
$page_title = '';
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>
<h1>Donate to support the project</h1>
<p>Doomsday Engine is a long-running open source project.
Since its inception in 1999, it has been fueled by nostalgia
and the passion of its developers. However, those things
unfortunately cannot pay for web hosting, code signing keys,
build server upgrades, and other running costs.</p>
<p>If you enjoy Doomsday and wish to see its development continue
at full speed, please consider making a donation.
</p>
</article>
</div>
<div class="block">
<article>
<h1>PayPal</h1>
<p><a href="http://sourceforge.net/p/deng/donate/?source=navbar">Support Doomsday Engine development &rarr;</a></p>
</article>
</div>
</div>
<?php generate_sidebar(); ?>
</div>
<?php generate_sitemap(); ?>
</body>
83 changes: 50 additions & 33 deletions web2/include/template.inc.php
Expand Up @@ -3,25 +3,44 @@
require_once('class.session.php');
require_once(DENG_API_DIR.'/include/builds.inc.php');

function reformat_date($date_text)
{
$date = date_parse($date_text);
$ts = mktime($date['hour'], $date['minute'], $date['second'],
$date['month'], $date['day'], $date['year']);
if (date('Y') != $date['year']) {
$fmt = '%Y %B %e';
}
else {
$fmt = '%B %e';
}
return strftime($fmt, $ts);
}

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>Doomsday Engine$title</title>\n"
."</head>\n");
$bg_index = time()/3600 % 10;
$bg_rotation_css =
"body { background-image: url(\"theme/images/site-background${bg_index}.jpg\"); }
#page-title { background-image: url(\"theme/images/site-banner${bg_index}.jpg\"); }";
echo("<!DOCTYPE html>
<html lang='en'>
<head>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<meta charset='UTF-8'>
<link href='".SITE_ROOT."/theme/stylesheets/site.css' rel='stylesheet' type='text/css'>
<style>$bg_rotation_css</style>
<title>Doomsday Engine$title</title>
</head>\n");
}

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

function platform_download_link()
Expand Down Expand Up @@ -89,7 +108,7 @@ function generate_download_badge($db, $file_id)
$fext = $ext;
}
else {
$fext = $ext." ($plat[cpu_bits]-bit)";
$fext = "$plat[cpu_bits]-bit ".$ext;
}

$title = "Doomsday ".omit_zeroes($version);
Expand All @@ -101,29 +120,26 @@ function generate_download_badge($db, $file_id)
$title .= " (Source)";
}
else {
$title .= " &ndash; $fext";
$title .= " &mdash; $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)';
$metadata .= $plat['name'].' (or later)'; //' &middot; '.$plat['cpu_bits'].'-bit';
}
else {
$metadata .= "Source code .tar.gz";
}
$metadata .= '</span>';
$metadata .= "<time datetime='$build[timestamp]'> &middot; "
.reformat_date($build['timestamp']).'</time> ';

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

function generate_badges($platform, $type)
Expand All @@ -148,6 +164,7 @@ function generate_sidebar()
{
echo(
"<div id='sidebar'>
<div class='partition'>
<div class='heading'><a href='".SITE_ROOT."'>About Doomsday</a></div>
<div class='heading'>Downloads</div>
<ul>
Expand All @@ -158,11 +175,13 @@ function generate_sidebar()
<li><a href='/builds'>Recent builds</a></li>
</ul>
<div class='heading'><a href='addons'>Add-ons</a></div>
<div class='heading'><a href='/manual'>User Manual</a></div>
<div class='heading'><a href='/manual'>User Guide</a></div>
<ul>
<li><a href='/manual/getting_started'>Getting started</a></li>
<li><a href='/manual/multiplayer'>Multiplayer</a></li>
</ul>
</div>
<div class='partition'>
<div class='heading'>Community</div>
<ul>
<li><a href='/talk'>Forums</a></li>
Expand All @@ -174,20 +193,17 @@ function generate_sidebar()
<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='recent_posts'>Blog</a></li>
<li><a href='http://twitter.com/@dengteam'>@dengteam</a></li>
<li><a href='https://github.com/skyjake/Doomsday-Engine.git'>GitHub</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>");
<div class='heading'><a href='donate' title='Donate to support the Doomsday Engine Project'>Donate &#9825;</a></div>
</div></div>");
}

function generate_blog_post_cached($post, $css_class)
{
$date = date_parse($post->date);
$ts = mktime($date['hour'], $date['minute'], $date['second'],
$date['month'], $date['day'], $date['year']);
$nice_date = strftime('%B %d, %Y', $ts);
$nice_date = reformat_date($post->date);

/*$html = '<div class="block"><article class="'.$css_class
.' content"><header><h1><a href="'.$post->url.'">'
Expand All @@ -200,7 +216,7 @@ function generate_blog_post_cached($post, $css_class)
$html .= '<div class="links">'.$source_link.'</div></div>';*/

$html = "<a class='blog-link' href='$post->url'>$post->title</a> "
."<time datetime='$post->date' pubdate>&ndash; $nice_date</time>";
."<time datetime='$post->date' pubdate>&middot; $nice_date</time>";

cache_echo('<li>'.$html.'</li>');
}
Expand Down Expand Up @@ -234,7 +250,7 @@ function generate_sitemap()
." [#".$row['build']."]";
$title = "Build report for $label";
$ts = (int) $row['UNIX_TIMESTAMP(timestamp)'];
$date = gmstrftime('&ndash; %B %d', $ts);
$date = gmstrftime('&middot; %B %e', $ts);
$css_class = ($ts > $new_threshold)? ' class="new-build"' : '';

$build_list .= " <li${css_class}><a title='$title' href='$link'>$label</a> <time>$date</time></li>\n";
Expand Down Expand Up @@ -270,6 +286,7 @@ function generate_sitemap()
$build_list</li>
<li>
<div class='heading'>Multiplayer Games</div>
<ul class='sitemap-list'><li>No servers</li></ul>
</li>
<li>
<div class='heading'>User Manual</div>
Expand Down
14 changes: 7 additions & 7 deletions web2/include/topbar.inc.php
Expand Up @@ -26,14 +26,14 @@
?>
<div id="dengine-topbar">
<ul class="site-navigation">
<li><a href="<?php echo(SITE_ROOT); ?>" class="site-link">Doomsday Engine</a></li>
<li><?php echo($download_link); ?></li>
<li><a href="/builds">Builds</a></li>
<li><a href="<?php echo(SITE_ROOT."/addons"); ?>">Add-ons</a></li>
<li><a href="<?php echo(SITE_ROOT); ?>" class="site-link">Doomsday<span class="aux-word"> Engine</span></a></li>
<li class="quick-download"><?php echo($download_link); ?></li>
<li class="supplementary"><a href="/builds">Builds</a></li>
<li class="supplementary"><a href="<?php echo(SITE_ROOT."/addons"); ?>">Add-ons</a></li>
<li><a href="/manual">Manual</a></li>
<li><a href="/talk">Forums</a></li>
<li><a href="/support">Support</a></li>
<li><a href="https://tracker.dengine.net/projects/deng">Bug Tracker</a></li>
<li><a href="/blog" class="blog-link">Blog</a></li>
<li class="supplementary"><a href="/support">Support</a></li>
<li><a href="https://tracker.dengine.net/projects/deng"><span class="aux-word">Bug </span>Tracker</a></li>
<li><a href="<?php echo(SITE_ROOT).'/recent_posts'; ?>" class="blog-link">Blog</a></li>
</ul>
</div>
11 changes: 10 additions & 1 deletion web2/index.php
Expand Up @@ -19,6 +19,9 @@
</div>
<div id='hero' class='block'>
<article>
<video id='hero-video'>
<img src='theme/images/video-placeholder.jpg'>
</video>
<h1>A rejuvenation.</h1>
<p><a href="https://en.wikipedia.org/wiki/Doom_(1993_video_game)">id
Software's Doom</a> pioneered the modern first-person shooter genre.
Expand All @@ -36,8 +39,14 @@
</div>
<div id='features' class='block'>
<article>
<img id='feature-image' src='theme/images/home_v2t.jpg'>
<h1>FEATURES</h1>
<p>{feature highlights} OpenGL and Qt 5.</p>
<p>UI</p>
<p>Graphics</p>
<p>Audio</p>
<p>Resources</p>
<p>Multiplayer</p>
<p>Tech: OpenGL, Qt 5</p>
</article>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions web2/macos.php
Expand Up @@ -12,6 +12,7 @@
<div id='page-content'>
<div class="block">
<article id="overview">
<h1><?php echo($page_title); ?></h1>
<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="/manual/supported_platforms">older Doomsday releases</a>.</p>
</article>
</div>
Expand Down
66 changes: 66 additions & 0 deletions web2/recent_posts.php
@@ -0,0 +1,66 @@
<?php
require_once('include/template.inc.php');
$page_title = 'Recent Blog Posts';
generate_page_header($page_title);

function cmp_post($a, $b)
{
return strcmp($b->date, $a->date);
}

function generate_post_blocks()
{
// Fetch the cached blog entries.
cache_try_load(cache_key('news', 'news'), -1);
$news = json_decode(cache_get());
cache_try_load(cache_key('news', 'dev'), -1);
$dev = json_decode(cache_get());

$posts = array_merge($news->posts, $dev->posts);
usort($posts, "cmp_post");

for ($i = 0; $i < count($posts); $i++) {
$post = $posts[$i];
$url = $post->url;
$category = $post->categories[0];
$cat_link = '/blog/category/'.$category->slug;
$date = reformat_date($post->date);
$tags = '';
foreach ($post->tags as $tag) {
$tags .= " <div class='post-tag'><a href='/blog/tag/$tag->slug'>$tag->title</a></div>";
}
echo(
"<div class='block blog-post'>
<article>
<h1><a href='$url'>$post->title</a></h1>
<div class='post-metadata'>
<a class='post-category' href='$cat_link'>$category->title</a> &middot;
<time datetime='$post->date'>$date</time> &middot;
<span class='post-author'>".$post->author->name."</span> &middot;
$tags
</div>
<div class='post-content'>$post->content</div>
</article>
</div>\n");
}
}

?>
<body>
<?php
include('include/topbar.inc.php');
generate_page_title($page_title);
?>
<div id='content'>
<div id='page-content'>
<?php generate_post_blocks(); ?>
<div class='block'>
<article>
<p><a href="/blog">More blog posts &rarr;</a></p>
</article>
</div>
</div>
<?php generate_sidebar(); ?>
</div>
<?php generate_sitemap(); ?>
</body>
Binary file added web2/theme/images/file.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web2/theme/images/home_v2t.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web2/theme/images/package.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added web2/theme/images/site-background1.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web2/theme/images/site-background2.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web2/theme/images/site-background3.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web2/theme/images/site-background4.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web2/theme/images/site-background5.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web2/theme/images/site-background6.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web2/theme/images/site-background7.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web2/theme/images/site-background8.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web2/theme/images/site-background9.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added web2/theme/images/site-banner1.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web2/theme/images/site-banner2.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web2/theme/images/site-banner3.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web2/theme/images/site-banner4.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web2/theme/images/site-banner5.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web2/theme/images/site-banner6.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web2/theme/images/site-banner7.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web2/theme/images/site-banner8.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web2/theme/images/site-banner9.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web2/theme/images/updater.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a9a8160

Please sign in to comment.