Simplify RosWeb and fully adapt it to the upcoming Hugo-based website.

This should make live _queryProvider() calls as fast as possible while still allowing for local development of ReactOS website subsystems without requiring a Hugo output directory.
This commit is contained in:
Colin Finck 2020-02-23 13:10:43 +01:00
parent 0511cad264
commit a4d811a579
9 changed files with 31 additions and 2228 deletions

View File

@ -3,7 +3,7 @@
* PROJECT: ReactOS Website
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
* PURPOSE: Easily download prebuilt ReactOS Revisions
* COPYRIGHT: Copyright 2007-2018 Colin Finck (colin@reactos.org)
* COPYRIGHT: Copyright 2007-2020 Colin Finck (colin@reactos.org)
* Copyright 2012-2013 Aleksey Bragin (aleksey@reactos.org)
*/
@ -35,7 +35,7 @@
<head>
<meta charset="utf-8">
<title><?php echo $getbuilds_langres["title"]; ?></title>
<?php echo $rw->getHead(); ?>
<?php $rw->printHead(); ?>
<link rel="stylesheet" type="text/css" href="/sites/all/themes/Porto/css/skins/default-style.css" />
<link rel="stylesheet" type="text/css" href="getbuilds.css" />
<script type="text/javascript">
@ -49,7 +49,7 @@
</head>
<body onload="Load()">
<?php echo $rw->getHeader(); ?>
<?php $rw->printHeader(); ?>
<div class="main" role="main">
<section class="page-top breadcrumb-wrap">
@ -139,7 +139,7 @@
</div>
</div>
<?php echo $rw->getFooter(); ?>
<?php $rw->printFooter(); ?>
</div>
</body>

View File

@ -3,7 +3,7 @@
* PROJECT: RosLogin - A simple Self-Service and Single-Sign-On around an LDAP user directory
* LICENSE: AGPL-3.0-or-later (https://spdx.org/licenses/AGPL-3.0-or-later)
* PURPOSE: The template for every RosLogin page
* COPYRIGHT: Copyright 2018 Colin Finck (colin@reactos.org)
* COPYRIGHT: Copyright 2018-2020 Colin Finck (colin@reactos.org)
*/
// This file must only be used as an include from index.php where $page is set.
@ -18,12 +18,12 @@
$page->printTitle();
echo ROSLOGIN_TITLE_SUFFIX;
?></title>
<?php echo $rw->getHead(); ?>
<?php $rw->printHead(); ?>
<?php $page->printHead(); ?>
</head>
<body>
<?php echo $rw->getHeader(); ?>
<?php $rw->printHeader(); ?>
<div class="main" role="main">
<section class="page-top breadcrumb-wrap">
@ -53,7 +53,7 @@
</div>
</div>
<?php echo $rw->getFooter(); ?>
<?php $rw->printFooter(); ?>
</body>
</html>

View File

@ -1,7 +0,0 @@
</div></div><!-- /#main, /#main-wrapper -->
<div id="rosweb_footer">
<p>I don't like trademarks!</p>
</div><!-- /#rosweb_footer -->
</div></div><!-- /#page, /#page-wrapper -->

View File

@ -1,3 +0,0 @@
<!-- Insert stylesheets and other content to go in the head tag -->

View File

@ -1,17 +0,0 @@
<div id="page-wrapper"><div id="page">
<div id="rosweb_header">
<a href="/">
<img id="rosweb_logo" src="/rosweb/dummy-content/logo.png" alt="Home" />
</a>
<div id="rosweb_topMenu">
<div id="rosweb_main-menu">
<a href="/">WEBSITE UNDER CONSTRUCTION</a>
</div>
</div><!-- /#rosweb_topMenu -->
</div><!-- /#rosweb_header -->
<!-- main area -->
<div id="main-wrapper" class="dtable"><div id="main" class="dtrow">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 93 KiB

View File

@ -3,7 +3,7 @@
* PROJECT: ReactOS Website
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: ReactOS RosWeb Component for sharing layout and user information between website subsystems
* COPYRIGHT: Copyright 2015-2018 Colin Finck (colin@reactos.org)
* COPYRIGHT: Copyright 2015-2020 Colin Finck (colin@reactos.org)
*/
class RosWeb
@ -23,10 +23,6 @@
"ru" => "Русский",
);
// Specifies the path where hugo generated header.htm, footer.htm and head.htm can be found
// If this is an invalid path, rosweb will fall back on the data from dummy-content
private $_hugo_template_output_dir = "R:\\src\\web-content\\public\\rosweb";
//// CODE ////
@ -98,34 +94,16 @@
setcookie("multilink_pl", $this->_language, time() + 31536000, "/", $this->_getCookieDomain());
}
// Try to resolve a template part using the directory $_hugo_template_output_dir first,
// falling back to 'dummy-content':
// $_hugo_template_output_dir / part.en.htm
// $_hugo_template_output_dir / part.htm
// dummy-content / part.en.htm
// dummy-content / part.htm
private function _queryProvider($part)
{
$file_lang = ($this->_language == "en") ? "" : $this->_language;
$try_files = array();
if (file_exists($this->_hugo_template_output_dir))
if (file_exists(__DIR__ . '../../www.reactos.org_content/parts/' . $part))
{
$try_files[] = "$this->_hugo_template_output_dir/$part.$file_lang.htm";
$try_files[] = "$this->_hugo_template_output_dir/$part.htm";
readfile(__DIR__ . '../../www.reactos.org_content/parts/' . $part);
}
$try_files[] = __DIR__ . "/dummy-content/$part.$file_lang.htm";
$try_files[] = __DIR__ . "/dummy-content/$part.htm";
foreach ($try_files as $current_file)
else
{
if (file_exists($current_file))
{
return file_get_contents($current_file);
}
readfile('https://master.web-content.reactos.org/parts/' . $part);
}
return "ERROR: Template $part not found!";
}
@ -140,21 +118,6 @@
$this->_language = "en";
}
public function getFooter()
{
return $this->_queryProvider("footer");
}
public function getHead()
{
return $this->_queryProvider("head");
}
public function getHeader()
{
return $this->_queryProvider("header");
}
public function getLanguage()
{
return $this->_language;
@ -193,4 +156,19 @@
return $html;
}
public function printFooter()
{
return $this->_queryProvider("footer");
}
public function printHead()
{
return $this->_queryProvider("head");
}
public function printHeader()
{
return $this->_queryProvider("header");
}
}

View File

@ -40,7 +40,7 @@
<head>
<meta charset="utf-8">
<title><?php echo $testman_langres["index_title"]; ?></title>
<?php echo $rw->getHead(); ?>
<?php $rw->printHead(); ?>
<link rel="stylesheet" type="text/css" href="css/index.css">
<script type="text/javascript">
var DEFAULT_SEARCH_LIMIT = <?php echo DEFAULT_SEARCH_LIMIT; ?>;
@ -55,7 +55,7 @@
</head>
<body onload="Load()">
<?php echo $rw->getHeader(); ?>
<?php $rw->printHeader(); ?>
<div class="main" role="main">
<section class="page-top breadcrumb-wrap">
@ -150,7 +150,7 @@
</div>
</div>
<?php echo $rw->getFooter(); ?>
<?php $rw->printFooter(); ?>
</body>
</html>