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

Merge branch 'implement-5.0' into 'master'

Implement 5.0

See merge request iim/UNL_Search!10
parents 788afcef 82db4e7c
No related branches found
No related tags found
1 merge request!10Implement 5.0
......@@ -19,6 +19,7 @@ module.exports = function (grunt) {
jsDir + '/search.js',
];
//TODO Update or remove for 5.0?
var wdnMixinLibBaseUrl = 'https://raw.githubusercontent.com/unl/wdntemplates/4.1/wdn/templates_4.1/less/_mixins/';
var wdnMixins = [
'breakpoints.less',
......
......@@ -5,7 +5,7 @@
}
},
"require": {
"unl/php-wdn-templates": "^4.1",
"unl/php-wdn-templates": "^5.0",
"ezyang/htmlpurifier": "^4.7"
}
}
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"hash": "f17d4e9d564c0acba4f1de21967b413c",
"content-hash": "c6195cd1756aa110358f46cb9356f29b",
"content-hash": "5b4d3f4300c7da1219010337c3541456",
"packages": [
{
"name": "ezyang/htmlpurifier",
"version": "v4.7.0",
"version": "v4.10.0",
"source": {
"type": "git",
"url": "https://github.com/ezyang/htmlpurifier.git",
"reference": "ae1828d955112356f7677c465f94f7deb7d27a40"
"reference": "d85d39da4576a6934b72480be6978fb10c860021"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/ae1828d955112356f7677c465f94f7deb7d27a40",
"reference": "ae1828d955112356f7677c465f94f7deb7d27a40",
"url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/d85d39da4576a6934b72480be6978fb10c860021",
"reference": "d85d39da4576a6934b72480be6978fb10c860021",
"shasum": ""
},
"require": {
"php": ">=5.2"
},
"require-dev": {
"simpletest/simpletest": "^1.1"
},
"type": "library",
"autoload": {
"psr-0": {
......@@ -49,7 +51,7 @@
"keywords": [
"html"
],
"time": "2015-08-05 01:03:42"
"time": "2018-02-23T01:58:20+00:00"
},
{
"name": "unl/php-dwt-parser",
......@@ -100,20 +102,20 @@
],
"description": "A PHP library for parsing DWT files and turning them into PHP classes",
"homepage": "http://wdn.unl.edu/",
"time": "2016-01-05 21:35:46"
"time": "2016-01-05T21:35:46+00:00"
},
{
"name": "unl/php-wdn-templates",
"version": "v4.1.0",
"version": "v5.0.0",
"source": {
"type": "git",
"url": "https://github.com/unl/phpunltemplates.git",
"reference": "ddece80fce8611c22fa674a0f36eac3ddf4ca423"
"reference": "2928e588f409c2628bfeccb5293ab0dd34a506c5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/unl/phpunltemplates/zipball/ddece80fce8611c22fa674a0f36eac3ddf4ca423",
"reference": "ddece80fce8611c22fa674a0f36eac3ddf4ca423",
"url": "https://api.github.com/repos/unl/phpunltemplates/zipball/2928e588f409c2628bfeccb5293ab0dd34a506c5",
"reference": "2928e588f409c2628bfeccb5293ab0dd34a506c5",
"shasum": ""
},
"require": {
......@@ -153,7 +155,7 @@
],
"description": "A PHP library for rendering the UNL templates",
"homepage": "http://wdn.unl.edu/",
"time": "2015-12-15 00:14:04"
"time": "2018-12-12T16:32:30+00:00"
},
{
"name": "zaininnari/html-minifier",
......@@ -204,31 +206,31 @@
"HTML minify",
"php"
],
"time": "2015-08-18 14:10:55"
"time": "2015-08-18T14:10:55+00:00"
},
{
"name": "zendframework/zend-code",
"version": "2.6.2",
"version": "2.6.3",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-code.git",
"reference": "c4e8f976a772cfb14b47dabd69b5245a423082b4"
"reference": "95033f061b083e16cdee60530ec260d7d628b887"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-code/zipball/c4e8f976a772cfb14b47dabd69b5245a423082b4",
"reference": "c4e8f976a772cfb14b47dabd69b5245a423082b4",
"url": "https://api.github.com/repos/zendframework/zend-code/zipball/95033f061b083e16cdee60530ec260d7d628b887",
"reference": "95033f061b083e16cdee60530ec260d7d628b887",
"shasum": ""
},
"require": {
"php": ">=5.5",
"zendframework/zend-eventmanager": "^2.6|^3.0"
"php": "^5.5 || 7.0.0 - 7.0.4 || ^7.0.6",
"zendframework/zend-eventmanager": "^2.6 || ^3.0"
},
"require-dev": {
"doctrine/annotations": "~1.0",
"fabpot/php-cs-fixer": "1.7.*",
"phpunit/phpunit": "~4.0",
"zendframework/zend-stdlib": "~2.7"
"phpunit/phpunit": "^4.8.21",
"zendframework/zend-stdlib": "^2.7 || ^3.0"
},
"suggest": {
"doctrine/annotations": "Doctrine\\Common\\Annotations >=1.0 for annotation features",
......@@ -256,36 +258,41 @@
"code",
"zf2"
],
"time": "2016-01-05 05:58:37"
"time": "2016-04-20T17:26:42+00:00"
},
{
"name": "zendframework/zend-eventmanager",
"version": "2.6.1",
"version": "3.2.1",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-eventmanager.git",
"reference": "a03de810b99b0302059ab744c535d464b8dc4721"
"reference": "a5e2583a211f73604691586b8406ff7296a946dd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/a03de810b99b0302059ab744c535d464b8dc4721",
"reference": "a03de810b99b0302059ab744c535d464b8dc4721",
"url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/a5e2583a211f73604691586b8406ff7296a946dd",
"reference": "a5e2583a211f73604691586b8406ff7296a946dd",
"shasum": ""
},
"require": {
"php": ">=5.5",
"zendframework/zend-stdlib": "~2.5"
"php": "^5.6 || ^7.0"
},
"require-dev": {
"athletic/athletic": "dev-master",
"fabpot/php-cs-fixer": "1.7.*",
"phpunit/phpunit": "~4.0"
"athletic/athletic": "^0.1",
"container-interop/container-interop": "^1.1.0",
"phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2",
"zendframework/zend-coding-standard": "~1.0.0",
"zendframework/zend-stdlib": "^2.7.3 || ^3.0"
},
"suggest": {
"container-interop/container-interop": "^1.1.0, to use the lazy listeners feature",
"zendframework/zend-stdlib": "^2.7.3 || ^3.0, to use the FilterChain feature"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.6-dev",
"dev-develop": "3.0-dev"
"dev-master": "3.2-dev",
"dev-develop": "3.3-dev"
}
},
"autoload": {
......@@ -297,126 +304,15 @@
"license": [
"BSD-3-Clause"
],
"description": "Trigger and listen to events within a PHP application",
"homepage": "https://github.com/zendframework/zend-eventmanager",
"keywords": [
"event",
"eventmanager",
"events",
"zf2"
],
"time": "2015-10-06 11:53:40"
},
{
"name": "zendframework/zend-hydrator",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-hydrator.git",
"reference": "f3ed8b833355140350bbed98d8a7b8b66875903f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-hydrator/zipball/f3ed8b833355140350bbed98d8a7b8b66875903f",
"reference": "f3ed8b833355140350bbed98d8a7b8b66875903f",
"shasum": ""
},
"require": {
"php": ">=5.5",
"zendframework/zend-stdlib": "^2.5.1"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"squizlabs/php_codesniffer": "^2.0@dev",
"zendframework/zend-eventmanager": "^2.5.1",
"zendframework/zend-filter": "^2.5.1",
"zendframework/zend-inputfilter": "^2.5.1",
"zendframework/zend-serializer": "^2.5.1",
"zendframework/zend-servicemanager": "^2.5.1"
},
"suggest": {
"zendframework/zend-eventmanager": "^2.5.1, to support aggregate hydrator usage",
"zendframework/zend-filter": "^2.5.1, to support naming strategy hydrator usage",
"zendframework/zend-serializer": "^2.5.1, to use the SerializableStrategy",
"zendframework/zend-servicemanager": "^2.5.1, to support hydrator plugin manager usage"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev",
"dev-develop": "1.1-dev"
}
},
"autoload": {
"psr-4": {
"Zend\\Hydrator\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"homepage": "https://github.com/zendframework/zend-hydrator",
"keywords": [
"hydrator",
"zf2"
],
"time": "2015-09-17 14:06:43"
},
{
"name": "zendframework/zend-stdlib",
"version": "2.7.4",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-stdlib.git",
"reference": "cae029346a33663b998507f94962eb27de060683"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/cae029346a33663b998507f94962eb27de060683",
"reference": "cae029346a33663b998507f94962eb27de060683",
"shasum": ""
},
"require": {
"php": ">=5.5",
"zendframework/zend-hydrator": "~1.0"
},
"require-dev": {
"athletic/athletic": "~0.1",
"fabpot/php-cs-fixer": "1.7.*",
"phpunit/phpunit": "~4.0",
"zendframework/zend-config": "~2.5",
"zendframework/zend-eventmanager": "~2.5",
"zendframework/zend-filter": "~2.5",
"zendframework/zend-inputfilter": "~2.5",
"zendframework/zend-serializer": "~2.5",
"zendframework/zend-servicemanager": "~2.5"
},
"suggest": {
"zendframework/zend-eventmanager": "To support aggregate hydrator usage",
"zendframework/zend-filter": "To support naming strategy hydrator usage",
"zendframework/zend-serializer": "Zend\\Serializer component",
"zendframework/zend-servicemanager": "To support hydrator plugin manager usage"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.7-dev",
"dev-develop": "2.8-dev"
}
},
"autoload": {
"psr-4": {
"Zend\\Stdlib\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"homepage": "https://github.com/zendframework/zend-stdlib",
"keywords": [
"stdlib",
"zf2"
],
"time": "2015-10-15 15:57:32"
"time": "2018-04-25T15:33:34+00:00"
}
],
"packages-dev": [],
......
......@@ -11,17 +11,6 @@ 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();
......@@ -32,41 +21,51 @@ function renderTemplate($file, $params = array())
function loadDefaultSections($page)
{
$page->titlegraphic = 'UNL Search';
$page->breadcrumbs = str_replace('Department', 'Search', $page->breadcrumbs);
$page->navlinks = file_get_contents('https://www.unl.edu/ucomm/sharedcode/navigation.html');
$page->titlegraphic = '<a class="dcf-txt-h5" href="/">Search</a>';
$page->contactinfo = renderTemplate('templates/local-footer.tpl.php');
$page->affiliation = '';
//Convert relative paths to absolute
$page->navlinks = UNL_Search::removeRelativePaths($page->navlinks, 'https://www.unl.edu/');
}
$localScriptUrl = './js/search.min.js?v=4.1.20';
$pageTemplate = 'Fixed';
if (UNL_Search::$mode === 'debug') {
$pageTemplate = 'Local';
$localScriptUrl = './js/search.js';
}
$page = Templates::factory($pageTemplate, Templates::VERSION_4_1);
if (!$isEmbed) {
if (file_exists(__DIR__ . '/wdn/templates_4.1')) {
$page->setLocalIncludePath(__DIR__);
}
$isEmbed = isset($_GET['embed']) && $_GET['embed'];
$page->doctitle = '<title>Search | University of Nebraska&ndash;Lincoln</title>';
$page->head = '<link rel="home" href="./" />';
$page->pagetitle = '';
$page->breadcrumbs = renderTemplate('templates/breadcrumbs.tpl.php');
}
// 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
if ($isEmbed && $_GET['embed'] === '1') {
$pageTemplate = 'Fixed';
$page = Templates::factory($pageTemplate, Templates::VERSION_4_1);
$templatePath = 'templates/4.1/';
$page->addStyleSheet('css/search.css?v=20180901');
if ($isEmbed && $_GET['embed'] === '5.0') {
$page->addStyleSheet('css/search-5.0.css?v=20180901');
} else {
$page->addStyleSheet('css/search.css?v=20180901');
$pageTemplate = 'App';
$page = Templates::factory($pageTemplate, Templates::VERSION_5);
$templatePath = 'templates/5.0/';
if (!$isEmbed) {
if (file_exists(__DIR__ . '/wdn/templates_5.0')) {
$page->setLocalIncludePath(__DIR__);
}
$page->doctitle = '<title>Search | University of Nebraska&ndash;Lincoln</title>';
$page->head .= '<link rel="home" href="./" />';
// no menu items, so hide mobile menu
$page->addStyleDeclaration("#dcf-mobile-toggle-menu {display: none!important}");
// in search, so hide search
$page->addStyleDeclaration("#dcf-mobile-toggle-search, #dcf-search {display: none!important}");
}
$page->addStyleSheet('css/search-5.0.css?v=20180901');
}
$localResults = '';
......@@ -92,18 +91,14 @@ if (isset($_GET['u']) && $scanned = UNL_Search::getScannedPage($_GET['u'])) {
$purifier = new HTMLPurifier($config);
$page->head .= '<link rel="home" href="'.htmlentities($_GET['u'], ENT_QUOTES).'" />';
$page->head .= '<link rel="home" href="'.htmlentities($_GET['u'], ENT_QUOTES).'" />';
$page->titlegraphic = $purifier->purify(str_replace(array('<h1>', '</h1>'), '', $scanned->titlegraphic));
$page->affiliation = '';
foreach (array('breadcrumbs', 'navlinks', 'leftcollinks', 'contactinfo', 'affiliation') as $region) {
foreach (array('contactinfo', 'affiliation') as $region) {
if (isset($scanned->{$region}) && !empty($scanned->{$region})) {
$scannedContent = $scanned->{$region};
switch ($region) {
case 'breadcrumbs':
case 'navlinks':
$scannedContent = UNL_Search::removeRelativePaths($scannedContent, $_GET['u']);
break;
case 'contactinfo':
$scannedContent = preg_replace('#<h3>.*</h3>#', '', $scannedContent);
break;
......@@ -134,26 +129,34 @@ if (isset($_GET['u']) && $scanned = UNL_Search::getScannedPage($_GET['u'])) {
loadDefaultSections($page);
}
$initialQuery = json_encode(isset($_GET['q']) ? $_GET['q'] : '');
$context = json_encode($context);
$maincontent = '';
if (!$isEmbed) {
$maincontent .= renderTemplate('templates/search-form.tpl.php', array('local_results' => $localResults));
}
$maincontent .= renderTemplate($templatePath . 'search-results.tpl.php', array(
'isEmbed' => $isEmbed,
'local_results' => $localResults
));
$initialQuery = json_encode(isset($_GET['q']) ? $_GET['q'] : '');
$context = json_encode($context);
if ($isEmbed || !empty($_GET['q'])) {
$maincontent .= renderTemplate($templatePath . 'search-results.tpl.php', array(
'isEmbed' => $isEmbed,
'local_results' => $localResults
));
}
$maincontent .= renderTemplate($templatePath . 'end-scripts.tpl.php', array(
$endScript = renderTemplate($templatePath . 'end-scripts.tpl.php', array(
'localScriptUrl' => $localScriptUrl,
'googleLoaderUrl' => 'https://cse.google.com/cse.js?cx=' . $search_engine_id,
'initialQuery' => $initialQuery,
'localContext' => $context,
'localContext' => $context
));
if ($isEmbed) {
$maincontent .= $endScript;
} else {
$page->jsbody .= $endScript;
}
if (!$isEmbed) {
$page->maincontentarea = $maincontent;
echo $page;
......
......@@ -5,6 +5,7 @@
// @import "mixins/_mixins.typography.scss";
// !UNL Google Search Results Overrides
.unl .google-results table,
.unl .google-results tbody th,
......@@ -106,7 +107,7 @@
.unl .gsc-control-cse .gs-result .gs-title,
.unl .gsc-control-cse .gs-result .gs-title * {
// @include lh-3;
line-height: 1.125;
line-height: 1.25em;
}
.unl .gsc-control-cse .gs-result .gsc-table-cell-snippet-close > .gs-title {
......
......@@ -16,9 +16,9 @@
text-align: center;
}
#searchform .wdn-input-group {
#searchform .dcf-input-group {
margin: 0 auto;
max-width: 30em;
max-width: 30em!important;
}
// #search_wrapper {
......
<?php if (!$isEmbed): ?><div class="dcf-bleed dcf-mb-0 dcf-overflow-y-auto"><?php endif ?>
<section class="dcf-wrapper dcf-grid dcf-col-gap-vw dcf-pt-9 dcf-txt-xs unl-font-sans unl-search-results" id="search_wrapper">
<div class="dcf-col-67%-start@sm dcf-col-50%-start@lg results-group" id="search_results">
<div class="dcf-col-100% dcf-col-67%-start@sm dcf-col-50%-start@lg results-group" id="search_results">
<div class="result-head">
<h2>Web Results</h2>
<ul class="dcf-d-flex dcf-list-bare result-tab<?php if (empty($local_results)): ?> no-local<?php endif; ?>">
......@@ -19,7 +21,7 @@
</div>
</div>
<div class="dcf-col-33%-end@sm dcf-col-50%-end@lg dcf-pb-10 results-group" id="directory_results">
<div class="dcf-col-100% dcf-col-33%-end@sm dcf-col-50%-end@lg dcf-pb-10 results-group" id="directory_results">
<div class="result-head">
<h2>Directory Results</h2>
<ul class="dcf-d-flex dcf-list-bare result-tab">
......@@ -31,3 +33,5 @@
</div>
</section>
<?php if (!$isEmbed): ?></div><?php endif ?>
\ No newline at end of file
<ul>
<li><a href="https://www.unl.edu/" title="University of Nebraska&ndash;Lincoln">Nebraska</a></li>
<li>Search</li>
</ul>
<div class="wdn-grid-set wdn-footer-links-local">
<div class="bp960-wdn-col-one-fourth">
<div class="wdn-footer-module">
<span role="heading" class="wdn-footer-heading">Contact Us</span>
<?php echo file_get_contents('http://www.unl.edu/ucomm/sharedcode/footerContactInfo.html'); ?>
</div>
</div>
<div class="bp960-wdn-col-one-half">
<div class="wdn-footer-module">
<span role="heading" class="wdn-footer-heading">About UNL Search</span>
<p>This application is a product of the <a href="https://iim.unl.edu/">Internet and Interactive Media group at Nebraska</a>. IIM is a partnership of <a href="https://ucomm.unl.edu/">University Communication</a> and <a href="https://its.unl.edu/">Information Technology Services</a>.</p>
</div>
</div>
<div class="bp960-wdn-col-one-fourth">
<div class="wdn-footer-module">
<?php
$relatedLinks = file_get_contents('http://www.unl.edu/sharedcode/relatedLinks.html');
$relatedLinks = preg_replace('#<h3>.*</h3>#', '<span role="heading" class="wdn-footer-heading">Related Links</span>', $relatedLinks);
$relatedLinks = preg_replace('#<ul>#', '<ul class="wdn-related-links-v1">', $relatedLinks);
echo $relatedLinks;
?>
</div>
</div>
</div>
<nav id="dcf-footer-group-1" role="navigation" aria-labelledby="dcf-footer-group-1-heading">
<h3 class="dcf-txt-md dcf-bold dcf-uppercase dcf-lh-3 unl-ls-2 unl-cream" id="dcf-footer-group-1-heading">About UNL Search</h3>
<p>This application is a product of the <a href="https://iim.unl.edu/">Internet and Interactive Media group at Nebraska</a>. IIM is a partnership of <a href="https://ucomm.unl.edu/">University Communication</a> and <a href="https://its.unl.edu/">Information Technology Services</a>.</p>
<?php
// TODO: Verify file will continue to exist and correct
echo file_get_contents('http://www.unl.edu/ucomm/sharedcode/footerContactInfo.html');
?>
</nav>
<nav id="dcf-footer-group-2" role="navigation" aria-labelledby="dcf-footer-group-2-heading">
<h3 class="dcf-txt-md dcf-bold dcf-uppercase dcf-lh-3 unl-ls-2 unl-cream" id="dcf-footer-group-2-heading">Related Links</h3>
<ul class="dcf-list-bare dcf-mb-0">
<?php
//TODO: Verify file will continue to exist and if correct list of links
$relatedLinks = file_get_contents('http://www.unl.edu/sharedcode/relatedLinks.html');
preg_match_all('|<li>(.*)<\/li>|', $relatedLinks, $matches);
if (is_array($matches[0])) {
foreach($matches[0] as $link) {
echo "<li>" . $link . "</li>", PHP_EOL;
}
}
?>
</ul>
</nav>
<div id="searchform" class="wdn-band">
<form action="./" method="get" class="wdn-inner-wrapper">
<div class="wdn-input-group">
<div id="searchform" class="dcf-bleed dcf-p-6">
<form action="./" method="get" class="dcf-wrapper">
<div class="dcf-input-group">
<input type="text" name="q" id="search_q" aria-label="Search Query" placeholder="e.g., Herbert Husker, Ph.D." />
<span class="wdn-input-group-btn"><button class="button" type="submit"><span class="wdn-icon-search" aria-hidden="true"></span><span class="wdn-text-hidden">Search</span></button></span>
<span class="wdn-input-group-btn"><button class="button" type="submit"><span class="wdn-icon-search" aria-hidden="true"></span><span class="dcf-sr-only">Search</span></button></span>
</div>
<?php if (!empty($local_results)): ?>
<input type="hidden" name="u" value="<?php echo htmlentities($_GET['u'], ENT_QUOTES) ?>" />
......
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