diff --git a/www/index.php b/www/index.php index 0e06dae7b2b2c61b9acb668db2ad77ddd1187ceb..cdab45dbf8fb1c82bb5b00ffb7008540b23256c3 100644 --- a/www/index.php +++ b/www/index.php @@ -13,6 +13,16 @@ function renderTemplate($file, $params = array()) 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']; UNL_Templates::setCachingService(new UNL_Templates_CachingService_Null()); @@ -58,25 +68,34 @@ $page->addStyleSheet('css/search.css'); if (isset($_GET['u']) && $scanned = UNL_Search::getScannedPage($_GET['u'])) { // Add local site search results // we're scrapping the navigation and other content from the originatting site. - if (!$isEmbed && isset($scanned->navlinks)) { - require_once 'HTMLPurifier.auto.php'; - $config = HTMLPurifier_Config::createDefault(); - $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->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)) { + if (!$isEmbed) { + if (isset($scanned->titlegraphic)) { + require_once 'HTMLPurifier.auto.php'; + $config = HTMLPurifier_Config::createDefault(); + $config->set('Cache.SerializerPath', '/tmp'); + $purifier = new HTMLPurifier($config); + + $page->head .= '<link rel="home" href="'.htmlentities($_GET['u'], ENT_QUOTES).'" />'; + $page->titlegraphic = $purifier->purify(str_replace(array('<h1>', '</h1>'), '', $scanned->titlegraphic)); - $page->contactinfo = $purifier->purify(preg_replace('#<h3>.*</h3>#', '', $scanned->contactinfo)); - } - if (!empty($scanned->footercontent)) { - $page->footercontent = $purifier->purify($scanned->footercontent); + foreach (array('breadcrumbs', 'navlinks', 'leftcollinks', 'contactinfo', 'footercontent') 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; + } + + $page->{$region} = $purifier->purify($scannedContent); + } + } + } else { + loadDefaultSections($page); } } @@ -98,12 +117,7 @@ if (isset($_GET['u']) && $scanned = UNL_Search::getScannedPage($_GET['u'])) { $local_results = ob_get_clean(); } elseif (!$isEmbed) { // Default search for no referring site. - $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'); + loadDefaultSections($page); } if (isset($_GET['q'])) { diff --git a/www/js/search.js b/www/js/search.js index 312e91c24160485f5f80aaab9fc54f3253ea7ead..071f7b832d00305f5f90a49c9fedb57e505750cd 100644 --- a/www/js/search.js +++ b/www/js/search.js @@ -25,7 +25,7 @@ localResults = 'local_results'; window[initCallback] = function() { - delete window[initCallback]; + window[initCallback] = null; require(['jquery', 'analytics'], function($, analytics) { // Caching Class diff --git a/www/less/search.less b/www/less/search.less index e9561916649e7a156da74918619879fb68dcce3f..b98fc92b1c777db44d01650e9b9902883e08a503 100644 --- a/www/less/search.less +++ b/www/less/search.less @@ -293,9 +293,16 @@ form .input-group { * { 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; }