Skip to content

Commit

Permalink
Merge pull request #811 from upconsulting/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
jdamerow committed Feb 22, 2024
2 parents 977d7fe + 068fa6a commit 167d93d
Show file tree
Hide file tree
Showing 29 changed files with 1,821 additions and 451 deletions.
14 changes: 10 additions & 4 deletions README.md
Expand Up @@ -9,11 +9,17 @@ information, see ``LICENSE.md`` in this repository.

## Deployment

IsisCB Explore can be run as a WSGI application, e.g. using Gunicorn behind
NginX, or in Apache using mod_wsgi.
There is a Docker Compose setup available to run the Explore system for development. To start the Docker containers run the following command from the root directory of this project.

The main application should be run from ``isiscb.wsgi``.
`docker-compose -f docker-compose-explore.yml up`

Worker processes should be run from ``isiscb.celery``.
If you have existing database, you will first have to import the existing data into the Docker container PostgreSQL database before running the Explore system's container.

# Contributors

The [Explore system](https://isiscb.org/) is being developed by [A Place Called Up Consulting](http://aplacecalledup.com/) for Stephen P. Weldon, University of Oklahoma. The following people are currently or have been contributing to the development:

- Julia Damerow
- Erick B. Peirson
- Taylor Quinn
- Paul Vieth
1 change: 1 addition & 0 deletions isiscb/curation/templates/curation/base.html
Expand Up @@ -20,6 +20,7 @@
<script src="{% static "curation/js/jquery.multi-select.js" %}" type="text/javascript"></script>
<script src="{% static "curation/js/jquery.bootcomplete.js" %}" type="text/javascript"></script>
<script src="{% static "isisdata/bootstrap-3.3.5/js/bootstrap.min.js" %}" type="text/javascript"></script>
<script src="{% static "isisdata/js/notify.min.js" %}"></script>
<script>
// Django needs CSRF for AJAX POST requests.
function getCookie(name) {
Expand Down
11 changes: 10 additions & 1 deletion isiscb/curation/templates/curation/citation_list_view.html
Expand Up @@ -34,7 +34,12 @@
form.submit();
e.preventDefault();
});

$('#generate_newsletter_html').click(function(e) {
form.attr('action', '{% url "curation:generate_newsletter_html" %}');
form.attr('target', '_blank');
form.submit();
e.preventDefault();
});
$('.queryset-checkbox').change(function() {
toggleLinkRecordsBtn();
});
Expand Down Expand Up @@ -113,6 +118,10 @@
<i class="fa fa-link" aria-hidden="true"></i>
Link Records
</a>
<a class="btn btn-primary btn-xs" id="generate_newsletter_html">
<i class="far fa-file-code"></i>
Generate Newsletter HTML
</a>

<input type="hidden" value="{{ filter_params }}" name="filters" />
<span class="pull-right" style="margin-right: 10px;">Count of total records: {{ result_count }}</span>
Expand Down
14 changes: 8 additions & 6 deletions isiscb/curation/templates/curation/citations_bulk_status.html
Expand Up @@ -8,9 +8,6 @@

{% for task in tasks %}
<div class="row">
<div class="col-xs-12">
<p><br><em>{{ task.label }}</em></p>
</div>
<div class="col-xs-4">
<p>Field: {{ task.value.0 }}</p>
<p>Value: {{ task.value.1 }}</p>
Expand All @@ -32,9 +29,11 @@
for support, or consult the server logs.
</p>
{% else %}
{% block extrahead %}
<meta http-equiv="refresh" content="3"/>
{% endblock %}
<script>
setTimeout(function(){
window.location.reload(1);
}, 3000);
</script>

<p class="text-warning">
{% if task.max_value == 0 %}
Expand All @@ -51,6 +50,9 @@
</p>
{% endif %}
</div>
<div class="col-xs-12">
<p><br><em>{{ task.label }}</em></p>
</div>
</div>
{% endfor %}

Expand Down
13 changes: 8 additions & 5 deletions isiscb/curation/templates/curation/export_status.html
Expand Up @@ -16,8 +16,6 @@
{% endif %}
</div>

<p><br><em>{{ task.label }}</em></p>

{% if task.state == 'SUCCESS' %}
<p class="text-warning">
{% if exported_type == 'CITATION' or exported_type == 'AUTHORITY' %}
Expand All @@ -35,9 +33,11 @@
for support, or consult the server logs.
</p>
{% else %}
{% block extrahead %}
<meta http-equiv="refresh" content="3"/>
{% endblock %}
<script>
setTimeout(function(){
window.location.reload(1);
}, 3000);
</script>

<p class="text-warning">
{% if task.max_value == 0 %}
Expand Down Expand Up @@ -70,4 +70,7 @@
{% endif %}
</div>

<p><br><em>{{ task.label }}</em></p>


{% endblock %}
@@ -0,0 +1,15 @@
{% load general_tags %}

<div class="panel panel-default facet-box">
<div class="panel-heading-relation panel-heading">
<strong>{{panel_title}}</strong>
</div>
<div class="panel-body">
{% for facet in facets|slice:"6" %}
{% if facet.authority %}
<a class="tinos-regular" title="Go to page for {{facet.authority.name}}" href="{{ facet.authority|get_uri }}">{{facet.authority.name}}</a><span> ({{facet.count}})</span>
<br>
{% endif %}
{% endfor %}
</div>
</div>
221 changes: 221 additions & 0 deletions isiscb/curation/templates/curation/generate_newsletter_html.html
@@ -0,0 +1,221 @@
{% extends "curation/base.html" %}
{% load static %}
{% load addcss %}
{% load general_tags %}
{% load app_filters %}

{% block content %}
<div class="panel panel-default">
<div class="panel-heading clearfix">
<div class="btn-group pull-right">
<a href="#" class="btn btn-default" onclick="copyListHTMLSnippet()">Copy List HTML</a>
<a href="#" class="btn btn-default" onclick="copyBoxesHTMLSnippet()">Copy Boxes HTML</a>
</div>
<h1 class="panel-title">Preview of HTML Snippet Components</h1>
</div>
<div class="panel-body">
<div class="col-sm-6">
{% if page_results.has_previous or page_results.has_next %}
<nav class="hidden-print">
<ul class="pagination">
<li class="disabled"><a>Page:</a></li>
{% if page_results.has_previous %}
<li>
{% with pagenr=page_results.previous_page_number|stringformat:"s" %}
{% with ppage="page_citation:"|add:pagenr %}
<a href="{{ request.get_full_path|set_bookshelf_page:ppage }}&search={{search_key}}" aria-label="Previous">
<span aria-hidden="true">&laquo;</span>
</a>
{% endwith %}
{% endwith %}
</li>
{% else %}
<li class="disabled">
<span aria-hidden="true">&laquo;</span>
</li>
{% endif %}

{% if page_results.has_previous or page_results.has_next %}
{% for p in page_results.paginator.page_range %}
{% with pagenr=forloop.counter|stringformat:"s" %}
{% with ppage='page_citation:'|add:pagenr %}
{% with page_results.paginator.page_range|last as last %}
{% with page_results.paginator.page_range|first as first %}
{% if page_results.number >= 4 and p == first %}
<li {% if page_results.number == first %} class="active" {% endif %}><a href="{{ request.get_full_path|set_bookshelf_page:ppage}}&search={{search_key}}">{{ first }}</a></li>
<li class="disabled"><span>...</span></li>
{% elif page_results.number <= p|add:"2" and page_results.number >= p|add:"-4" %}
<li {% if page_results.number == p %} class="active" {% endif %}><a href="{{ request.get_full_path|set_bookshelf_page:ppage}}&search={{search_key}}">{{ p }}</a></li>
{% elif p == last %}
<li class="disabled"><span>...</span></li>
<li {% if page_results.number == last %} class="active" {% endif %}><a href="{{ request.get_full_path|set_bookshelf_page:ppage}}&search={{search_key}}">{{ last }}</a></li>
{% endif %}
{% endwith %}
{% endwith %}
{% endwith %}
{% endwith %}
{% endfor %}
{% endif %}

{% if page_results.has_next %}
<li>
{% with pagenr=page_results.next_page_number|stringformat:"s" %}
{% with ppage='page_citation:'|add:pagenr %}
<a href="{{ request.get_full_path|set_bookshelf_page:ppage}}&search={{search_key}}" aria-label="Next">
<span aria-hidden="true">&raquo;</span>
</a>
{% endwith %}
{% endwith %}
</li>
{% else %}
<li class="disabled">
<span aria-hidden="true">&raquo;</span>
</li>
{% endif %}
</ul>
</nav>
{% endif %}
<div id="listHTMLSnippetContent">
{% for citation in page_results %}
<p class="tinos-regular" style="padding-left: 25px; text-indent: -25px; font-size: 18px;"><a href="{{ citation|get_uri:citation.owning_tenant }}">{{ citation.id|get_print_formatted_citation }}</a></p>
{% endfor %}
</div>
<hr>
{% if page_results.has_previous or page_results.has_next %}
<nav class="hidden-print">
<ul class="pagination">
<li class="disabled"><a>Page:</a></li>
{% if page_results.has_previous %}
<li>
{% with pagenr=page_results.previous_page_number|stringformat:"s" %}
{% with ppage="page_citation:"|add:pagenr %}
<a href="{{ request.get_full_path|set_bookshelf_page:ppage}}&search={{search_key}}" aria-label="Previous">
<span aria-hidden="true">&laquo;</span>
</a>
{% endwith %}
{% endwith %}
</li>
{% else %}
<li class="disabled">
<span aria-hidden="true">&laquo;</span>
</li>
{% endif %}

{% if page_results.has_previous or page_results.has_next %}
{% for p in page_results.paginator.page_range %}
{% with pagenr=forloop.counter|stringformat:"s" %}
{% with ppage='page_citation:'|add:pagenr %}
{% with page_results.paginator.page_range|last as last %}
{% with page_results.paginator.page_range|first as first %}
{% if page_results.number >= 4 and p == first %}
<li {% if page_results.number == first %} class="active" {% endif %}><a href="{{ request.get_full_path|set_bookshelf_page:ppage}}&search={{search_key}}">{{ first }}</a></li>
<li class="disabled"><span>...</span></li>
{% elif page_results.number <= p|add:"2" and page_results.number >= p|add:"-4" %}
<li {% if page_results.number == p %} class="active" {% endif %}><a href="{{ request.get_full_path|set_bookshelf_page:ppage}}&search={{search_key}}">{{ p }}</a></li>
{% elif p == last %}
<li class="disabled"><span>...</span></li>
<li {% if page_results.number == last %} class="active" {% endif %}><a href="{{ request.get_full_path|set_bookshelf_page:ppage}}&search={{search_key}}">{{ last }}</a></li>
{% endif %}
{% endwith %}
{% endwith %}
{% endwith %}
{% endwith %}
{% endfor %}
{% endif %}

{% if page_results.has_next %}
<li>
{% with pagenr=page_results.next_page_number|stringformat:"s" %}
{% with ppage='page_citation:'|add:pagenr %}
<a href="{{ request.get_full_path|set_bookshelf_page:ppage }}" aria-label="Next">
<span aria-hidden="true">&raquo;</span>
</a>
{% endwith %}
{% endwith %}
</li>
{% else %}
<li class="disabled">
<span aria-hidden="true">&raquo;</span>
</li>
{% endif %}
</ul>
</nav>
{% endif %}
<hr>
<textarea id="listHTMLSnippetContainer" style="display: block; width: 100%; height: 500px"></textarea>
</div>
<div class="col-sm-6">
<div class="row" id="boxesHTMLSnippetContent">
<div class="col-sm-12 col-md-6" style="padding-left: 0;">
{% if facets.PR %}
{% include 'curation/fragment_citation_facet_boxes.html' with facets=facets.PR panel_title="Authors & Contributors" %}
{% endif %}

{% if facets.PH %}
{% include 'curation/fragment_citation_facet_boxes.html' with facets=facets.PH panel_title="Journals" %}
{% endif %}

{% if facets.IH %}
{% include 'curation/fragment_citation_facet_boxes.html' with facets=facets.IH panel_title="Publishers" %}
{% endif %}
</div>
<div class="col-sm-12 col-md-6" style="padding-left: 0;">
{% if facets.CO %}
{% include 'curation/fragment_citation_facet_boxes.html' with facets=facets.CO panel_title="Concepts" %}
{% endif %}

{% if facets.PE %}
{% include 'curation/fragment_citation_facet_boxes.html' with facets=facets.PE panel_title="People" %}
{% endif %}

{% if facets.TI %}
{% include 'curation/fragment_citation_facet_boxes.html' with facets=facets.TI panel_title="Time Periods" %}
{% endif %}

{% if facets.GE %}
{% include 'curation/fragment_citation_facet_boxes.html' with facets=facets.PR panel_title="Places" %}
{% endif %}

{% if facets.IN %}
{% include 'curation/fragment_citation_facet_boxes.html' with facets=facets.IN panel_title="Institutions" %}
{% endif %}
</div>
</div>
<hr>
<textarea id="boxesHTMLSnippetContainer" style="display: block; width: 100%; height: 500px"></textarea>
</div>
</div>
<div class="panel-footer clearfix">
<div class="btn-group pull-right">
<a href="#" class="btn btn-default" onclick="copyListHTMLSnippet()">Copy List HTML</a>
<a href="#" class="btn btn-default" onclick="copyBoxesHTMLSnippet()">Copy Boxes HTML</a>
</div>
</div>
</div>



<script>
let listHTMLSnippet = document.getElementById("listHTMLSnippetContent").outerHTML;
let listHTMLSnippetContainer = document.getElementById("listHTMLSnippetContainer");
listHTMLSnippetContainer.value += listHTMLSnippet;

let boxesHTMLSnippet = document.getElementById("boxesHTMLSnippetContent").outerHTML;
let boxesHTMLSnippetContainer = document.getElementById("boxesHTMLSnippetContainer");
boxesHTMLSnippetContainer.value += boxesHTMLSnippet;

function copyListHTMLSnippet() {
let listCopyTextarea = document.querySelector('#listHTMLSnippetContainer');
listCopyTextarea.select();
document.execCommand("copy");
$.notify("This bibliography has been copied to your clipboard.", "success");
}

function copyBoxesHTMLSnippet() {
let boxesCopyTextarea = document.querySelector('#boxesHTMLSnippetContainer');
boxesCopyTextarea.select();
document.execCommand("copy");
$.notify("These boxes has been copied to your clipboard.", "success");
}
</script>
{% endblock %}
22 changes: 21 additions & 1 deletion isiscb/curation/templatetags/general_tags.py
Expand Up @@ -2,6 +2,8 @@
from django import template
from isisdata.models import *
from dateutil.relativedelta import relativedelta
from isisdata.templatetags.app_filters import *
from curation.utils import *

register = template.Library()

Expand Down Expand Up @@ -63,4 +65,22 @@ def is_external_tenant(record, tenant):
def get_tenant(id):
if id:
return Tenant.objects.get(pk=id)
return ""
return ""

@register.filter
def get_print_formatted_citation(id):
return get_printlike_citation(id)

@register.filter
def set_bookshelf_page(link, sort_str):
"""
This method figures out what page number each paginator button should link to given the current
page number. Key is the url code for setting the page: 'page_citation'. 'sort_str' contains
this key and the page number in question.
"""
[key, page_number] = sort_str.split(":")
if key in link:
return re.sub(key + "=[0-9]+", key + "=" + str(page_number), link)
else:
new_link = link + "?" if "?" not in link else link + "&"
return new_link + key + "=" + str(page_number)

0 comments on commit 167d93d

Please sign in to comment.