Commit aef57157 authored by Gradl, Tobias's avatar Gradl, Tobias
Browse files

1180: Present subject entities in search results

Task-Url: https://pm.winseda.de/issues/1180
parent abf22778
......@@ -66,7 +66,7 @@
top: 60px; bottom: 25px; left: 0px; right: 0px;
border-top: 2px solid #CCC;
border-bottom: 3px solid #CCC;
border-bottom: 2px solid #CCC;
background-color: #002547;
opacity: 0.8;
......@@ -82,8 +82,22 @@
overflow: hidden;
}
.search-result-objects {
padding: 10px 0px;
}
.search-result-objects .label {
font-size: 90%;
padding: 5px 5px 3px 5px;
margin-right: 5px;
}
.search-result-label {
border: 1px solid #002547;
background-color: #FFF;
color: #002547;
cursor: pointer;
}
/*!
* Recent functionality additions (no-refactor-zone)
......
......@@ -483,6 +483,13 @@ QueryHandler.prototype.processResponseResources = function(isShowMore, resultEle
content.push(["link", ""]);
}
if (resultElements[i].info.Presentation.Objects!==undefined) {
content.push(["objects", "<div class='search-result-objects'>" + this.handleObjects(resultElements[i].info.Presentation.Objects) + "</div>"]);
} else {
content.push(["objects", ""]);
}
/*if (resultElements[i].info.Presentation.Images!==undefined && resultElements[i].info.Presentation.Images.Resource!==undefined) {
this.handleImages(resultElements[i].info.Presentation.Images.Resource, i);
......@@ -513,6 +520,52 @@ QueryHandler.prototype.processResponseResources = function(isShowMore, resultEle
};
QueryHandler.prototype.handleObjects = function(objects) {
var result = "";
if (objects.Subject!==undefined) {
if(objects.Subject instanceof Array) {
for (var i=0; i<objects.Subject.length; i++) {
result += this.handleSubject(objects.Subject[i]);
}
} else {
result += this.handleSubject(objects.Subject);
}
}
return result;
};
QueryHandler.prototype.handleSubject = function(subject) {
var strSubject = "";
var strSubjectQuery = "[Subject: ";
if (subject.NameAttribution!==undefined) {
strSubjectQuery += "[Name: ";
if (subject.NameAttribution.Primary!==undefined) {
strSubject = subject.NameAttribution.Primary["~"];
strSubjectQuery += '"' + subject.NameAttribution.Primary["~"] + '"';
if (subject.NameAttribution.Additional!==undefined) {
if (subject.NameAttribution.Additional instanceof Array) {
for (var j=0; i<subject.NameAttribution.Additional.length; j++) {
strSubject += " " + subject.NameAttribution.Additional[j]["~"];
strSubjectQuery += ', "' + subject.NameAttribution.Additional[j]["~"] + '"';
}
} else {
strSubject += " " + subject.NameAttribution.Additional["~"];
strSubjectQuery += ', "' + subject.NameAttribution.Additional["~"] + '"';
}
}
} else if (subject.NameAttribution.Name!==undefined) {
strSubject = subject.NameAttribution.Name["~"];
strSubjectQuery += '"' + subject.NameAttribution.Name["~"] + '"';
}
strSubjectQuery += "]";
}
strSubjectQuery += "]";
return "<span class=\"label search-result-label\" onclick='queryHandler.expandSearch(unescape(\"" + escape(strSubjectQuery) + "\"));'>" +
"<i class=\"fa fa-users\" aria-hidden=\"true\"></i> " + __util.escapeHtml(strSubject) +
"</span>";
}
QueryHandler.prototype.getValues = function(container) {
var values = [];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment