Merge branch 'excludeDocFromSearch' into texts

This commit is contained in:
Georgy Litvinov 2021-09-28 18:11:08 +02:00
commit 1db2abd612
5 changed files with 180 additions and 13 deletions

View file

@ -164,7 +164,7 @@
function fillOutForm(compilationName){
var iframeDoc = document.getElementById('newCompilationIframe').contentWindow.document;
var rules = $('#builder').queryBuilder('getRules');
var rules = $('#builder').queryBuilder('getRules', { get_flags: true });
var query = format_query_string(rules,"");
iframeDoc.getElementById('queryBuilderRules').value = JSON.stringify(rules);
iframeDoc.getElementById('rawQueryString').value = query;
@ -235,6 +235,7 @@
}
});
}
createRemoveButtons();
}
</script>

View file

@ -3511,6 +3511,19 @@ label.switch >.collapseTextControl >img {
text-decoration: none;
cursor: pointer;
}
.removeDocFromSearch {
border-inline-width: thin;
border-top-width: thin;
border-bottom-width: thin;
border-color: #8B4513;
border-inline-style: solid;
border-top-style: solid;
border-bottom-style: solid;
margin-left: 0.4em;
padding: 0.0em 0.2em 0.1em 0.2em;
}
/* -------------------------------------------------> */
/* FONTS --------------------------------> */
/* -------------------------------------------------> */

View file

@ -0,0 +1,115 @@
menu_contactus = Contact Us
menu_welcomestart = Welcome
menu_copyright = copyright
menu_support = Support
menu_logout = Log out
menu_loginfull = Log in to manage this site
menu_login = Log in
menu_version = Version
menu_about = About
menu_termuse = Terms of Use
menu_powered = Powered by
intro_title = Welcome to VIVO
intro_para1 = VIVO is a research-focused discovery tool that enables collaboration among scholars of all disciplines.
intro_para2 = Browse or search information on people, departments, courses, grants, and publications.
intro_searchvivo = Search VIVO
intro_filtersearch = Filter search
identity_title = VIVO | connect share discover
identity_index = Index
identity_edit = Edit Page
identity_admin = Site Admin
identity_myprofile = My profile
identity_myaccount = My account
identity_user = user
collection_capitalized = Collection
place_of_grant = Place of grant
email_address = Email Address
#
# menupage templates ( /templates/freemarker/body/menupage )
#
grants_text_one = This body is from the the template file \
vivo/productMods/templates/freemarker/body/menupage/grants.ftl. \
In the display model, the grants page has a display:requiresBodyTemplate \
property that defines that the grants page overrides the default template. \
The default template for these pages is at /vitro/webapp/web/templates/freemarker/body/menupage/menupage.ftl
grants_two = This technique could be used to define pages without menu items, that get \
their content from a freemarker template. An example would be the about page.
grants_text_three = This would create a page that would use about.ftl as the body. The page would be \
accessed via /about and would override all servlet mappings in web.xml.
address_street_one = address street one
address_street_two = address street two
address_street_three = address street three
address_label = address label
loading_website_image = Loading website image
researchers_in = researchers in
view = view
grant_type = grant Type
grant_entry_for = grant entry for
regions = regions
grant_date = grant Date
map_states_string = states.
map_state_string = state.
unable_to_handle_grant_editing = This form is unable to handle the editing of this grant because it is associated with multiple grant individuals.
unable_to_handle_position_editing = This form is unable to handle the editing of this position because it is associated with multiple Position individuals.
currently_no_papers_for = Currently there are no {0} papers for
change_selection = change selection
view_all_departments = view all academic departments
first_name = First name
last_name = Last name
first_grant = First Grant
last_grant = Last Grant
currently_no_researchers = There are currently no researchers with a defined geographic focus.
reviewer_role = Reviewer Role
vivo_profile = VIVO profile
loading_data = loading data
select_award = Selected Award
grants_in_vivo = grants in VIVO
service_provider_role = Service Provider Role
view_all_faculty = view all faculty
no_grants_for = Currently there are no grants for
statewide_locations = state-wide locations.
faculty_who_are_members_of_org = Here are the faculty in the {0} department who are members of this organization.
indiv_foafperson_for = for
indiv_foafperson_return = return to
no_departments_found = No academic departments found.
leadership_role = Leadership Role
countries = countries
first_publication = First publication
last_publication = Last publication
research_area = individuals in the department with this research area
password = password
limit_search = limit search
placeholder_image = placeholder image
view_all_members_of_org = View all the members of this organization.
display_more = more
create_entry = Create Entry
attendee_capitalized = Attendee
no_faculty_found = No faculty members found.
create_capitalized = Create
to = to
enter_new_role_value = Please enter a new value in the Role field.
countries_and_regions = countries and regions.
province_or_region = Province or Region
full_name = Full name
researchers = researchers
years_participation_in = Years of Participation in
return_to_grant = Return to grant
profile_capitalized = Profile
organizer_role = Organizer Role
faculty_memberships = Faculty Memberships
edit_mailing_address = Edit Mailing Address
add_capitalized = Add
literature_excerpt_button_text = Bibliography
literature_all_button_text = All bibliorgraphy
sources_excerpt_button_text = Sources
sources_all_button_text = All sources
remove_doc_from_search_results = Remove from search results

View file

@ -106,4 +106,4 @@ organizer_role = Organizer Role
faculty_memberships = Faculty Memberships
edit_mailing_address = Edit Mailing Address
add_capitalized = Add
remove_doc_from_search_results=Удалить из результатов поиска

View file

@ -132,7 +132,7 @@
$('#btn-search-expand').on('click', function() {
var json_result = $('#builder').queryBuilder('getRules');
var json_result = $('#builder').queryBuilder('getRules', { get_flags: true });
var query_string = format_query_string(json_result,"");
var hits = $("#hitsPerPageSelect :selected");
if (!$.isEmptyObject(query_string)) {
@ -171,29 +171,67 @@
if ('operator' in json_query && json_query.operator.startsWith("not_")){
string_query += "NOT ";
}
string_query += json_query.field + ":" + json_query.value.toString().replace(/[']+/g,'').replace(/#/g,'%23') ;
if (json_query.hasOwnProperty('data') && json_query.data.hasOwnProperty('value')){
var value = "\"" + json_query.data.value.toString()+ "\"";
} else {
var value = json_query.value.toString();
}
string_query += json_query.field + ":" + value.replace(/[']+/g,'').replace(/#/g,'%23') ;
}
return string_query;
}
function excludeDocByURI(uri){
var allRules = $('#builder').queryBuilder('getRules');
var excludeRuleString = '{ "id": "URI", "field": "URI", "type": "string", "input": "text", "operator": "not_contains", "value": "" }';
function excludeDocByURI(name, uri){
var allRules = $('#builder').queryBuilder('getRules', { get_flags: true });
var excludeRuleString = '{ "id": "URI", "field": "URI", "type": "string", "flags":{}, "input": "text", "operator": "not_contains", "data":{} }';
var excludeRule = JSON.parse(excludeRuleString);
excludeRule.value = uri;
excludeRule.data.value = uri;
excludeRule.flags.value_readonly = true;
excludeRule.flags.filter_readonly = true;
excludeRule.flags.operator_readonly = true;
excludeRule.value = name;
if (allRules !== null){
if (allRules.condition === "AND"){
allRules.rules.push(excludeRule);
} else {
var outerRulesString = '{ "condition": "AND", "rules": [] }';
var outerRules = JSON.parse(outerRulesString);
outerRules.rules.push(allRules);
outerRules.rules.push(excludeRule);
allRules = outerRules;
var outerRulesString = '{ "condition": "AND", "rules": [] }';
var outerRules = JSON.parse(outerRulesString);
outerRules.rules.push(allRules);
outerRules.rules.push(excludeRule);
allRules = outerRules;
}
$('#builder').queryBuilder('setRules', allRules);
var elements = document.querySelectorAll('[parturi="' + uri + '"]');
var i;
for (i = 0; i < elements.length; i++) {
elements[i].parentElement.remove();
}
}
}
function createRemoveButtons(){
$('.compilationDraftExcerpt').each(function(index){ createRemoveButton(this)});
}
function createRemoveButton(element){
var uri = element.getAttribute('parturi');
var button = element.querySelector('button');
var name = button.textContent;
var a = document.createElement('a');
a.setAttribute('href',"javascript:excludeDocByURI(\'" + escapeQutes(name) + "\',\'" + escapeQutes(uri) + "\');");
a.setAttribute('class',"removeDocFromSearch");
a.textContent = "${i18n().remove_doc_from_search_results}" ;
button.appendChild(a);
}
function escapeQutes(input) {
return input
.replace(/"/g, "&quot;")
.replace(/'/g, "&#039;")
}
</script>
<#macro freeField field >
{