Skip to content
Snippets Groups Projects
Commit 0211b5e9 authored by Michael Fairchild's avatar Michael Fairchild
Browse files

Merge branch 'four' into 'master'

Local site search and Directory CSS updates

If the local site content scrape fails the default UNL content should be shown.

Adds some space under the `.fn` of directory results.
parents 88a0308d 3f4484b3
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,16 @@ function renderTemplate($file, $params = array()) ...@@ -13,6 +13,16 @@ function renderTemplate($file, $params = array())
include $file; include $file;
} }
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->leftcollinks = file_get_contents('http://www.unl.edu/ucomm/sharedcode/relatedLinks.html');
$page->contactinfo = preg_replace('#<h3>.*</h3>#', '', file_get_contents('http://www.unl.edu/ucomm/sharedcode/footerContactInfo.html'));
$page->footercontent = file_get_contents('http://www.unl.edu/ucomm/sharedcode/footer.html');
}
$isEmbed = isset($_GET['embed']) && $_GET['embed']; $isEmbed = isset($_GET['embed']) && $_GET['embed'];
UNL_Templates::setCachingService(new UNL_Templates_CachingService_Null()); UNL_Templates::setCachingService(new UNL_Templates_CachingService_Null());
...@@ -58,25 +68,34 @@ $page->addStyleSheet('css/search.css'); ...@@ -58,25 +68,34 @@ $page->addStyleSheet('css/search.css');
if (isset($_GET['u']) && $scanned = UNL_Search::getScannedPage($_GET['u'])) { if (isset($_GET['u']) && $scanned = UNL_Search::getScannedPage($_GET['u'])) {
// Add local site search results // Add local site search results
// we're scrapping the navigation and other content from the originatting site. // we're scrapping the navigation and other content from the originatting site.
if (!$isEmbed && isset($scanned->navlinks)) { if (!$isEmbed) {
require_once 'HTMLPurifier.auto.php'; if (isset($scanned->titlegraphic)) {
$config = HTMLPurifier_Config::createDefault(); require_once 'HTMLPurifier.auto.php';
$config->set('Cache.SerializerPath', '/tmp'); $config = HTMLPurifier_Config::createDefault();
$purifier = new HTMLPurifier($config); $config->set('Cache.SerializerPath', '/tmp');
$purifier = new HTMLPurifier($config);
$page->head .= '<link rel="home" href="'.htmlentities($_GET['u'], ENT_QUOTES).'" />';
$page->breadcrumbs = $purifier->purify(UNL_Search::removeRelativePaths($scanned->breadcrumbs, $_GET['u'])); $page->head .= '<link rel="home" href="'.htmlentities($_GET['u'], ENT_QUOTES).'" />';
$page->titlegraphic = $purifier->purify(str_replace(array('<h1>', '</h1>'), '',$scanned->titlegraphic)); $page->titlegraphic = $purifier->purify(str_replace(array('<h1>', '</h1>'), '', $scanned->titlegraphic));
$page->navlinks = $purifier->purify(UNL_Search::removeRelativePaths($scanned->navlinks, $_GET['u']));
if (!empty($scanned->leftcollinks)) {
$page->leftcollinks = $purifier->purify($scanned->leftcollinks);
}
if (!empty($scanned->contactinfo)) {
$page->contactinfo = $purifier->purify(preg_replace('#<h3>.*</h3>#', '', $scanned->contactinfo)); foreach (array('breadcrumbs', 'navlinks', 'leftcollinks', 'contactinfo', 'footercontent') as $region) {
} if (isset($scanned->{$region}) && !empty($scanned->{$region})) {
if (!empty($scanned->footercontent)) { $scannedContent = $scanned->{$region};
$page->footercontent = $purifier->purify($scanned->footercontent); switch ($region) {
case 'breadcrumbs':
case 'navlinks':
$scannedContent = UNL_Search::removeRelativePaths($scannedContent, $_GET['u']);
break;
case 'contactinfo':
$scannedContent = preg_replace('#<h3>.*</h3>#', '', $scannedContent);
break;
}
$page->{$region} = $purifier->purify($scannedContent);
}
}
} else {
loadDefaultSections($page);
} }
} }
...@@ -98,12 +117,7 @@ if (isset($_GET['u']) && $scanned = UNL_Search::getScannedPage($_GET['u'])) { ...@@ -98,12 +117,7 @@ if (isset($_GET['u']) && $scanned = UNL_Search::getScannedPage($_GET['u'])) {
$local_results = ob_get_clean(); $local_results = ob_get_clean();
} elseif (!$isEmbed) { } elseif (!$isEmbed) {
// Default search for no referring site. // Default search for no referring site.
$page->titlegraphic = 'UNL Search'; loadDefaultSections($page);
$page->breadcrumbs = str_replace('Department', 'Search', $page->breadcrumbs);
$page->navlinks = file_get_contents('http://www.unl.edu/ucomm/sharedcode/navigation.html');
$page->leftcollinks = file_get_contents('http://www.unl.edu/ucomm/sharedcode/relatedLinks.html');
$page->contactinfo = preg_replace('#<h3>.*</h3>#', '', file_get_contents('http://www.unl.edu/ucomm/sharedcode/footerContactInfo.html'));
$page->footercontent = file_get_contents('http://www.unl.edu/ucomm/sharedcode/footer.html');
} }
if (isset($_GET['q'])) { if (isset($_GET['q'])) {
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
localResults = 'local_results'; localResults = 'local_results';
window[initCallback] = function() { window[initCallback] = function() {
delete window[initCallback]; window[initCallback] = null;
require(['jquery', 'analytics'], function($, analytics) { require(['jquery', 'analytics'], function($, analytics) {
// Caching Class // Caching Class
......
...@@ -293,9 +293,16 @@ form .input-group { ...@@ -293,9 +293,16 @@ form .input-group {
* { * {
border: 0; border: 0;
} }
.givenName {
margin-left: 0.254em;
font-size: 10px;
font-size: 0.602rem;
.sans-serif-font;
}
} }
.eppa, .organization-unit, .title, .tel { .fn, .eppa, .organization-unit, .title, .tel {
margin-bottom: 0.178em; margin-bottom: 0.178em;
} }
......
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