Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
render: function() {
var docs = this.docs.docs;
if(docs.length === 0){
this.$elem.hide();
return;
}
for (var i = 0; i < docs.length; i++) {
var pid = docs[i]["PID"];
var imgsrc = "api/item/" + pid + "/thumb";// + this.thumbHeight;
var thumb = $('<li>', {class: 'thumb'});
thumb.data("metadata", docs[i]["dc.title"]);
var title = docs[i]["dc.title"];
var shortTitle = title;
var creator = "";
var maxLength = 90;
var showTooltip = false;
if (shortTitle.length > maxLength) {
shortTitle = shortTitle.substring(0, maxLength) + "...";
showTooltip = true;
}
if (docs[i]["dc.creator"]) {
creator = '<div class="autor">' + docs[i]["dc.creator"] + '</div>';
}
title = '<div class="title">' + title + '</div>';
thumb.data("pid", pid);
this.container.append(thumb);
var policy = $('<div>', {class: 'policy'});
if (docs[i]['dostupnost']) {</div></li>
public setFormInitialMetadata() {
if (!this.initialized) {
this.initialized = true;
// Alternative mode to assign:
// this.formRef.formGroup.controls['files-data'].controls.title.setValue(...);
// Cannot put the following lines into 'ngOnInit' because 'this.formRef' is available only after the view init.
// Cannot put the following lines into 'ngAfterViewInit' because of 'ExpressionChangedAfterItHasBeenCheckedError'.
// TODO bitstreamList[key].metadata['dc.title'][0].value, as in section-upload
// dc.title
let title = '';
if (isNotUndefined(this.fileData.metadata['dc.title'])) {
// Case /edit
title = this.fileData.metadata['dc.title'][0].value;
} else {
// Case /submit
title = this.fileData.metadata[0].value;
}
const description = this.fileData.metadata.length > 1 ? this.fileData.metadata[1].value : '';
const accessConditions = this.fileData.accessConditions;
this.formRef.formGroup.get('metadata').get('dc_title').setValue(title);
this.formRef.formGroup.get('metadata').get('dc_description').setValue(description);
this.fileData.accessConditions.forEach( (condition, index) => {
const accessConditionControl: any = this.formBuilderService.getFormControlById(
'accessConditions',
this.formRef.formGroup,
this.formModel,
index);
public setFormInitialMetadata() {
if (!this.initialized) {
this.initialized = true;
// Alternative mode to assign:
// this.formRef.formGroup.controls['files-data'].controls.title.setValue(...);
// Cannot put the following lines into 'ngOnInit' because 'this.formRef' is available only after the view init.
// Cannot put the following lines into 'ngAfterViewInit' because of 'ExpressionChangedAfterItHasBeenCheckedError'.
// TODO bitstreamList[key].metadata['dc.title'][0].value, as in section-upload
// dc.title
let title = '';
if (isNotUndefined(this.fileData.metadata['dc.title'])) {
// Case /edit
title = this.fileData.metadata['dc.title'][0].value;
} else {
// Case /submit
title = this.fileData.metadata[0].value;
}
const description = this.fileData.metadata.length > 1 ? this.fileData.metadata[1].value : '';
const accessConditions = this.fileData.accessConditions;
this.formRef.formGroup.get('metadata').get('dc_title').setValue(title);
this.formRef.formGroup.get('metadata').get('dc_description').setValue(description);
this.fileData.accessConditions.forEach( (condition, index) => {
const accessConditionControl: any = this.formBuilderService.getFormControlById(
'accessConditions',
this.formRef.formGroup,
render: function() {
var docs = this.docs.docs;
if(docs.length === 0){
this.$elem.hide();
return;
}
for (var i = 0; i < docs.length; i++) {
var pid = docs[i]["PID"];
var imgsrc = "api/item/" + pid + "/thumb";// + this.thumbHeight;
var thumb = $('<li>', {class: 'thumb'});
thumb.data("metadata", docs[i]["dc.title"]);
var title = docs[i]["dc.title"];
var shortTitle = title;
var creator = "";
var maxLength = 90;
var showTooltip = false;
if (shortTitle.length > maxLength) {
shortTitle = shortTitle.substring(0, maxLength) + "...";
showTooltip = true;
}
if (docs[i]["dc.creator"]) {
creator = '<div class="autor">' + docs[i]["dc.creator"] + '</div>';
}
title = '<div class="title">' + title + '</div>';
thumb.data("pid", pid);
this.container.append(thumb);
var policy = $('<div>', {class: 'policy'});</div></li>
addThumb: function(doc) {
var pid = doc["PID"];
var root_pid = doc["root_pid"];
var model = doc["fedora.model"];
var imgsrc = "api/item/" + pid + "/thumb";
var thumb = $('<li>', {class: 'thumb'});
thumb.data("metadata", doc["root_title"]);
var title = doc["root_title"];
var dctitle = doc["dc.title"];
var typtitulu = doc["model_path"][0].split("/")[0];
var shortTitle = title;
var creator = "";
var maxLength = 90;
var showToolTip = false;
if (shortTitle.length > maxLength) {
shortTitle = shortTitle.substring(0, maxLength) + "...";
showToolTip = true;
}
shortTitle = '<div class="title">' + shortTitle + '</div>';
if (doc["dc.creator"]) {
creator = '<div class="autor">' + doc["dc.creator"] + '</div>';
}
var titletag = '<div class="title">' + title + '</div>';
if(title !== dctitle){
titletag = titletag + '<div class="dctitle">' + dctitle + '</div>';</li>
ngOnInit() {
if (isNotEmpty(this.fileData.metadata)) {
this.metadata.push({
key: 'Title',
language: (this.fileData.metadata.hasOwnProperty('dc.title') ? this.fileData.metadata['dc.title'][0].language : ''),
value: (this.fileData.metadata.hasOwnProperty('dc.title') ? this.fileData.metadata['dc.title'][0].value : '')
});
this.metadata.push({
key: 'Description',
language: (this.fileData.metadata.hasOwnProperty('dc.description') ? this.fileData.metadata['dc.description'][0].language : ''),
value: (this.fileData.metadata.hasOwnProperty('dc.description') ? this.fileData.metadata['dc.description'][0].value : '')
});
}
}
}
addThumb: function(doc) {
var pid = doc["PID"];
var root_pid = doc["root_pid"];
var model = doc["fedora.model"];
var imgsrc = "api/item/" + pid + "/thumb";
var thumb = $('<li>', {class: 'thumb'});
thumb.data("metadata", doc["root_title"]);
var title = doc["root_title"];
var dctitle = doc["dc.title"];
var typtitulu = doc["model_path"][0].split("/")[0];
var shortTitle = title;
var creator = "";
var maxLength = 90;
var showToolTip = false;
if (shortTitle.length > maxLength) {
shortTitle = shortTitle.substring(0, maxLength) + "...";
showToolTip = true;
}
shortTitle = '<div class="title">' + shortTitle + '</div>';
if (doc["dc.creator"]) {
creator = '<div class="autor">' + doc["dc.creator"] + '</div>';
}
title = '<div class="title">' + title + '</div>';
if(title !== dctitle){
title = title + '<div class="dctitle">' + dctitle + '</div>';</li>
$.get(NTL_url + NTL_collection + NTL_datelimit + NTL_rowslimit, function (data) {
var json = JSON.parse(data);
for (itemCountNTL = 0; itemCountNTL < json.response.docs.length; itemCountNTL++) {
//Filter results to pull only dataset types
if (json.response.docs[itemCountNTL]["mods.sm_resource_type"][0] == "Dataset"){
var tempJson = {};
//Read dataset name, description, date
tempJson["name"] = json.response.docs[itemCountNTL]["dc.title"][0];
tempJson["description"] = json.response.docs[itemCountNTL]["mods.abstract"][0];
tempJson["date"] = self.formatDate(json.response.docs[itemCountNTL]["fgs.createdDate"]);
//Read dataset tags, add Research Results button tag to all NTL results
var tagCount;
var allTags = [];
var RESEARCHRESULTS = "Research Results";
allTags[0] = RESEARCHRESULTS;
for (tagCount = 0; tagCount < json.response.docs[itemCountNTL]["mods.sm_key_words"].length; tagCount++) {
allTags[tagCount + 1] = json.response.docs[itemCountNTL]["mods.sm_key_words"][tagCount];
}
tempJson["tags"] = allTags;
tempJson["tags"].sort();
//Build URL to refer to NTL result using PID
var PID = json.response.docs[itemCountNTL].PID.split(":")[1];
K5.api.askForSolr(q, _.bind(function(data) {
this.titlesList.find('.more_docs').remove();
var arr = data.response.docs;
for (var i = 0; i < arr.length; i++) {
var doc = arr[i];
var div = $('<li>', {class: 'res policy'});
div.data("pid", doc.PID);
var dcTitle = doc['dc.title'];
if(dcTitle.length === 0){
dcTitle = K5.i18n.translatable("dctitle.none");
}
var title = $('<span class="title">' + dcTitle + '</span>');
title.click(function() {
K5.api.gotoDisplayingItemPage($(this).parent().data("pid"));
});
div.append(title);
if (doc['dc.creator']) {
div.append('<div>' + doc['dc.creator'] + '</div>');
}
if (doc['datum_str']) {
div.append('<div>' + doc['datum_str'] + '</div>');
}
if (doc['dostupnost']) {</li>
})
];
operationsService.jsonPatchByResourceID.and.returnValue(observableOf(response));
const accessConditionsToSave = [
{ name: 'openaccess', groupUUID: '123456-g' },
{ name: 'lease', endDate: '2019-01-16T00:00:00Z', groupUUID: '123456-g' },
{ name: 'embargo', startDate: '2019-01-16T00:00:00Z', groupUUID: '123456-g' }
];
comp.saveBitstreamData(event);
tick();
let path = 'metadata/dc.title';
expect(operationsBuilder.add).toHaveBeenCalledWith(
pathCombiner.getPath(path),
mockFileFormData.metadata['dc.title'],
true
);
path = 'metadata/dc.description';
expect(operationsBuilder.add).toHaveBeenCalledWith(
pathCombiner.getPath(path),
mockFileFormData.metadata['dc.description'],
true
);
path = 'accessConditions';
expect(operationsBuilder.add).toHaveBeenCalledWith(
pathCombiner.getPath(path),
accessConditionsToSave,
true
);