Skip to content

Commit

Permalink
Merge pull request #7 from nyuhsl/master
Browse files Browse the repository at this point in the history
Merging changes from NYU
  • Loading branch information
jmarchewka authored Jul 27, 2021
2 parents 0489dee + ea5ae34 commit f3f33d7
Show file tree
Hide file tree
Showing 17 changed files with 451 additions and 93 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ app/config/**/parameters.yml
app/config/common/security.yml
app/Resources/views/institution/*
web/css/institution/*
web/js/institution/*
src/AppBundle/Form/Type/ContactFormEmailType.php
SolrIndexer.py

2 changes: 0 additions & 2 deletions app/Resources/views/analytics.html.twig
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
{# Insert your analytics code snippet here #}
<script>
</script>
1 change: 1 addition & 0 deletions app/Resources/views/default/add_dataset_admin.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ col-sm-4
<legend>Grants and Publications</legend>
{{ form_row(form.publications) }}
{{ form_row(form.awards) }}
{{ form_row(form.projects) }}
{% if userIsAdmin %}
{# RELATED DATASETS #}
<div class="form-group multiple">
Expand Down
1 change: 1 addition & 0 deletions app/Resources/views/default/admin-manage.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<a class="list-group-item" href="{{ path('update_entity', {'entityName':'Publisher'}) }}">Publishers</a>
<a class="list-group-item" href="{{ path('update_entity', {'entityName':'Publication'}) }}" >Cited Publications</a>
<a class="list-group-item" href="{{ path('update_entity', {'entityName':'Award'}) }}">Awards</a>
<a class="list-group-item" href="{{ path('update_entity', {'entityName':'Project'}) }}">Projects</a>
<a class="list-group-item" href="{{ path('update_entity', {'entityName':'DataType'}) }}">Data Types</a>
<a class="list-group-item" href="{{ path('update_entity', {'entityName':'DataCollectionInstrument'}) }}">Data Collection Instruments</a>
<a class="list-group-item" href="{{ path('update_entity', {'entityName':'DatasetFormat'}) }}">Dataset Formats</a>
Expand Down
1 change: 1 addition & 0 deletions app/Resources/views/default/update_dataset_admin.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ col-sm-4
<legend>Grants and Publications</legend>
{{ form_row(form.publications) }}
{{ form_row(form.awards) }}
{{ form_row(form.projects) }}
{% if userIsAdmin %}
{# RELATED DATASETS #}
<div class="form-group multiple">
Expand Down
62 changes: 7 additions & 55 deletions app/Resources/views/default/view_dataset_external.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,61 +4,7 @@


{% block page_scripts %}
<script>
/**
* Record outbound link clicks for Analytics
*/
var trackOutboundLink = function(url, label) {
ga('send', 'event', 'outbound', 'click', label);
}
/**
* Initialize page popovers
*/
$(function () {
// initialize Author popovers
$('.dataset-authors-section [data-toggle="popover"]').popover({
'html':'true',
'animation':false,
'trigger':'manual',
'placement':'bottom',
}).on("mouseenter", function () {
var _this = this;
$(this).popover("show");
$(".popover").on("mouseleave", function () {
$(_this).popover('hide');
});
}).on("mouseleave", function () {
var _this = this;
setTimeout(function () {
if (!$(".popover:hover").length) {
$(_this).popover("hide");
}
}, 200);
});
// initialize Publisher popovers
$('.publishers-list [data-toggle="popover"]').popover({
'html':'true',
'animation':false,
'trigger':'manual',
'placement':'top',
}).on("mouseenter", function () {
var _this = this;
$(this).popover("show");
$(".popover").on("mouseleave", function () {
$(_this).popover('hide');
});
}).on("mouseleave", function () {
var _this = this;
setTimeout(function () {
if (!$(".popover:hover").length) {
$(_this).popover("hide");
}
}, 200);
});
})
</script>
<script src="{{ asset('js/dataset_details.js') }}"></script>
{% endblock %}


Expand Down Expand Up @@ -153,6 +99,12 @@ $(function () {
{% endfor %}
</h5>
{% endif %}
</span>
{% if dataset.getProjects is not empty %}
{% for project in dataset.getProjects %}
<div class="dataset-detail-projects">Part of: <a href="{{ project.getProjectUrl }}" target="_blank">{{ project.getProjectName }}</a> | {{ project.getProjectDescription }}</div>
{% endfor %}
{% endif %}
<p>
<span class="dataset-detail-id">UID: {{ dataset.id }}</span>
</p>
Expand Down
40 changes: 7 additions & 33 deletions app/Resources/views/default/view_dataset_internal.html.twig
Original file line number Diff line number Diff line change
@@ -1,39 +1,8 @@
{% extends 'base.html.twig' %}
{% from 'default/_JSONLD_output.html.twig' import JSONLD_output %}
{% block page_scripts %}
<script>
/**
* Record outbound link clicks for Analytics
*/
var trackOutboundLink = function(url, label) {
ga('send', 'event', 'outbound', 'click', label);
}

/**
* Initialize Author popovers
*/
$(function () {
$('[data-toggle="popover"]').popover({
'html':'true',
'animation':false,
'trigger':'manual',
'placement':'bottom',
}).on("mouseenter", function () {
var _this = this;
$(this).popover("show");
$(".popover").on("mouseleave", function () {
$(_this).popover('hide');
});
}).on("mouseleave", function () {
var _this = this;
setTimeout(function () {
if (!$(".popover:hover").length) {
$(_this).popover("hide");
}
}, 200);
});
})
</script>
{% block page_scripts %}
<script src="{{ asset('js/dataset_details.js') }}"></script>
{% endblock %}


Expand Down Expand Up @@ -132,6 +101,11 @@ $(function () {
</h5>
{% endif %}
</span>
{% if dataset.getProjects is not empty %}
{% for project in dataset.getProjects %}
<div class="dataset-detail-projects">Part of: <a href="{{ project.getProjectUrl }}" target="_blank">{{ project.getProjectName }}</a> | {{ project.getProjectDescription }}</div>
{% endfor %}
{% endif %}
<p>
<span class="dataset-detail-id">UID: {{ dataset.id }}</span>
</p>
Expand Down
1 change: 1 addition & 0 deletions app/config/common/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ framework:
# handler_id set to null will use default session handler from php.ini
handler_id: session.handler.native_file
save_path: "%kernel.root_dir%/sessions"
cookie_secure: true
fragments: ~
http_method_override: true

Expand Down
4 changes: 4 additions & 0 deletions app/config/common/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@ services:
# service_name:
# class: AppBundle\Directory\ClassName
# arguments: ["@another_service_name", "plain_value", "%parameter_name%"]
app.security_headers_listener:
class: AppBundle\EventListener\ResponseListener
tags:
- { name: kernel.event_listener, event: kernel.response, method: onKernelResponse }
57 changes: 54 additions & 3 deletions src/AppBundle/Entity/Dataset.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,16 @@ class Dataset implements JsonSerializable {
protected $awards;


/**
* @ORM\ManyToMany(targetEntity="Project", cascade={"persist"}, inversedBy="datasets")
* @ORM\JoinTable(name="datasets_projects",
* joinColumns={@ORM\JoinColumn(name="dataset_uid",referencedColumnName="dataset_uid")},
* inverseJoinColumns={@ORM\JoinColumn(name="project_id",referencedColumnName="project_id")}
* )
*/
protected $projects;


/**
* @ORM\ManyToMany(targetEntity="AccessRestriction", cascade={"persist"}, inversedBy="datasets")
* @ORM\JoinTable(name="datasets_access_restrictions",
Expand Down Expand Up @@ -460,6 +470,7 @@ public function __construct()
$this->date_added = new \DateTime("now");
$this->dataset_formats = new \Doctrine\Common\Collections\ArrayCollection();
$this->awards = new \Doctrine\Common\Collections\ArrayCollection();
$this->projects = new \Doctrine\Common\Collections\ArrayCollection();
$this->access_restrictions = new \Doctrine\Common\Collections\ArrayCollection();
$this->data_collection_instruments = new \Doctrine\Common\Collections\ArrayCollection();
$this->subject_genders = new \Doctrine\Common\Collections\ArrayCollection();
Expand Down Expand Up @@ -1109,6 +1120,40 @@ public function getAwards()
return $this->awards;
}


/**
* Add projects
*
* @param \AppBundle\Entity\Project $projects
* @return Dataset
*/
public function addProject(\AppBundle\Entity\Project $projects)
{
$this->projects[] = $projects;

return $this;
}

/**
* Remove projects
*
* @param \AppBundle\Entity\Project $projects
*/
public function removeProject(\AppBundle\Entity\Project $projects)
{
$this->projects->removeElement($projects);
}

/**
* Get projects
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getProjects()
{
return $this->projects;
}

/**
* Add access_restrictions
*
Expand Down Expand Up @@ -1731,7 +1776,7 @@ public function getDatasetUid()
* @return array
*/
public function jsonSerialize() {
$formats = $awards = $restrictions = $stds = $genders = $sexes = $ages = [];
$formats = $awards = $projects = $restrictions = $stds = $genders = $sexes = $ages = [];
$equipment = $software = $subject_of_study = $others = [];
$locs = $rel = $areas = $area_details = $domains = $publications = $keywords = $publishers = [];
$authors = $data_type_array = $types_of_study = $corresponding_authors = $experts = [];
Expand All @@ -1755,6 +1800,7 @@ public function jsonSerialize() {
foreach ($this->data_types as $data_type) { $data_type_array[]=$data_type->getDisplayName(); }
foreach ($this->data_collection_instruments as $std) { $stds[]=$std->getDisplayName(); }
foreach ($this->awards as $award) { $awards[]=$award->getDisplayName(); }
foreach ($this->projects as $project) { $projects[]=$project->getDisplayName(); }
foreach ($this->local_experts as $expert) { $experts[]=$expert->getDisplayName(); }
foreach ($this->subject_domains as $domain) { $domains[]=$domain->getDisplayName(); }
foreach ($this->subject_genders as $gender) { $genders[]=$gender->getDisplayName(); }
Expand Down Expand Up @@ -1793,6 +1839,7 @@ public function jsonSerialize() {
'data_types' => $data_type_array,
'data_collection_standards' => $stds,
'awards' => $awards,
'projects' => $projects,
'local_experts' => $experts,
'subject_domains' => $domains,
'subject_genders' => $genders,
Expand All @@ -1813,13 +1860,14 @@ public function jsonSerialize() {
*/
public function serializeForSolr() {

$formats = $awards = $restrictions = $stds = $genders = $sexes = $ages = $equipment = $software = $subject_of_study = [];
$formats = $projects = $awards = $restrictions = $stds = $genders = $sexes = $ages = $equipment = $software = $subject_of_study = [];
$areas = $area_details = $domains = $publications = $keywords = $publishers = [];
$authors = $data_type_array = $types_of_study = $corresponding_authors = $experts = $data_locations = $akas = $related_datasets = [];
$other_resource_names = $other_resource_descriptions = $related_pubs = $data_location_contents = [];
$accession_numbers = $access_instructions = [];
foreach ($this->dataset_formats as $format) { $formats[]=$format->getDisplayName(); }
foreach ($this->awards as $award) { $awards[]=$award->getDisplayName(); }
foreach ($this->projects as $project) { $projects[]=$project->getDisplayName(); }
foreach ($this->access_restrictions as $restriction) { $restrictions[]=$restriction->getDisplayName(); }
foreach ($this->data_collection_instruments as $std) { $stds[]=$std->getDisplayName(); }
foreach ($this->subject_genders as $gender) { $genders[]=$gender->getDisplayName(); }
Expand Down Expand Up @@ -1868,6 +1916,7 @@ public function serializeForSolr() {
'study_types' => $types_of_study,
'collection_standards' => $stds,
'awards' => $awards,
'projects' => $projects,
'access_restrictions' => $restrictions,
'subject_population_ages'=>$ages,
'subject_geographic_area'=>$areas,
Expand Down Expand Up @@ -1897,7 +1946,7 @@ public function serializeForSolr() {
* @return array
*/
public function serializeComplete() {
$formats = $awards = $restrictions = $stds = $genders = $sexes = $ages = [];
$formats = $projects = $awards = $restrictions = $stds = $genders = $sexes = $ages = [];
$equipment = $software = $subject_of_study = $others = [];
$locs = $rel = $areas = $area_details = $domains = $publications = $keywords = $publishers = [];
$authors = $data_type_array = $types_of_study = $corresponding_authors = $experts = [];
Expand All @@ -1918,6 +1967,7 @@ public function serializeComplete() {
foreach ($this->data_types as $data_type) { $data_type_array[]=$data_type->getDisplayName(); }
foreach ($this->data_collection_instruments as $std) { $stds[]=$std->getAllProperties(); }
foreach ($this->awards as $award) { $awards[]=$award->getAllProperties(); }
foreach ($this->projects as $project) { $projects[]=$project->getAllProperties(); }
foreach ($this->local_experts as $expert) { $experts[]=$expert->getAllProperties(); }
foreach ($this->subject_domains as $domain) { $domains[]=$domain->getAllProperties(); }
foreach ($this->subject_genders as $gender) { $genders[]=$gender->getDisplayName(); }
Expand Down Expand Up @@ -1956,6 +2006,7 @@ public function serializeComplete() {
'data_types' => $data_type_array,
'data_collection_standards' => $stds,
'awards' => $awards,
'projects' => $projects,
'local_experts' => $experts,
'subject_domains' => $domains,
'subject_genders' => $genders,
Expand Down
Loading

0 comments on commit f3f33d7

Please sign in to comment.