Skip to content
Snippets Groups Projects
Commit c79982a6 authored by Eric Rasmussen's avatar Eric Rasmussen
Browse files

Add the option to switch to 5.0 theme for the embed version

parent 138e376d
No related branches found
No related tags found
1 merge request!9Initial conversion from 4.1 to 5.0
......@@ -9,3 +9,5 @@
/.buildpath
/vendor
/tmp
.DS_Store
.idea
This diff is collapsed.
......@@ -11,6 +11,17 @@ require_once $config_file;
use UNL\Templates\Templates;
$isEmbed = isset($_GET['embed']) && $_GET['embed'];
// While the site proper is skinned with a specific version, the templates used
// used in embed search need to be supported in legacy sites.
// ?embed=1 : 4.1
// ?embed=5.0 : 5.0
$templatePath = 'templates/4.1/';
if ($isEmbed && $_GET['embed'] === '5.0') {
$templatePath = 'templates/5.0/';
}
function renderTemplate($file, $params = array())
{
ob_start();
......@@ -23,7 +34,7 @@ function loadDefaultSections($page)
{
$page->titlegraphic = 'UNL Search';
$page->breadcrumbs = str_replace('Department', 'Search', $page->breadcrumbs);
$page->navlinks = file_get_contents('http://www.unl.edu/ucomm/sharedcode/navigation.html');
$page->navlinks = file_get_contents('https://www.unl.edu/ucomm/sharedcode/navigation.html');
$page->contactinfo = renderTemplate('templates/local-footer.tpl.php');
$page->affiliation = '';
......@@ -31,8 +42,6 @@ function loadDefaultSections($page)
$page->navlinks = UNL_Search::removeRelativePaths($page->navlinks, 'https://www.unl.edu/');
}
$isEmbed = isset($_GET['embed']) && $_GET['embed'];
$localScriptUrl = './js/search.min.js?v=4.1.20';
$pageTemplate = 'Fixed';
......@@ -112,7 +121,7 @@ if (isset($_GET['u']) && $scanned = UNL_Search::getScannedPage($_GET['u'])) {
$context = $_GET['u'];
}
$localResults = renderTemplate('templates/google-results.tpl.php', array(
$localResults = renderTemplate($templatePath . 'google-results.tpl.php', array(
'title' => $page->titlegraphic,
'id' => 'local_results',
));
......@@ -126,7 +135,7 @@ if (!$isEmbed) {
$maincontent .= renderTemplate('templates/search-form.tpl.php', array('local_results' => $localResults));
}
$maincontent .= renderTemplate('templates/search-results.tpl.php', array(
$maincontent .= renderTemplate($templatePath . 'search-results.tpl.php', array(
'isEmbed' => $isEmbed,
'local_results' => $localResults
));
......@@ -147,10 +156,10 @@ if (!$isEmbed) {
exit;
}
$template = 'templates/embed.tpl.php';
$template = $templatePath . 'embed.tpl.php';
if (UNL_Search::$mode === 'debug') {
$template = 'templates/embed-debug.tpl.php';
$template = $templatePath . 'embed-debug.tpl.php';
}
echo renderTemplate($template, array(
......
File moved
......@@ -17,7 +17,7 @@
</div>
<div class="search-results">
<?php echo $local_results ?>
<?php echo renderTemplate('templates/google-results.tpl.php', array(
<?php echo renderTemplate('templates/4.1/google-results.tpl.php', array(
'title' => 'All of UNL',
'id' => 'unl_results',
)) ?>
......
<!DOCTYPE html>
<html class="no-js embed" lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<title>Search | University of Nebraska&ndash;Lincoln</title>
<link rel="stylesheet" href="https://cloud.typography.com/7717652/616662/css/fonts.css" />
<link rel="stylesheet" href="/wdn/templates_5.0/css/all.css" />
<script data-main="js/embed-src/main.js" src="js/embed-src/require.js"></script>
<?php echo $head ?>
</head>
<body>
<main>
<?php echo $maincontent ?>
</main>
</body>
</html>
<!DOCTYPE html>
<html class="no-js embed" lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<title>Search | University of Nebraska&ndash;Lincoln</title>
<link rel="stylesheet" href="https://cloud.typography.com/7717652/616662/css/fonts.css" />
<link rel="stylesheet" href="https://unlcms.unl.edu/wdn/templates_5.0/css/all.css" />
<script src="js/embed/all.js?v=20170404"></script>
<?php echo $head ?>
</head>
<body>
<main>
<?php echo $maincontent ?>
</main>
</body>
</html>
<?php if (isset($title)): ?>
<h3><?php echo $title ?> Results</h3>
<?php endif; ?>
<div id="<?php echo isset($id) ? $id : '' ?>" class="google-results"></div>
<section<?php if (!$isEmbed): ?> class="wdn-band"<?php endif ?> id="search_wrapper">
<?php if (!$isEmbed): ?>
<div class="wdn-inner-wrapper wdn-inner-padding-sm">
<?php endif; ?>
<div class="wdn-grid-set search-set">
<div id="search_results" class="results-group">
<div class="result-head">
<h2>Web Results</h2>
<ul class="result-tab<?php if (empty($local_results)): ?> no-local<?php endif; ?>">
<?php if (!empty($local_results)): ?>
<li><a href="#">This unit</a></li>
<?php endif; ?>
<li><a href="#">All of UNL</a></li>
</ul>
</div>
<div class="search-results">
<?php echo $local_results ?>
<?php echo renderTemplate('templates/5.0/google-results.tpl.php', array(
'title' => 'All of UNL',
'id' => 'unl_results',
)) ?>
</div>
</div>
<div id="directory_results" class="results-group">
<div class="result-head">
<h2>Directory Results</h2>
<ul class="result-tab">
<li><a href="#">People</a></li>
<li><a href="#">Departments</a></li>
</ul>
</div>
<div id="ppl_results" class="search-results"></div>
</div>
</div>
<?php if (!$isEmbed): ?>
</div>
<?php endif; ?>
</section>
<ul>
<li><a href="http://www.unl.edu/" title="University of Nebraska&ndash;Lincoln">UNL</a></li>
<li><a href="https://www.unl.edu/" title="University of Nebraska&ndash;Lincoln">Nebraska</a></li>
<li>Search</li>
</ul>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment