diff --git a/.gitignore b/.gitignore index bd4e27a9..b7384f2d 100755 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,5 @@ app/config/common/security.yml app/Resources/views/institution/* web/css/institution/* src/AppBundle/Form/Type/ContactFormEmailType.php +SolrIndexer.py + diff --git a/SolrIndexer.php b/SolrIndexer.php new file mode 100644 index 00000000..63235e96 --- /dev/null +++ b/SolrIndexer.php @@ -0,0 +1,109 @@ +/api/dataset/all.json'; +#$solr_output_url = '/solr/collection1/select/?q=*:*&wt=json'; +#$solr_submit_url = '/solr/data_catalog/update/json?commit=true&overwrite=true'; +#$solr_remove_url = '/solr/data_catalog/update/?commit=true'; + +$db_output_url = 'http://testbox1.hsls.pitt.edu/data/api/dataset/all.json'; +$solr_output_url = 'http://testbox1.hsls.pitt.edu:8983/solr/collection1/select/?q=*:*&wt=json'; +$solr_submit_url = 'http://testbox1.hsls.pitt.edu:8983/solr/collection1/update/json?commit=true&overwrite=true'; +$solr_remove_url = 'http://testbox1.hsls.pitt.edu:8983/solr/collection1/update/?commit=true'; + + +if (! $fh = fopen($db_output_url, 'r')) { + exit("Could not open '{$db_output_url}'\n"); +} + +$db_json = stream_get_contents($fh); +$db_json_parsed = json_decode($db_json); + +fclose($fh); + +# +# Find items to remove + +if (! $fh = fopen($solr_output_url, 'r')) { + exit("Could not open '{$solr_output_url}'\n"); +} + +$solr_json = stream_get_contents($fh); + +fclose($fh); + +foreach (json_decode($solr_json)->response->docs as $row) { + + $found=0; + foreach($db_json_parsed as $db_row) { + + if ($row->id == $db_row->id) { + $found=1; + break; + } + + } + if ($found!=1) { + + $to_solr = "{'delete': {'id': ".$row->id."}}"; + $context = stream_context_create([ + 'http' => [ + 'method' => 'POST', + 'header' => 'Content-Type: application/json' . "\r\n" + . 'Content-Length: ' . strlen($to_solr) . "\r\n", + 'content' => $to_solr, + ] + ]); + + file_get_contents($solr_remove_url, null, $context); + print "delete ".$row->id."\n"; + + } + +} + + +# +# Find new/added items + +foreach ($db_json_parsed as $row) { + if ($row->dataset_end_date && $row->dataset_start_date) { + $end_date = $row->dataset_end_date; + if ('Present' == $row->dataset_end_date) { + $end_date = (int) (date('Y') + 1); + } + + if ($row->dataset_start_date == $end_date) { + $row->dataset_years = ["{$row->dataset_start_date}-01-01T00:00:00Z","{$end_date}-01-01T00:00:00Z"]; + } + else { + $row->dataset_years = []; + for ($i = $row->dataset_start_date; $i <= $end_date; $i++) { + $row->dataset_years[] = "{$i}-01-01T00:00:00Z"; + } + } + } + + foreach ($row as $k => $v) { + if (! $v) { + $row->{$k} = ''; + } + } + if ($row->date_added) { + $from_symfony = $row->date_added->date; + $row->date_added = trim(explode(' ', $from_symfony)[0]) . 'T00:00:00Z'; + } + + $to_solr = json_encode([$row]); + echo $to_solr; + + $context = stream_context_create([ + 'http' => [ + 'method' => 'POST', + 'header' => 'Content-Type: application/json' . "\r\n" + . 'Content-Length: ' . strlen($to_solr) . "\r\n", + 'content' => $to_solr, + ] + ]); + + file_get_contents($solr_submit_url, null, $context); +} diff --git a/app/AppKernel.php b/app/AppKernel.php index e13e041f..a87388ac 100755 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -16,6 +16,7 @@ public function registerBundles() new Symfony\Bundle\AsseticBundle\AsseticBundle(), new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), + new EWZ\Bundle\RecaptchaBundle\EWZRecaptchaBundle(), new AppBundle\AppBundle(), diff --git a/app/Resources/views/base.html.twig b/app/Resources/views/base.html.twig index 037a6fd1..6118a6ad 100755 --- a/app/Resources/views/base.html.twig +++ b/app/Resources/views/base.html.twig @@ -63,87 +63,102 @@ -
- -
-
-

Search here to find large public and licensed datasets

-
- - - - - -
- -
-
-
- - {# ADMIN NAV SIDEBAR #} - {% if is_granted('ROLE_USER') and adminPage is defined and adminPage==true %} -
- -
- {% endif %} - - {% block content %}{% endblock %} +
+
+
+ +
+
+
+
+ +

+ {{ site_name }} + A project by the Health Sciences Library System +

+
+ +
+
+ + + +
+ + + +
+ +
+
+ {# ADMIN NAV SIDEBAR #} + {% if is_granted('ROLE_USER') and adminPage is defined and adminPage==true %} +
+ +
+ {% endif %} + + + {% block content %}{% endblock %} +
{% block javascripts %} @@ -159,8 +174,18 @@
- {# Use the file 'institution/footer.html.twig' for your institution-specific footer content #} - {% include ['institution/footer.html.twig','footer.html.twig'] ignore missing %} +
diff --git a/app/Resources/views/base.html.twig.backup b/app/Resources/views/base.html.twig.backup new file mode 100755 index 00000000..c0f178ea --- /dev/null +++ b/app/Resources/views/base.html.twig.backup @@ -0,0 +1,171 @@ + + + + + + + {% block page_title %} + {{ site_name }} + {% endblock %} + + + + + + {# placeholder blocks for page-specific elements #} + {% block page_stylesheets %} + {% endblock %} + + {# if you use something like Google Analytics, put it in ./institution/analytics.html.twig and we'll include it here #} + {% include ['institution/analytics.html.twig', 'analytics.html.twig'] ignore missing %} + + {# placeholder block for JSON-LD output #} + {% block JSONLD_output %} + + + + {% endblock %} + + {% block results_JSONLD_output %} + {% endblock %} + + + +
+ +
+
+
+

Search here to find datasets

+
+ + + + +
+
+
+ Submit +
+
+
+
+ + {# ADMIN NAV SIDEBAR #} + {% if is_granted('ROLE_USER') and adminPage is defined and adminPage==true %} +
+ +
+ {% endif %} + + {% block content %}{% endblock %} + {% block javascripts %} + + + + + + {% endblock %} + {# placeholder block for page-specific scripts #} + {% block page_scripts %} + {% endblock %} +
+
+
+ + + diff --git a/app/Resources/views/default/add_dataset_admin.html.twig b/app/Resources/views/default/add_dataset_admin.html.twig index 1edc8a95..16aeebaa 100755 --- a/app/Resources/views/default/add_dataset_admin.html.twig +++ b/app/Resources/views/default/add_dataset_admin.html.twig @@ -164,7 +164,8 @@ col-sm-4
{% endif %} - + + {{ form_widget(form._token) }} {{ form_widget(form.save) }} diff --git a/app/Resources/views/default/contact.html.twig b/app/Resources/views/default/contact.html.twig index a6ab0c75..ae71885e 100755 --- a/app/Resources/views/default/contact.html.twig +++ b/app/Resources/views/default/contact.html.twig @@ -29,8 +29,12 @@ col-sm-5

Contact Us

+

Note: To request inclusion of your datasets, please use the Dataset Inclusion Form.

+

If you are interested in other services from the HSLS Data Services team, including customized trainings and consultations on data management and data sharing, visit our library webpage. + {{ form(form) }} + {% endblock %} diff --git a/app/Resources/views/default/feedback_email.html.twig b/app/Resources/views/default/feedback_email.html.twig index 8a610a29..74a38dab 100755 --- a/app/Resources/views/default/feedback_email.html.twig +++ b/app/Resources/views/default/feedback_email.html.twig @@ -5,10 +5,10 @@ Name: {{ msg.getFullName }}

-Employee ID: {{ msg.getEmployeeId }} +School/Center: {{ msg.getSchoolCenter }}

-Affiliation: {{ msg.getAffiliation }} +Department: {{ msg.getDepartment }}

Email: {{ msg.getEmailAddress }} @@ -19,3 +19,4 @@

{{ msg.getMessageBody }}

+ diff --git a/app/Resources/views/default/help.html.twig b/app/Resources/views/default/help.html.twig new file mode 100755 index 00000000..e69de29b diff --git a/app/Resources/views/default/results.html.twig b/app/Resources/views/default/results.html.twig index adf59bed..a76f3c49 100755 --- a/app/Resources/views/default/results.html.twig +++ b/app/Resources/views/default/results.html.twig @@ -7,7 +7,7 @@ +{% endspaceless %} {% endblock %} @@ -105,37 +160,69 @@ $(function () {
Author(s): {% set correspondingAuthorExists = false %} - {% for author in dataset.getAuthorships %} - {% set popoverContent = '' %} - {% set authorNote = '' %} - {% set authorClass = '' %} - {% if author.getPerson.getBioUrl %} - {% set popoverContent = popoverContent ~ '

View profile

' %} - {% endif %} - {% if author.getPerson.getOrcidId %} - {% set popoverContent = popoverContent ~ '

ORCID Profile

' %} - {% endif %} - {% if author.getPerson.getDatasetAssociations|length > 1 %} - {% set popoverContent = popoverContent ~ '

View other datasets

' %} - {% endif %} - {% if author.isCorrespondingAuthor %} - {% set correspondingAuthorExists = true %} - {% set authorClass = authorClass ~ ' corresponding-author' %} - {% set authorNote = authorNote ~ '*' %} - {% endif %} + {% set institutionAuthorExists = false %} + {% for author in dataset.getAuthorships|slice(0,5) %} - {% if popoverContent %}{% endif %}{{ author.getPerson.getFullName }}{{ authorNote }}{% if popoverContent %}{% endif %}{% if not loop.last %}, {% endif %} + {% if author.getPerson.isInstitutionAuthor %} + {% set institutionAuthorExists = true %} + {% endif %} + {% set popoverContent = '' %} + {% if author.getPerson.getBioUrl %} + {% if author.getPerson.getDatasetAssociations|length > 1 %} + {% set popoverContent = '

View profile

View other datasets

' %} + {% endif %} + {% else %} + {% if author.getPerson.getDatasetAssociations|length > 1 %} + {% set popoverContent = '

View other datasets

' %} + {% endif %} + {% endif %} + {% if author.isCorrespondingAuthor %} + {% if popoverContent %}{% endif %}{{ author.getPerson.getFullName }}*{% if popoverContent %}{% endif %}{% if not loop.last %},{% endif %}{% if loop.last %}...{% endif %} + {% set correspondingAuthorExists = true %} + {% else %} + {% if popoverContent %}{% endif %}{{ author.getPerson.getFullName }}{% if popoverContent %}{% endif %}{% if not loop.last %}, {% endif %}{% if loop.last %}...{%endif %} + {% endif %} {% endfor %} - -
+ + {% if dataset.getAuthorships.count > 5 %} + +
+ {% for author in dataset.getAuthorships|slice(5,dataset.getAuthorships.count) %} + + {% if author.getPerson.isInstitutionAuthor %} + {% set institutionAuthorExists = true %} + {% endif %} + + {% set popoverContent = '' %} + {% if author.getPerson.getBioUrl %} + {% if author.getPerson.getDatasetAssociations|length > 1 %} + {% set popoverContent = '

View profile

View other datasets

' %} + {% endif %} + {% else %} + {% if author.getPerson.getDatasetAssociations|length > 1 %} + {% set popoverContent = '

View other datasets

' %} + {% endif %} + + {% endif %} + {% if author.isCorrespondingAuthor %} + {% if popoverContent %}{% endif %}{{ author.getPerson.getFullName }}*{% if popoverContent %}{% endif %}{% if not loop.last %}, {% endif %} + {% set correspondingAuthorExists = true %} + {% else %} + {% if popoverContent %}{% endif %}{{ author.getPerson.getFullName }}{% if popoverContent %}{% endif %}{% if not loop.last %}, {% endif %} + {% endif %} + {% endfor %} +
+ {% endif %} + {% if correspondingAuthorExists %} * Corresponding Author {% endif %}
{% endif %} -

@@ -267,10 +354,7 @@ $(function () {
{% for location in dataset.dataLocations %}
- {% if location.getDataAccessUrl is not null %} - Access via {{ location.getDataLocation }} - {% endif %} -

{{ location.getLocationContent }} + Access via {{ location.getDataLocation }}

{{ location.getLocationContent }} {% if location.getAccessionNumber %}
Accession #: {{ location.getAccessionNumber }} {% endif %} @@ -404,15 +488,34 @@ $(function () { {% endif %} {% if (dataset.relatedDatasets.count > 0) %} - {{ render(controller('AppBundle:RelatedDataset:relatedDataset',{'relatedDatasets':dataset.relatedDatasets})) }} - {% endif %} +

Related Datasets
+ + {% if (related.relationshipNotes is defined) %} +
Related Dataset - Note
+
{{ related.relationshipNotes }}
+ {% endif %} + {% endif %} +
Data Catalog Record Updated
+
{{ dataset.dateUpdated|date("Y-m-d") }}
+ - + +

Notice and Disclaimer: Please note that the information in this catalog is provided as a courtesy, as is, and with no representations or warranties of any kind. When you contact the responsible individual(s) listed in each record, or, where applicable, access a data repository listed, you will be subject to terms and conditions required by the data custodian/data repository. The University of Pittsburgh does not attempt to judge the scholarly quality of the data referenced and relies on the judgment and research expertise of those who created and/or deposited it.

+ {% endblock %} diff --git a/app/Resources/views/default/view_dataset_internal.html.twig b/app/Resources/views/default/view_dataset_internal.html.twig index d44cedf0..258d1851 100755 --- a/app/Resources/views/default/view_dataset_internal.html.twig +++ b/app/Resources/views/default/view_dataset_internal.html.twig @@ -38,7 +38,66 @@ $(function () { {% block JSONLD_output %} -{{ JSONLD_output(dataset) }} +{% spaceless %} + +{% endspaceless %} {% endblock %} @@ -80,33 +139,70 @@ $(function () {
Author(s): {% set correspondingAuthorExists = false %} - {% for author in dataset.getAuthorships %} - {% set popoverContent = '' %} - {% set authorNote = '' %} - {% set authorClass = '' %} - {% if author.getPerson.getBioUrl %} - {% set popoverContent = popoverContent ~ '

Institutional profile

' %} - {% endif %} - {% if author.getPerson.getOrcidId %} - {% set popoverContent = popoverContent ~ '

ORCID Profile

' %} - {% endif %} - {% if author.getPerson.getDatasetAssociations|length > 1 %} - {% set popoverContent = popoverContent ~ '

View other datasets

' %} - {% endif %} - {% if author.isCorrespondingAuthor %} - {% set correspondingAuthorExists = true %} - {% set authorClass = authorClass ~ ' corresponding-author' %} - {% set authorNote = authorNote ~ '*' %} - {% endif %} + {% set institutionAuthorExists = false %} - {% if popoverContent %}{% endif %}{{ author.getPerson.getFullName }}{{ authorNote }}{% if popoverContent %}{% endif %}{% if not loop.last %}, {% endif %} + {% for author in dataset.getAuthorships|slice(0,5) %} + + {% if author.getPerson.isInstitutionAuthor %} + {% set institutionAuthorExists = true %} + {% endif %} + {% set popoverContent = '' %} + {% if author.getPerson.getBioUrl %} + {% if author.getPerson.getDatasetAssociations|length > 1 %} + {% set popoverContent = '

View profile

View other datasets

' %} + {% endif %} + {% else %} + {% if author.getPerson.getDatasetAssociations|length > 1 %} + {% set popoverContent = '

View other datasets

' %} + {% endif %} + {% endif %} + {% if author.isCorrespondingAuthor %} + {% if popoverContent %}{% endif %}{{ author.getPerson.getFullName }}*{% if popoverContent %}{% endif %}{% if not loop.last %},{% endif %}{% if loop.last %}...{% endif %} + {% set correspondingAuthorExists = true %} + {% else %} + {% if popoverContent %}{% endif %}{{ author.getPerson.getFullName }}{% if popoverContent %}{% endif %}{% if not loop.last %}, {% endif %}{% if loop.last %}...{%endif %} + {% endif %} {% endfor %} - -
+ + {% if dataset.getAuthorships.count > 5 %} + +
+ {% for author in dataset.getAuthorships|slice(5,dataset.getAuthorships.count) %} + + {% if author.getPerson.isInstitutionAuthor %} + {% set institutionAuthorExists = true %} + {% endif %} + + {% set popoverContent = '' %} + {% if author.getPerson.getBioUrl %} + {% if author.getPerson.getDatasetAssociations|length > 1 %} + {% set popoverContent = '

View profile

View other datasets

' %} + {% endif %} + {% else %} + {% if author.getPerson.getDatasetAssociations|length > 1 %} + {% set popoverContent = '

View other datasets

' %} + {% endif %} + + {% endif %} + {% if author.isCorrespondingAuthor %} + {% if popoverContent %}{% endif %}{{ author.getPerson.getFullName }}*{% if popoverContent %}{% endif %}{% if not loop.last %}, {% endif %} + {% set correspondingAuthorExists = true %} + {% else %} + {% if popoverContent %}{% endif %}{{ author.getPerson.getFullName }}{% if popoverContent %}{% endif %}{% if not loop.last %}, {% endif %} + {% endif %} + {% endfor %} +
+ {% endif %} + {% if correspondingAuthorExists %} * Corresponding Author {% endif %} + {% if institutionAuthorExists %} + + {{ institution_author_display }} + {% endif %}
{% endif %} @@ -157,7 +253,7 @@ $(function () { {% endif %} - {% if dataset.localExperts|length > 0 %} + {% if dataset.localExperts|length > 1 %}
{{ local_expert_display }}
{% for expert in dataset.localExperts %}
@@ -228,10 +324,7 @@ $(function () {
{% for location in dataset.dataLocations %}
- {% if location.getDataAccessUrl is not null %} - Access via {{ location.getDataLocation }} - {% endif %} -

{{ location.getLocationContent }} + Access via {{ location.getDataLocation }}

{{ location.getLocationContent }} {% if location.getAccessionNumber %}
Accession #: {{ location.getAccessionNumber }} {% endif %} @@ -382,13 +475,30 @@ $(function () { {% endif %} {% if (dataset.relatedDatasets.count > 0) %} - {{ render(controller('AppBundle:RelatedDataset:relatedDataset',{'relatedDatasets':dataset.relatedDatasets})) }} - {% endif %} +

Related Datasets
+ + {% if (related.relationshipNotes is defined) %} +
Related Dataset - Note
+
{{ related.relationshipNotes }}
+ {% endif %} + {% endif %} +
Data Catalog Record Updated
+
{{ dataset.dateUpdated|date("Y-m-d") }}
- + +

Notice and Disclaimer: Please note that the information in this catalog is provided as a courtesy, as is, and with no representations or warranties of any kind. When you contact the responsible individual(s) listed in each record, or, where applicable, access a data repository listed, you will be subject to terms and conditions required by the data custodian/data repository. The University of Pittsburgh does not attempt to judge the scholarly quality of the data referenced and relies on the judgment and research expertise of those who created and/or deposited it.

diff --git a/app/Resources/views/footer.html.twig b/app/Resources/views/footer.html.twig index b2cdd140..ec560420 100644 --- a/app/Resources/views/footer.html.twig +++ b/app/Resources/views/footer.html.twig @@ -1,3 +1,3 @@ {# Use this template for your institution's footer content #} - +

© 1996-2018 Health Sciences Library System, University of Pittsburgh. All rights reserved.

+
diff --git a/app/Resources/views/logo.html.twig b/app/Resources/views/logo.html.twig index 991e8d73..9bbe3657 100644 --- a/app/Resources/views/logo.html.twig +++ b/app/Resources/views/logo.html.twig @@ -1,5 +1,5 @@ {# This assumes your logo has been uploaded to: /web/img/logo.jpg #} {# Remember to enter a URL if you want the logo to link anywhere #} - + diff --git a/app/Resources/views/static/home.html.twig b/app/Resources/views/static/home.html.twig new file mode 100644 index 00000000..d2f76500 --- /dev/null +++ b/app/Resources/views/static/home.html.twig @@ -0,0 +1,32 @@ +{% extends 'base.html.twig' %} + +{% block page_title %} +Home | Pitt Data Catalog +{% endblock %} + +{% block page_stylesheets %} +{% endblock %} + + +{% block page_scripts %} +{% endblock %} + + +{% block content %} +
+
+ +
+
+ +{% endblock %} + + diff --git a/app/config/common/config.yml b/app/config/common/config.yml index c4639d59..3a858df8 100755 --- a/app/config/common/config.yml +++ b/app/config/common/config.yml @@ -55,3 +55,10 @@ swiftmailer: username: "%mailer_user%" password: "%mailer_password%" spool: { type: memory } + +ewz_recaptcha: + public_key: 6Le85SwUAAAAAEnmGt8kyR5Xx15tUqiQDLkrnmLe + private_key: 6Le85SwUAAAAADalw-2f6Uf6I0UHFEvCxG8QoT8R + # Not needed as "%kernel.default_locale%" is the default value for the locale key + locale_key: %kernel.default_locale% + diff --git a/app/config/dev/config.yml b/app/config/dev/config.yml index c768d4bb..288b253c 100755 --- a/app/config/dev/config.yml +++ b/app/config/dev/config.yml @@ -88,3 +88,8 @@ swiftmailer: host: localhost port: 25 +ewz_recaptcha: + public_key: 6Le85SwUAAAAAEnmGt8kyR5Xx15tUqiQDLkrnmLe + private_key: 6Le85SwUAAAAADalw-2f6Uf6I0UHFEvCxG8QoT8R + # Not needed as "%kernel.default_locale%" is the default value for the locale key + locale_key: %kernel.default_locale% diff --git a/app/config/dev/parameters.yml.backup b/app/config/dev/parameters.yml.backup new file mode 100755 index 00000000..6d9c1086 --- /dev/null +++ b/app/config/dev/parameters.yml.backup @@ -0,0 +1,92 @@ +## +## +## This is a sample parameters.yml file. Your installation will need at +## least these parameters. Use this file to customize your installation +## and tell Symfony about your database and Solr servers. +## +## This file must be copied into the ./dev/ and ./prod/ directories: +## ./dev/parameters.yml will have your Dev database and Solr installation +## ./prod/parameters.yml will have the production info +## +## If you use git/github, MAKE SURE ALL THESE FILES ARE IN YOUR .GITIGNORE!!! +## You should see the line "app/config/**/parameters.yml" in there by default. +## +## + + +parameters: + # + # Set these parameters for your installation so we can use them in our templates + # Some of this information is used in the Structured Data output + # + site_name: "Generic Data Catalog" + site_description: "This is a generic description of a generic data catalog." + site_base_url: "http://datacatalog.hsls.pitt.edu" + site_provider_name: "Generic Library or Department that Made the Data Catalog" + site_provider_url: "http://datacatalog.hsls.pitt.edu" + institution_name: "Generic Academic Institution" + institution_name_short: "Our Institution" + institution_address: "3550 Terrace Street, Pittsburgh, PA USA" + institution_url: "http://www.pitt.edu" + + # Options for the contact form + contact_email_to: + contact_email_from: + institutional_affiliation_options: + - "Generic School of Medicine" + - "Generic School of Engineering" + - "Generic School of Etc." + + # Badge to display for internal datasets + internal_dataset_text: "Internal Dataset" + + # Tag to display for local experts (if you want to specify the institution) + local_expert_display: "Local Expert" + + + # + # Technical stuff + # + database_driver: pdo_mysql + database_name: nyudb_from_dc + database_host: 127.0.0.1 + database_user: nyudbuser + database_password: m0re5mU + database_port: 3306 + mailer_transport: smtp + mailer_host: 127.0.0.1 + mailer_user: null + mailer_password: null + locale: en + secret: 01dMaNseDGET0ffofm1LAwN78uuY + # If you're using LDAP authentication + ldap.host: + ldap.port: + + # + # Solr stuff. You mostly want to set the server URL. + # The other settings are a bit more involved to change. + # + solrsearchr_server: testbox1.hsls.pitt.edu:8983/solr/collection1/ + solrsearchr_format: json + solrsearchr_facets: + - origin_fq + - subject_domain_fq + - subject_geographic_area_fq + - access_restrictions_fq + solrsearchr_fields_to_search: + - _text_ + solrsearchr_fields_to_display: + - id + - origin + - dataset_title + - dataset_alt_title + - authors + - description + - subject_domain + - access_restrictions + - local_experts + - subject_geographic_area + - dataset_start_date + - dataset_end_date + diff --git a/app/config/dev/security.yml.gone b/app/config/dev/security.yml.gone new file mode 100755 index 00000000..22119941 --- /dev/null +++ b/app/config/dev/security.yml.gone @@ -0,0 +1,36 @@ +# you can read more about security in the related section of the documentation +# http://symfony.com/doc/current/book/security.html +security: + # http://symfony.com/doc/current/book/security.html#encoding-the-user-s-password + encoders: + Symfony\Component\Security\Core\User\User: plaintext + + # http://symfony.com/doc/current/book/security.html#hierarchical-roles + role_hierarchy: + ROLE_ADMIN: ROLE_USER + ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH] + + # http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers + providers: + in_memory: + memory: + users: + user: { password: userpass, roles: [ 'ROLE_USER' ] } + admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] } + + # the main part of the security, where you can set up firewalls + # for specific sections of your app + firewalls: + # disables authentication for assets and the profiler, adapt it according to your needs + dev: + pattern: ^/(_(profiler|wdt)|css|images|js)/ + security: false + + # with these settings you can restrict or allow access for different parts + # of your application based on roles, ip, host or methods + # http://symfony.com/doc/current/cookbook/security/access_control.html + access_control: + - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https } + - { path: ^/add, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https } + - { path: ^/remove, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https } + - { path: ^/update, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https } diff --git a/app/config/prod/config.yml b/app/config/prod/config.yml index 9bb7ccf7..21cf78c8 100755 --- a/app/config/prod/config.yml +++ b/app/config/prod/config.yml @@ -25,6 +25,7 @@ twig: institution_url: '%institution_url%' internal_dataset_text: '%internal_dataset_text%' local_expert_display: '%local_expert_display%' + institution_author_display: '%institution_author_display%' doctrine: dbal: diff --git a/app/config/prod/parameters.yml.backup b/app/config/prod/parameters.yml.backup new file mode 100755 index 00000000..3793c911 --- /dev/null +++ b/app/config/prod/parameters.yml.backup @@ -0,0 +1,96 @@ +## +## +## This is a sample parameters.yml file. Your installation will need at +## least these parameters. Use this file to customize your installation +## and tell Symfony about your database and Solr servers. +## +## This file must be copied into the ./dev/ and ./prod/ directories: +## ./dev/parameters.yml will have your Dev database and Solr installation +## ./prod/parameters.yml will have the production info +## +## If you use git/github, MAKE SURE ALL THESE FILES ARE IN YOUR .GITIGNORE!!! +## You should see the line "app/config/**/parameters.yml" in there by default. +## +## + + +parameters: + # + # Set these parameters for your installation so we can use them in our templates + # Some of this information is used in the Structured Data output + # + + site_name: "Pitt Data Catalog" + site_description: "HSLS - This is a generic description of a generic data catalog." + site_base_url: "http://datacatalog.hsls.pitt.edu" + site_provider_name: "HSLS Generic Library or Department that Made the Data Catalog" + site_provider_url: "http://datacatalog.hsls.pitt.edu" + institution_name: "HSLS Generic Academic Institution" + institution_name_short: "HSLS" + institution_address: "3550 Terrace Street, Pittsburgh USA" + institution_url: "http://www.pitt.edu" + + # Options for the contact form + contact_email_to: jpm159@pitt.edu + contact_email_from: hslsdata@pitt.edu + institutional_affiliation_options: + - "Generic School of Medicine" + - "Generic School of Engineering" + - "Generic School of Etc." + + # Badge to display for internal datasets + internal_dataset_text: "Internal Dataset" + + # Tag to display for local experts (if you want to specify the institution) + local_expert_display: "Local Expert" + + institution_author_display: "University of Pittsburgh Author" + + + # + # Technical stuff + # + database_driver: pdo_mysql + database_name: nyudb_from_dc + database_host: 127.0.0.1 + database_user: nyudbuser + database_password: m0re5mU + database_port: 3306 + mailer_transport: smtp + mailer_host: 127.0.0.1 + mailer_user: null + mailer_password: null + locale: en + secret: 01dMaNseDGET0ffofm1LAwN78uuY + # If you're using LDAP authentication + ldap.host: + ldap.port: + + # + # Solr stuff. You mostly want to set the server URL. + # The other settings are a bit more involved to change. + # + solrsearchr_server: testbox1.hsls.pitt.edu:8983/solr/collection1/ + solrsearchr_format: json + solrsearchr_facets: + # - origin_fq + # - subject_domain_fq + - subject_geographic_area_fq + - access_restrictions_fq + solrsearchr_fields_to_search: + - _text_ + solrsearchr_fields_to_display: + - id + - origin + - dataset_title + - dataset_alt_title + - authors + - description + - subject_keywords + - subject_domain + - access_restrictions + - local_experts + - subject_geographic_area + - dataset_start_date + - dataset_end_date + diff --git a/composer.json b/composer.json index e2e635a8..d86240d9 100755 --- a/composer.json +++ b/composer.json @@ -19,6 +19,7 @@ "sensio/distribution-bundle": "~4.0", "sensio/framework-extra-bundle": "^3.0.2", "incenteev/composer-parameter-handler": "~2.0", + "excelwebzone/recaptcha-bundle": "^1.5", "guzzlehttp/guzzle": "^6.3", "doctrine/doctrine-fixtures-bundle": "2.3.0" }, diff --git a/composer.lock b/composer.lock index f8f0f323..ae9bce95 100755 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "ae1e994a6b95a99e1e289cce355679a7", + "content-hash": "c2425a7a3e32380c3f5c413fc48564ab", "packages": [ { "name": "doctrine/annotations", @@ -887,6 +887,107 @@ ], "time": "2016-12-18T15:42:34+00:00" }, + { + "name": "excelwebzone/recaptcha-bundle", + "version": "v1.5.11", + "source": { + "type": "git", + "url": "https://github.com/excelwebzone/EWZRecaptchaBundle.git", + "reference": "609e2a59980825085f953c794bf85311032c9cc2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/excelwebzone/EWZRecaptchaBundle/zipball/609e2a59980825085f953c794bf85311032c9cc2", + "reference": "609e2a59980825085f953c794bf85311032c9cc2", + "shasum": "" + }, + "require": { + "google/recaptcha": "^1.1", + "php": ">=5.6 || ^7.0", + "symfony/form": "^2.8 || ^3.0 || ^4.0", + "symfony/framework-bundle": "^2.8 || ^3.0 || ^4.0", + "symfony/security-bundle": "^2.8 || ^3.0 || ^4.0", + "symfony/validator": "^2.8 || ^3.0 || ^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^5 || ^6 || ^7" + }, + "type": "symfony-bundle", + "extra": { + "symfony": { + "allow-contrib": "true" + } + }, + "autoload": { + "psr-4": { + "EWZ\\Bundle\\RecaptchaBundle\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael H. Arieli", + "email": "excelwebzone@gmail.com", + "homepage": "http://excelwebzone.com/" + } + ], + "description": "This bundle provides easy reCAPTCHA form field integration", + "homepage": "https://github.com/excelwebzone/EWZRecaptchaBundle", + "keywords": [ + "recaptcha" + ], + "time": "2018-06-19T01:14:57+00:00" + }, + { + "name": "google/recaptcha", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/google/recaptcha.git", + "reference": "e7add3be59211482ecdb942288f52da64a35f61a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/google/recaptcha/zipball/e7add3be59211482ecdb942288f52da64a35f61a", + "reference": "e7add3be59211482ecdb942288f52da64a35f61a", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.2.20|^2.12", + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^4.8.36|^5.7.27|^6.59|^7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "ReCaptcha\\": "src/ReCaptcha" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Client library for reCAPTCHA, a free service that protects websites from spam and abuse.", + "homepage": "https://www.google.com/recaptcha/", + "keywords": [ + "Abuse", + "captcha", + "recaptcha", + "spam" + ], + "time": "2018-08-05T09:31:53+00:00" + }, { "name": "guzzlehttp/guzzle", "version": "6.3.3", diff --git a/src/AppBundle/Controller/GeneralController.php b/src/AppBundle/Controller/GeneralController.php index bd565699..bfb3a434 100755 --- a/src/AppBundle/Controller/GeneralController.php +++ b/src/AppBundle/Controller/GeneralController.php @@ -38,14 +38,33 @@ */ class GeneralController extends Controller { + /** - * Performs searches and produces results pages + * Returns the homepage * * @param Request The current HTTP request * * @return Response A Response instance * * @Route("/", name="homepage") + */ + public function homepageAction(Request $request) { + + return $this->render('static/home.html.twig', array()); + + } + + + + + + /** + * Performs searches and produces results pages + * + * @param Request The current HTTP request + * + * @return Response A Response instance + * * @Route("/search", name="user_search_results") */ public function indexAction(Request $request) { @@ -72,6 +91,8 @@ public function indexAction(Request $request) { } + + /** * Produce the About page, checking if we have an institution- @@ -94,6 +115,26 @@ public function aboutAction(Request $request) { } + /** + * Produce the Help page + * + * @param Request The current HTTP request + * + * @return Response A Response instance + * @Route("/help", name="help") + */ + public function helpAction(Request $request) { + + if ($this->get('templating')->exists('institution/help.html.twig')) { + return $this->render('institution/help.html.twig',array()); + } + else { + return $this->render('default/help.html.twig', array()); + } + + } + + /** * Produce the Contact Us page and send emails to the * users specified in parameters.yml @@ -112,7 +153,7 @@ public function contactAction(Request $request) { // Get email addresses and institution list from parameters.yml $emailTo = $this->container->getParameter('contact_email_to'); - $emailFrom = $this->container->getParameter('contact_email_from'); + //$emailFrom = $this->container->getParameter('contact_email_from'); $affiliationOptions = $this->container->getParameter('institutional_affiliation_options'); $em = $this->getDoctrine()->getManager(); @@ -120,6 +161,7 @@ public function contactAction(Request $request) { $form->handleRequest($request); if ($form->isValid()) { $email = $form->getData(); + $emailFrom = [ $form['email_address']->getData() => $form['full_name']->getData() ]; // save their submission to the database first $em->persist($email); @@ -151,6 +193,66 @@ public function contactAction(Request $request) { } + /** + * Produce the Submit Dataset contact page and send emails to the + * users specified in parameters.yml + * NOTE: The setTo() and setFrom() methods are supposed + * to accept arrays for multiple recipients, but this appears + * not to work. + * + * @param Request The current HTTP request + * + * @return Response A Response instance + * + * @Route("/submit-dataset", name="submitdataset") + */ + + public function submitdatasetAction(Request $request) { + $submitDatasetFormEmail = new \AppBundle\Entity\SubmitDatasetFormEmail(); + + // Get email addresses and institution list from parameters.yml + $emailTo = $this->container->getParameter('contact_email_to'); + //$emailFrom = $this->container->getParameter('contact_email_from'); + $affiliationOptions = $this->container->getParameter('institutional_affiliation_options'); + + $em = $this->getDoctrine()->getManager(); + $form = $this->createForm(new \AppBundle\Form\Type\SubmitDatasetFormEmailType($affiliationOptions), $submitDatasetFormEmail); + $form->handleRequest($request); + if ($form->isValid()) { + $email = $form->getData(); + $emailFrom = [ $form['email_address']->getData() => $form['full_name']->getData() ]; + + // save their submission to the database first + $em->persist($email); + $em->flush(); + + $mailer = $this->get('mailer'); + $message = $mailer->createMessage() + ->setSubject('New Submit Dataset Entry | Data Catalog') + ->setFrom($emailFrom) + ->setTo($emailTo) + ->setBody( + $this->renderView( + 'default/submit_dataset_email.html.twig', + array('msg' => $email) + ), + 'text/html' + ); + $mailer->send($message); + + return $this->render('default/submit_dataset_email_send_success.html.twig', array( + 'form' => $form->createView(), + )); + } + + return $this->render('default/submit_dataset.html.twig', array( + 'form' => $form->createView(), + )); + + } + + + /** * Produce the detailed pages for individual datasets * diff --git a/src/AppBundle/Controller/HomepageController.php b/src/AppBundle/Controller/HomepageController.php new file mode 100755 index 00000000..b37d224f --- /dev/null +++ b/src/AppBundle/Controller/HomepageController.php @@ -0,0 +1,54 @@ +. + * + */ +class GeneralController extends Controller +{ + /** + * Performs searches and produces results pages + * + * @param Request The current HTTP request + * + * @return Response A Response instance + * + * @Route("/", name="homepage") + */ + public function homepageAction(Request $request) { + + return $this->render('default/about.html.twig', array()); + + } + + +} diff --git a/src/AppBundle/Controller/HomepageController.php.delete b/src/AppBundle/Controller/HomepageController.php.delete new file mode 100755 index 00000000..b37d224f --- /dev/null +++ b/src/AppBundle/Controller/HomepageController.php.delete @@ -0,0 +1,54 @@ +. + * + */ +class GeneralController extends Controller +{ + /** + * Performs searches and produces results pages + * + * @param Request The current HTTP request + * + * @return Response A Response instance + * + * @Route("/", name="homepage") + */ + public function homepageAction(Request $request) { + + return $this->render('default/about.html.twig', array()); + + } + + +} diff --git a/src/AppBundle/Entity/ContactFormEmail.php b/src/AppBundle/Entity/ContactFormEmail.php index 05dc7020..0dcfdde3 100755 --- a/src/AppBundle/Entity/ContactFormEmail.php +++ b/src/AppBundle/Entity/ContactFormEmail.php @@ -4,6 +4,7 @@ use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; +use EWZ\Bundle\RecaptchaBundle\Validator\Constraints as Recaptcha; /** * Entity to describe emails submitted via the contact form @@ -36,13 +37,25 @@ class ContactFormEmail { */ protected $id; + /** + * @Recaptcha\IsTrue + */ + public $recaptcha; + + + /** - * @ORM\Column(type="string",length=18) + * @ORM\Column(type="string",length=128,nullable=true) */ - protected $employee_id; - + protected $school_center; + /** - * @ORM\Column(type="string",length=128) + * @ORM\Column(type="string",length=128,nullable=true) + */ + protected $department; + + /** + * @ORM\Column(type="string",length=128,nullable=true) */ protected $full_name; @@ -96,28 +109,6 @@ public function getId() return $this->id; } - /** - * Set employee_id - * - * @param string $employeeId - * @return ContactFormEmail - */ - public function setEmployeeId($employeeId) - { - $this->employee_id = $employeeId; - - return $this; - } - - /** - * Get employee_id - * - * @return string - */ - public function getEmployeeId() - { - return $this->employee_id; - } /** * Set full_name @@ -189,6 +180,53 @@ public function getAffiliation() } /** + * Set school_center + * + * @param string school_center + * @return ContactFormEmail + */ + public function setSchoolCenter($school_center) + { + $this->school_center = $school_center; + + return $this; + } + + /** + * Get school_center + * + * @return string + */ + public function getSchoolCenter() + { + return $this->school_center; + } + + /** + * Set department + * + * @param string department + * @return ContactFormEmail + */ + public function setDepartment($department) + { + $this->department = $department; + + return $this; + } + + /** + * Get department + * + * @return string + */ + public function getDepartment() + { + return $this->department; + } + + + /** * Set reason * * @param string $reason @@ -210,7 +248,11 @@ public function getReason() { return $this->reason; } - + + + + + /** * Set message_body * @@ -256,4 +298,5 @@ public function getChecker() { return $this->checker; } + } diff --git a/src/AppBundle/Entity/DataLocation.php b/src/AppBundle/Entity/DataLocation.php index a2dce10f..29f0a2a7 100755 --- a/src/AppBundle/Entity/DataLocation.php +++ b/src/AppBundle/Entity/DataLocation.php @@ -46,7 +46,7 @@ class DataLocation { protected $location_content; /** - * @ORM\Column(type="string",length=1028, nullable=true) + * @ORM\Column(type="string",length=1028) */ protected $data_access_url; diff --git a/src/AppBundle/Entity/Person.php b/src/AppBundle/Entity/Person.php index af89f8da..7502d4f8 100755 --- a/src/AppBundle/Entity/Person.php +++ b/src/AppBundle/Entity/Person.php @@ -85,17 +85,16 @@ class Person { */ protected $email; - + /** - * @ORM\Column(type="boolean", options={"default"=false}, nullable=true) + * @ORM\OneToMany(targetEntity="PersonAssociation", mappedBy="person") */ - protected $works_here; - + protected $datasetAssociations; /** - * @ORM\OneToMany(targetEntity="PersonAssociation", mappedBy="person") + * @ORM\Column(type="boolean",length=128) */ - protected $datasetAssociations; + protected $is_institution_author = false; /** @@ -264,6 +263,27 @@ public function getEmail() return $this->email; } + /** + * Set is institution author + * + * @param string $institution + * @return Person + */ + public function setIsInstitutionAuthor($institution) + { + $this->is_institution_author = $institution; + return $this; + } + + /** + * Get is institution author + * + * @return string + */ + public function getIsInstitutionAuthor() + { + return $this->is_institution_author; + } /** * Set slug @@ -311,32 +331,6 @@ public function getOrcidId() return $this->orcid_id; } - - /** - * Set works_here - * - * @param string $worksHere - * @return Person - */ - public function setWorksHere($worksHere) - { - $this->works_here = $worksHere; - - return $this; - } - - - /** - * Get works_here - * - * @return string - */ - public function getWorksHere() - { - return $this->works_here; - } - - public function getDatasetAssociations() { return $this->datasetAssociations->toArray(); @@ -381,8 +375,7 @@ public function getAllProperties() { 'first_name'=>$this->first_name, 'orcid_id'=>$this->orcid_id, 'bio_url'=>$this->bio_url, - 'email'=>$this->email, - 'works_here'=>$this->works_here + 'email'=>$this->email ); } } diff --git a/src/AppBundle/Entity/SearchState.php b/src/AppBundle/Entity/SearchState.php index 953f5cfb..c63110c8 100755 --- a/src/AppBundle/Entity/SearchState.php +++ b/src/AppBundle/Entity/SearchState.php @@ -46,10 +46,12 @@ public function __construct($request) { if ($this->keyword && !$this->sort) { // if a keyword was entered, but sort wasn't specified $this->sort = 'relevance'; + #$this->sort = 'date added'; } elseif (!$this->sort) { // if no keyword, and no sort specified (this is the default) - $this->sort = 'name'; + #$this->sort = 'name'; + $this->sort = 'date added'; } else { // if no keyword, but sort is specified, then diff --git a/src/AppBundle/Entity/SubmitDatasetFormEmail.php b/src/AppBundle/Entity/SubmitDatasetFormEmail.php new file mode 100644 index 00000000..40ecaddb --- /dev/null +++ b/src/AppBundle/Entity/SubmitDatasetFormEmail.php @@ -0,0 +1,332 @@ +. + * + * + * + * @ORM\Entity + * @ORM\Table(name="submitdatasetform_emails") + */ +class SubmitDatasetFormEmail { + /** + * @ORM\Column(type="integer",name="submitdataset_id") + * @ORM\Id + * @ORM\GeneratedValue(strategy="AUTO") + */ + protected $id; + + /** + * @Recaptcha\IsTrue + */ + public $recaptcha; + + + + /** + * @ORM\Column(type="string",length=128,nullable=true) + */ + protected $school_center; + + /** + * @ORM\Column(type="string",length=128,nullable=true) + */ + protected $department; + + /** + * @ORM\Column(type="string",length=128,nullable=true) + */ + protected $full_name; + + /** + * @ORM\Column(type="string",length=128) + */ + protected $email_address; + + /** + * @ORM\Column(type="string",length=32,nullable=true) + */ + protected $phone_number; + + /** + * @ORM\Column(type="string",length=1024,nullable=true) + */ + protected $dataset_url; + + /** + * @ORM\Column(type="string",length=8192,nullable=true) + */ + protected $details; + + /** + * @ORM\Column(type="string",length=8192, nullable=true) + */ + protected $comments; + + /** + * @ORM\Column(type="string",length=128,nullable=true) + * @Assert\Blank() + */ + protected $checker; + + + + /** + * Get name for display + * + * @return string + */ + public function getDisplayName() { + return $this->full_name; + } + + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + + /** + * Set full_name + * + * @param string $fullName + * @return SubmitDatasetFormEmail + */ + public function setFullName($fullName) + { + $this->full_name = $fullName; + + return $this; + } + + /** + * Get full_name + * + * @return string + */ + public function getFullName() + { + return $this->full_name; + } + + /** + * Set email_address + * + * @param string $emailAddress + * @return SubmitDatasetFormEmail + */ + public function setEmailAddress($emailAddress) + { + $this->email_address = $emailAddress; + + return $this; + } + + /** + * Get email_address + * + * @return string + */ + public function getEmailAddress() + { + return $this->email_address; + } + + + + /** + * Set phone_number + * + * @param string $phoneNumber + * @return SubmitDatasetFormEmail + */ + public function setPhoneNumber($phoneNumber) + { + $this->phone_number = $phoneNumber; + + return $this; + } + + /** + * Get email_address + * + * @return string + */ + public function getPhoneNumber() + { + return $this->phone_number; + } + + + /** + * Set school_center + * + * @param string $school_center + * @return SubmitDatasetFormEmail + */ + public function setSchoolCenter($school_center) + { + $this->school_center = $school_center; + + return $this; + } + + /** + * Get school_center + * + * @return string + */ + public function getSchoolCenter() + { + return $this->school_center; + } + + /** + * Set department + * + * @param string $department + * @return SubmitDatasetFormEmail + */ + public function setDepartment($department) + { + $this->department = $department; + + return $this; + } + + /** + * Get department + * + * @return string + */ + public function getDepartment() + { + return $this->department; + } + + + /** + * Set dataset_url + * + * @param string $datasetUrl + * @return SubmitDatasetFormEmail + */ + public function setDatasetUrl($datasetUrl) + { + $this->dataset_url = $datasetUrl; + + return $this; + } + + /** + * Get dataset_url + * + * @return string + */ + public function getDatasetUrl() + { + return $this->dataset_url; + } + + + /** + * Set details + * + * @param string $details + * @return SubmitDatasetFormEmail + */ + public function setDetails($details) + { + $this->details = $details; + + return $this; + } + + /** + * Get details + * + * @return string + */ + public function getDetails() + { + return $this->details; + } + + + /** + * Set comments + * + * @param string $comments + * @return SubmitDatasetFormEmail + */ + public function setComments($comments) + { + $this->comments = $comments; + + return $this; + } + + /** + * Get comments + * + * @return string + */ + public function getComments() + { + return $this->comments; + } + + + + /** + * Set checker + * + * @param string $checker + * @return SubmitDatasetFormEmail + */ + public function setChecker($checker) + { + $this->checker = $checker; + + return $this; + } + + /** + * Get checker + * + * @return string + */ + public function getChecker() + { + return $this->checker; + } + +} diff --git a/src/AppBundle/Form/Type/ContactFormEmailType.php b/src/AppBundle/Form/Type/ContactFormEmailType.php index 70168ff8..8a7b64c3 100755 --- a/src/AppBundle/Form/Type/ContactFormEmailType.php +++ b/src/AppBundle/Form/Type/ContactFormEmailType.php @@ -4,6 +4,7 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolverInterface; +use EWZ\Bundle\RecaptchaBundle\Form\Type\EWZRecaptchaType; /** * Form builder for Contact Us form @@ -35,32 +36,32 @@ class ContactFormEmailType extends AbstractType { * @param array $options */ public function buildForm(FormBuilderInterface $builder, array $options) { - $builder->add('employee_id', 'text', array( - 'label'=> 'Employee ID', - 'label_attr'=>array('class'=>'no-asterisk'), - )); $builder->add('full_name', 'text', array( - 'label_attr'=>array('class'=>'no-asterisk'))); + 'required' => true, + 'label_attr'=>array('class'=>'asterisk'))); $builder->add('email_address', 'email', array( - 'label_attr'=>array('class'=>'no-asterisk'))); - $builder->add('affiliation', 'choice', array( - 'label'=>'Institutional Affiliation', - 'label_attr'=>array('class'=>'no-asterisk'), - 'choices' => $this->affiliationOptions - )); + 'label_attr'=>array('class'=>'asterisk'))); + $builder->add('school_center', 'text', array( + 'required' => false, + 'label'=> 'School/Center', + 'label_attr'=>array('class'=>'no-asterisk'))); + $builder->add('department', 'text', array( + 'required' => false, + 'label'=> 'Department', + 'label_attr'=>array('class'=>'no-asterisk'))); $builder->add('reason', 'choice', array( 'expanded'=>true, + 'required' => true, 'label_attr'=>array('class'=>'no-asterisk'), 'choices' =>array( - 'Volunteer as a local expert' => 'Volunteer as a local expert', - 'Suggest a new dataset' => 'Suggest a new dataset', - 'Request uploading of dataset' => 'Request uploading of your dataset(s)', - 'General inquiry' => 'General inquiry or comments', + 'General inquiry' => 'General question or comments', + 'Technical problem' => 'Technical problem', ), 'multiple'=>false) ); $builder->add('message_body', 'textarea', array( + 'required' => false, 'attr' => array('rows'=>'5'), 'label_attr'=>array('class'=>'no-asterisk'), 'label'=>'Please provide some details about your question/comment', @@ -69,6 +70,10 @@ public function buildForm(FormBuilderInterface $builder, array $options) { 'required'=>false, 'attr'=>array('class'=>'checker'), 'label_attr'=>array('class'=>'no-asterisk checker'))); + + + $builder->add('recaptcha', EWZRecaptchaType::class); + $builder->add('save','submit',array('label'=>'Send')); } @@ -104,4 +109,3 @@ public function getName() { } } - diff --git a/src/AppBundle/Form/Type/DataLocationType.php b/src/AppBundle/Form/Type/DataLocationType.php index d80a9c9b..3ca46318 100755 --- a/src/AppBundle/Form/Type/DataLocationType.php +++ b/src/AppBundle/Form/Type/DataLocationType.php @@ -46,8 +46,8 @@ public function buildForm(FormBuilderInterface $builder, array $options) { ); $builder->add('data_access_url','text',array( 'label'=>false, - 'required'=>false, - 'attr'=>array('placeholder'=>'Location URL')) + 'required'=>true, + 'attr'=>array('placeholder'=>'* Location URL')) ); $builder->add('accession_number', 'text', array( 'required' => false, diff --git a/src/AppBundle/Form/Type/PersonType.php b/src/AppBundle/Form/Type/PersonType.php index a689220f..4f15d914 100755 --- a/src/AppBundle/Form/Type/PersonType.php +++ b/src/AppBundle/Form/Type/PersonType.php @@ -4,7 +4,6 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolverInterface; -use Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceList; /** * Form builder for Person entry @@ -36,23 +35,13 @@ class PersonType extends AbstractType { */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('full_name'); - $builder->add('works_here', 'checkbox', array( - 'required'=>false, - 'empty_data'=>null, - 'label'=>'Affiliated with our institution?', - )); - $builder->add('kid', 'text', array( - 'required'=>false, - 'label'=>'Username', - )); + $builder->add('kid'); $builder->add('orcid_id', 'text', array( 'required' => false, 'label' => 'ORCID ID', )); - $builder->add('bio_url', 'text', array( - 'required' => false, - 'label' => 'Bio URL' - )); + $builder->add('bio_url'); + $builder->add('is_institution_author', 'checkbox', array('required' => false, 'label' => 'Institution Author')); $builder->add('email'); $builder->add('save', 'submit'); } diff --git a/src/AppBundle/Form/Type/SubmitDatasetFormEmailType.php b/src/AppBundle/Form/Type/SubmitDatasetFormEmailType.php new file mode 100644 index 00000000..07cfc2f7 --- /dev/null +++ b/src/AppBundle/Form/Type/SubmitDatasetFormEmailType.php @@ -0,0 +1,122 @@ +. + */ +class SubmitDatasetFormEmailType extends AbstractType { + + private $affiliationOptions; + + /** + * Build the form + * + * @param FormBuilderInterface + * @param array $options + */ + public function buildForm(FormBuilderInterface $builder, array $options) { + + $builder->add('full_name', 'text', array( + 'required' => true, + 'label_attr'=>array('class'=>'asterisk'))); + + $builder->add('email_address', 'email', array( + 'label_attr'=>array('class'=>'asterisk'))); + + $builder->add('phone_number', 'text', array( + 'required' => false, + 'label' => 'Phone number (if phone call preferred)', + 'label_attr'=>array('class'=>'no-asterisk'))); + + $builder->add('school_center', 'text', array( + 'required' => false, + 'label'=> 'School/Center', + 'label_attr'=>array('class'=>'no-asterisk'))); + + $builder->add('department', 'text', array( + 'required' => false, + 'label'=> 'Department', + 'label_attr'=>array('class'=>'no-asterisk'))); + + $builder->add('dataset_url', 'text', array( + 'required' => false, + 'label'=> 'If your dataset(s) is already publicly available, please provide the URL', + 'label_attr'=>array('class'=>'no-asterisk'))); + + $builder->add('details', 'textarea', array( + 'required' => false, + 'attr' => array('rows'=>'5'), + 'label_attr'=>array('class'=>'no-asterisk'), + 'label'=>'Please tell us some details about your research and your datasets', + )); + + $builder->add('comments', 'textarea', array( + 'required' => false, + 'attr' => array('rows'=>'5'), + 'label_attr'=>array('class'=>'no-asterisk'), + 'label'=>'Any other questions or comments', + )); + + $builder->add('checker', 'text', array( + 'required'=>false, + 'attr'=>array('class'=>'checker'), + 'label_attr'=>array('class'=>'no-asterisk checker'))); + + $builder->add('recaptcha', EWZRecaptchaType::class); + + $builder->add('save','submit',array('label'=>'Send')); + } + + + /** + * Build institutional affiliation options list + * + * @param $affiliationOptions + */ + public function __construct($affiliationOptions) { + $this->affiliationOptions = []; + + foreach ($affiliationOptions as $option) { + $this->affiliationOptions[$option] = $option; + } + } + + + /** + * Set defaults + * + * @param OptionsResolverInterface + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\SubmitDatasetFormEmail' + )); + } + + + public function getName() { + return 'submitDatasetFormEmail'; + } + +} diff --git a/src/AppBundle/Resources/config/routing.yml b/src/AppBundle/Resources/config/routing.yml index 45346656..fe78146f 100755 --- a/src/AppBundle/Resources/config/routing.yml +++ b/src/AppBundle/Resources/config/routing.yml @@ -1,4 +1,4 @@ index: resource: "@AppBundle/Controller/" type: annotation - prefix: / + prefix: / diff --git a/web/css/style.css b/web/css/style.css index cb347bdc..bdde06c0 100755 --- a/web/css/style.css +++ b/web/css/style.css @@ -33,7 +33,7 @@ http://ryanfait.com/ } #page-header { height:100px; - background: black; + background: rgb(28, 41, 87); position:relative; padding:1em; } diff --git a/web/img/institution/HSLS-logo-only.png b/web/img/institution/HSLS-logo-only.png new file mode 100644 index 00000000..797611eb Binary files /dev/null and b/web/img/institution/HSLS-logo-only.png differ diff --git a/web/img/institution/pitt-hsls-logo-white.png b/web/img/institution/pitt-hsls-logo-white.png new file mode 100644 index 00000000..41c74b4d Binary files /dev/null and b/web/img/institution/pitt-hsls-logo-white.png differ diff --git a/web/img/institution/pitt-hsls-logo.svg b/web/img/institution/pitt-hsls-logo.svg new file mode 100644 index 00000000..2eea35a4 --- /dev/null +++ b/web/img/institution/pitt-hsls-logo.svg @@ -0,0 +1 @@ +Asset 1 \ No newline at end of file diff --git a/web/img/institution/pitt-logo-gold.png b/web/img/institution/pitt-logo-gold.png new file mode 100644 index 00000000..cbeb0a26 Binary files /dev/null and b/web/img/institution/pitt-logo-gold.png differ diff --git a/web/img/logo.png b/web/img/logo.png new file mode 100644 index 00000000..b8c7accd Binary files /dev/null and b/web/img/logo.png differ diff --git a/web/js/add_form.js b/web/js/add_form.js index f305c2fa..3b4d1d5b 100755 --- a/web/js/add_form.js +++ b/web/js/add_form.js @@ -64,6 +64,7 @@ jQuery(function($) { var fieldName = $(this).attr('data-fieldname'); e.preventDefault(); var url = $(this).attr('href'); + console.log(url); $.get(url, function(data) { $("#addEntityFormModalContent").html(data); $("#addEntityFormModal").modal({show:true});