-
- {% if objects_journal.object_list %}
-
-
{% trans 'Fields: ISSN(s), title, abbreviated title and acronym' %}
- {% endif %}
-
-
+
+
{% simple_pagination objects_journal %}
@@ -53,6 +41,14 @@
+ {% empty %}
+
+
+
+ {% trans "No Journals found" %}
+
+ |
+
{% endfor %}
diff --git a/scielomanager/editorialmanager/views.py b/scielomanager/editorialmanager/views.py
index 9c902378..baeeb965 100644
--- a/scielomanager/editorialmanager/views.py
+++ b/scielomanager/editorialmanager/views.py
@@ -9,7 +9,7 @@
from django.utils.translation import ugettext as _
from django.template.context import RequestContext
from django.forms.models import inlineformset_factory
-from django.contrib.auth.decorators import permission_required
+from django.contrib.auth.decorators import login_required, permission_required, user_passes_test
from journalmanager.models import Journal, JournalMission, Issue
from journalmanager.forms import RestrictedJournalForm, JournalMissionForm
@@ -19,16 +19,28 @@
from . import models
-@permission_required('journalmanager.list_editor_journal', login_url=settings.AUTHZ_REDIRECT_URL)
+def _user_has_access(user):
+ return user.is_superuser or user.get_profile().is_editor or user.get_profile().is_librarian
+
+def _get_journals_by_user_access(user):
+ user_profile = user.get_profile()
+ if user_profile.is_editor:
+ journals = Journal.userobjects.active().filter(editor=user)
+ elif user_profile.is_librarian or user.is_superuser:
+ journals = Journal.userobjects.active()
+ else:
+ journals = []
+ return journals
+
+def _get_journal_or_404_by_user_access(user, journal_id):
+ journals = _get_journals_by_user_access(user)
+ return get_object_or_404(journals, id=journal_id)
+
+@login_required
+@user_passes_test(_user_has_access, login_url=settings.AUTHZ_REDIRECT_URL)
def index(request):
- filters = {}
- if request.GET.get('q'):
- filters['title__icontains'] = request.GET.get('q')
- if request.GET.get('letter'):
- filters['title__istartswith'] = request.GET.get('letter')
- if request.GET.get('jstatus'):
- filters['membership__status'] = request.GET.get('jstatus')
- journals = Journal.userobjects.active().filter(**filters)
+ journals = _get_journals_by_user_access(request.user)
+
objects = get_paginated(journals, request.GET.get('page', 1))
context = {
'objects_journal': objects,
@@ -36,23 +48,28 @@ def index(request):
return render_to_response('journal/journal_list.html', context, context_instance=RequestContext(request))
-@permission_required('journalmanager.list_editor_journal', login_url=settings.AUTHZ_REDIRECT_URL)
+@login_required
+@user_passes_test(_user_has_access, login_url=settings.AUTHZ_REDIRECT_URL)
def journal_detail(request, journal_id):
- journal = get_object_or_404(Journal.userobjects.active(), id=journal_id)
+ journal = _get_journal_or_404_by_user_access(request.user, journal_id)
context = {
'journal': journal,
}
return render_to_response('journal/journal_detail.html', context, context_instance=RequestContext(request))
-@permission_required('journalmanager.list_editor_journal', login_url=settings.AUTHZ_REDIRECT_URL)
+@login_required
+@user_passes_test(_user_has_access, login_url=settings.AUTHZ_REDIRECT_URL)
def edit_journal(request, journal_id):
- journal = get_object_or_404(Journal.userobjects.active(), id=journal_id)
+ user_profile = request.user.get_profile()
+ if request.user.is_superuser or user_profile.is_librarian:
+ # redirect to full edit view:
+ return HttpResponseRedirect(reverse('journal.edit', args=[journal_id, ]))
+
+ journal = _get_journal_or_404_by_user_access(request.user, journal_id)
if journal_id is None:
journal = Journal()
- else:
- journal = get_object_or_404(Journal, id=journal_id)
JournalMissionFormSet = inlineformset_factory(Journal, JournalMission, form=JournalMissionForm, extra=1, can_delete=True)
@@ -80,21 +97,19 @@ def edit_journal(request, journal_id):
}, context_instance=RequestContext(request))
-@permission_required('journalmanager.list_editor_journal', login_url=settings.AUTHZ_REDIRECT_URL)
+@login_required
+@user_passes_test(_user_has_access, login_url=settings.AUTHZ_REDIRECT_URL)
def board(request, journal_id):
- journal = get_object_or_404(Journal.userobjects.active(), id=journal_id)
+ journal = _get_journal_or_404_by_user_access(request.user, journal_id)
issues = journal.issue_set.all().order_by('-publication_year', '-volume', '-number')
- latest_issue = issues[0]
- #latest_issue_boards = latest_issue.editorialboard_set.all()
context = {
'journal': journal,
'issues': issues,
- #'latest_issue_boards': latest_issue_boards,
}
- return render_to_response('board/board_list.html', context,
- context_instance=RequestContext(request))
+ return render_to_response('board/board_list.html', context, context_instance=RequestContext(request))
+@login_required
@permission_required('editorialmanager.change_editorialmember', login_url=settings.AUTHZ_REDIRECT_URL)
def edit_board_member(request, journal_id, member_id):
if request.is_ajax():
@@ -133,6 +148,7 @@ def edit_board_member(request, journal_id, member_id):
return render_to_response(template_name, context, context_instance=RequestContext(request))
+@login_required
@permission_required('editorialmanager.add_editorialmember', login_url=settings.AUTHZ_REDIRECT_URL)
def add_board_member(request, journal_id, issue_id):
if request.is_ajax():
diff --git a/scielomanager/journalmanager/models.py b/scielomanager/journalmanager/models.py
index 5c97ba9d..88676466 100644
--- a/scielomanager/journalmanager/models.py
+++ b/scielomanager/journalmanager/models.py
@@ -309,6 +309,12 @@ class UserProfile(caching.base.CachingMixin, models.Model):
def is_editor(self):
return self.user.groups.filter(name__iexact='Editors').exists()
+ @property
+ def is_librarian(self):
+ return self.user.groups.filter(name__iexact='Librarian').exists()
+
+
+
@property
def gravatar_id(self):
return hashlib.md5(self.user.email.lower().strip()).hexdigest()
diff --git a/scielomanager/journalmanager/templates/journalmanager/inctag_journaldash_toolbar.html b/scielomanager/journalmanager/templates/journalmanager/inctag_journaldash_toolbar.html
index d8db9149..3a510587 100644
--- a/scielomanager/journalmanager/templates/journalmanager/inctag_journaldash_toolbar.html
+++ b/scielomanager/journalmanager/templates/journalmanager/inctag_journaldash_toolbar.html
@@ -34,6 +34,9 @@
{% trans 'Editor' %}
{% endif %}
+
+ {% trans 'Board' %}
+
{% endflag %}
diff --git a/scielomanager/journalmanager/templates/journalmanager/journal_dash.html b/scielomanager/journalmanager/templates/journalmanager/journal_dash.html
index 61dfdb69..78f8ba71 100644
--- a/scielomanager/journalmanager/templates/journalmanager/journal_dash.html
+++ b/scielomanager/journalmanager/templates/journalmanager/journal_dash.html
@@ -6,11 +6,11 @@
{% block page_title %}{% trans "Journals" %}{% endblock %}
{% block content %}
-{% journaldash_toolbar 'dashboard' journal user %}
-
{% trans 'Publisher' %}: {{ journal.publisher_name|default:"n.a." }}
-
{% trans 'Print ISSN' %}: {{ journal.print_issn|default:"n.a." }}
-
{% trans 'Electronic ISSN' %}: {{ journal.eletronic_issn|default:"n.a." }}
-
{% trans 'Editor name' %}: {{ journal.editor_name|default:"n.a." }}
-
{% trans 'Editor e-mail' %}: {{ journal.editor_email|default:"n.a." }}
-
{% trans 'Managed by the collections' %}: {{ journal.collections.all|join:', ' }}
+ {% journaldash_toolbar 'dashboard' journal user %}
+
{% trans 'Publisher' %}: {{ journal.publisher_name|default:"n.a." }}
+
{% trans 'Print ISSN' %}: {{ journal.print_issn|default:"n.a." }}
+
{% trans 'Electronic ISSN' %}: {{ journal.eletronic_issn|default:"n.a." }}
+
{% trans 'Editor name' %}: {{ journal.editor_name|default:"n.a." }}
+
{% trans 'Editor e-mail' %}: {{ journal.editor_email|default:"n.a." }}
+
{% trans 'Managed by the collections' %}: {{ journal.collections.all|join:', ' }}
{% endblock %}
diff --git a/scielomanager/scielomanager/static/css/style.css b/scielomanager/scielomanager/static/css/style.css
index b8492e0a..22492fd9 100644
--- a/scielomanager/scielomanager/static/css/style.css
+++ b/scielomanager/scielomanager/static/css/style.css
@@ -499,44 +499,6 @@ table._listings h4 {
border: 0px;
}
-#custom-search-form {
- margin:0;
- margin-top: 5px;
- padding: 0;
-}
-
-#custom-search-form .search-query {
- padding-right: 3px;
- padding-right: 4px \9;
- padding-left: 3px;
- padding-left: 4px \9;
- /* IE7-8 doesn't have border-radius, so don't indent the padding */
-
- margin-bottom: 0;
- -webkit-border-radius: 3px;
- -moz-border-radius: 3px;
- border-radius: 3px;
- -webkit-transition: width 0.2s ease-in-out;
- -moz-transition:width 0.2s ease-in-out;
- -o-transition: width 0.2s ease-in-out;
- transition: width 0.2s ease-in-out;
-}
-
-#custom-search-form button {
- border: 0;
- background: none;
- /** belows styles are working good */
- padding: 2px 5px;
- margin-top: 2px;
- position: relative;
- left: -28px;
- /* IE7-8 doesn't have border-radius, so don't indent the padding */
- margin-bottom: 0;
- -webkit-border-radius: 3px;
- -moz-border-radius: 3px;
- border-radius: 3px;
-}
-
.search-query:focus + button {
z-index: 3;
}
@@ -563,3 +525,15 @@ table._listings h4 {
width: 80%;
margin-left:-40%; /* width/2) */
}
+
+/* board members list (accordions) */
+.accordion-board-members li>div {
+ padding-left: 10px;
+ padding-right: 10px;
+}
+.accordion-board-members li div.btn-group .btn {
+ margin-top: 25px;
+}
+.accordion-board-members li div:hover {
+ background-color: #f5f5f5;
+}
diff --git a/scielomanager/scielomanager/templates/base_lv1.html b/scielomanager/scielomanager/templates/base_lv1.html
index 334fb3dd..c065e0f4 100644
--- a/scielomanager/scielomanager/templates/base_lv1.html
+++ b/scielomanager/scielomanager/templates/base_lv1.html
@@ -21,12 +21,9 @@