Reverted changes to Vitro templates. Move files to VIVO branch.

This commit is contained in:
Georgy Litvinov 2021-06-28 14:27:03 +02:00
parent f16eef642a
commit 45f303c1ae
3 changed files with 10 additions and 151 deletions

View file

@ -3,14 +3,10 @@
<#-- Template for displaying search error message -->
<#if title??>
<div class="errorPageTitle">
<h2>${title?html}</h2>
</div>
<h2>${title?html}</h2>
</#if>
<div id="nomatchingTitle">
<p>
${message?html}
</p>
</div>
<#include "searchSelector.ftl">
<p>
${message?html}
</p>
<#include "search-help.ftl" >

View file

@ -1,16 +1,12 @@
<#-- $This file is distributed under the terms of the license in LICENSE$ -->
<#if origination?has_content && origination == "helpLink">
<div id="searchTipsTitleH2">
<h2>Search Tips</h2>
</div>
<span id="searchHelp">
<a href="#" onClick="history.back();return false;" title="back to results">Back to results</a>
</span>
<#else>
<div id="searchTipsTitleH3">
<h3>Search Tips</h3>
</div>
</#if>
<ul class="searchTips">
<li>Keep it simple! Use short, single terms unless your searches are returning too many results.</li>
@ -19,9 +15,7 @@
<li>If you are unsure of the correct spelling, put ~ at the end of your search term -- e.g., <i>cabage~</i> finds <i>cabbage</i>, <i>steven~</i> finds <i>Stephen</i> and <i>Stefan</i> (as well as other similar names).</li>
</ul>
<div id="advancedTipsWrapper">
<h4><a id="advTipsLink" href="#">Advanced Tips</a></h4>
</div>
<ul id="advanced" class="searchTips" style="visibility:hidden">
<li>When you enter more than one term, search will return results containing all of them unless you add the Boolean "OR" -- e.g., <i>chicken</i> OR <i>egg</i>.</li>
<li>NOT" can help limit searches -- e.g., <i>climate</i> NOT <i>change</i>.</li>

View file

@ -3,13 +3,10 @@
<#-- Template for displaying paged search results -->
<h2 class="searchResultsHeader">
<#include "searchSelector.ftl">
<#escape x as x?html>
<div id='searchQueryResults'> ${i18n().search_results_for} '${querytext}'</div>
<div id='limitedToClassGroup'> <#if classGroupName?has_content>${i18n().limited_to_type} '${classGroupName}'</#if> </div>
<div id='limitedToType'> <#if typeName?has_content>${i18n().limited_to_type} '${typeName}'</#if> </div>
${i18n().search_results_for} '${querytext}'
<#if classGroupName?has_content>${i18n().limited_to_type} '${classGroupName}'</#if>
<#if typeName?has_content>${i18n().limited_to_type} '${typeName}'</#if>
</#escape>
<script type="text/javascript">
var url = window.location.toString();
@ -31,7 +28,7 @@
<div class="contentsBrowseGroup">
<#-- Refinement links -->
<#if classGroupLinks?has_content && classGroupLinks?size gt 1>
<#if classGroupLinks?has_content>
<div class="searchTOC">
<h4>${i18n().display_only}</h4>
<ul>
@ -42,7 +39,7 @@
</div>
</#if>
<#if classLinks?has_content && classLinks?size gt 1 >
<#if classLinks?has_content>
<div class="searchTOC">
<#if classGroupName?has_content>
<h4>${i18n().limit} ${classGroupName} ${i18n().to}</h4>
@ -57,18 +54,6 @@
</div>
</#if>
<div class="virtualArticleSwitch">
<label class="switch">Показать виртуальную статью
<input id="virtualArticleCheck" type="checkbox" checked="false" onclick="showVirtualArticles();">
</label>
<#if user.loggedIn>
<button onclick="createNewCompilation()">Сохранить</button>
</#if>
</div>
<#-- Search results -->
<ul class="searchhits">
<#list individuals as individual>
@ -123,122 +108,6 @@
</div> <!-- end contentsBrowseGroup -->
<script>
document.addEventListener('DOMContentLoaded', createVirtualCompilation(), false);
$('input[type=checkbox]').removeAttr('checked');
function showVirtualArticles(){
var checkBox = document.getElementById("virtualArticleCheck");
if (checkBox.checked == true){
$('.searchResult').hide();
$('.virtualArticlePart').show();
} else {
$('.searchResult').show();
$('.virtualArticlePart').hide();
}
}
function createNewCompilation() {
var excerpts = $('.compilationDraftExcerpt').toArray();
if (excerpts.length == 0){
alert("Отрывков не найдено.");
return;
}
var compilationName = window.prompt("Введите название подборки.");
if (!compilationName){
alert("Для создания подоборки необходимо ввести её название.");
return;
}
var iframe = document.createElement("iframe");
var excerptsCounter = $('.compilationDraftExcerpt').length;
iframe.setAttribute("src", "${urls.base}/editRequestDispatch?typeOfNew=https%3A%2F%2Flitvinovg.pro%2Ftext_structures%23compilation&editForm=edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.CompilationGenerator&excerptsCount=" + excerptsCounter);
iframe.style.width = "1px";
iframe.style.height = "1px";
iframe.id="newCompilationIframe";
//iframe.style.display="none";
document.body.appendChild(iframe);
$('#newCompilationIframe').on('load', function(){
fillOutForm(compilationName);
});
}
function fillOutForm(compilationName){
var iframeDoc = document.getElementById('newCompilationIframe').contentWindow.document;
var rules = $('#builder').queryBuilder('getRules');
var query = format_query_string(rules,"");
iframeDoc.getElementById('queryBuilderRules').value = JSON.stringify(rules);
iframeDoc.getElementById('rawQueryString').value = query;
iframeDoc.getElementById('newCompilationLabel').value = compilationName;
var excerpts = $('.compilationDraftExcerpt').toArray();
for (i = 0;i < excerpts.length;i++){
var excerptUri = excerpts[i].getAttribute('parturi');
var excerptName = $(excerpts[i]).children('button').html();
var number = i + 1;
iframeDoc.getElementById("tocLevel" + number + "Name").value = excerptName + " (" + compilationName + ")";
iframeDoc.getElementById("tocItem" + number + "Name").value = excerptName + " (" + compilationName + ")";
iframeDoc.getElementById("excerpt" + number).value = excerptUri;
}
$('#newCompilationIframe').off('load');
iframeDoc.getElementById('submit').click();
$('#newCompilationIframe').on('load', function(){
redirectToNewCompilation();
});
}
function redirectToNewCompilation(){
var newURL = document.getElementById('newCompilationIframe').contentWindow.location.href;
window.open(newURL,"_self");
}
function createVirtualCompilation(){
let workSet = new Set();
let biblioSet = new Set();
var workDivs = $('.virtualArticleWork');
var biblioDivs = $('.virtualArticleBibliography');
biblioDivs.each(function() {
biblioSet.add($(this).html());
});
workDivs.each(function() {
workSet.add($(this).html());
});
var workArr = Array.from(workSet);
workArr.sort();
var biblioArr = Array.from(biblioSet);
biblioArr.sort();
if (workArr.length > 0 ) {
$('<div class="virtualWorks virtualArticlePart"><button type="button" style="border:none;width: 100%; text-align:left;" class="collapsible">Источники</button><div class="virtualWorks"></div></div>').insertAfter($('.virtualArticlePart').last());
for (let value of workArr){
$('.virtualWorks').last().append( '<div class="work"><p>' + value + '</p></div>' );
}
}
if (biblioArr.length > 0 ) {
$('<div class="virtualBibliography virtualArticlePart"><button type="button" style="border:none;width: 100%; text-align:left;" class="collapsible">Литература</button><div class="virtualBibliography"></div></div>').insertAfter($('.virtualArticlePart').last());
for (let value of biblioArr){
$('.virtualBibliography').last().append( '<div class="bibliography"><p>' + value + '</p></div>' );
}
}
$('.virtualWorks').hide();
$('.virtualBibliography').hide();
$('.virtualArticlePart').hide();
var coll = document.getElementsByClassName("collapsible");
var i;
for (i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function() {
this.classList.toggle("active");
var content = this.nextElementSibling;
if (content.style.display === "block") {
content.style.display = "none";
} else {
content.style.display = "block";
}
});
}
}
</script>
${stylesheets.add('<link rel="stylesheet" href="//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />',
'<link rel="stylesheet" href="${urls.base}/css/search.css" />',
'<link rel="stylesheet" type="text/css" href="${urls.base}/css/jquery_plugins/qtip/jquery.qtip.min.css" />')}