parent
67c6c39002
commit
0dde7786cd
|
@ -2,6 +2,7 @@ import os
|
|||
|
||||
from django import template
|
||||
from django.conf import settings
|
||||
from django.utils.html import mark_safe
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
@ -15,3 +16,24 @@ def show_submission_files(context, submission):
|
|||
result.append({'name': '[%s version ]' % ext[1:].capitalize(),
|
||||
'url': '%s%s-%s%s' % (settings.STAGING_URL, submission.filename, submission.revision, ext)})
|
||||
return {'files': result}
|
||||
|
||||
def show_two_pages(context, two_pages, validation):
|
||||
result
|
||||
|
||||
|
||||
@register.filter
|
||||
def two_pages_decorated_with_validation(value, validation):
|
||||
pages = value.first_two_pages
|
||||
if not 'revision' in validation.warnings.keys():
|
||||
return mark_safe('<pre class="twopages" style="display: none;">%s</pre>' % pages)
|
||||
result = '<pre class="twopages" style="display: none;">\n'
|
||||
for line in pages.split('\n'):
|
||||
if line.find('%s-%s' % (value.filename, value.revision)) > -1:
|
||||
result += '</pre><pre class="twopages" style="display: none; background: red;">'
|
||||
result += line
|
||||
result += '\n'
|
||||
result += '</pre><pre class="twopages" style="display: none;">\n'
|
||||
else:
|
||||
result += line
|
||||
result += '\n'
|
||||
return mark_safe(result)
|
||||
|
|
|
@ -145,8 +145,11 @@ class DraftValidation(object):
|
|||
expected = 0
|
||||
if existing_revisions:
|
||||
expected = max(existing_revisions) + 1
|
||||
if int(revision) != expected:
|
||||
self.add_warning('revision', 'Invalid Version Number (Version %02d is expected)' % expected)
|
||||
try:
|
||||
if int(revision) != expected:
|
||||
self.add_warning('revision', 'Invalid Version Number (Version %02d is expected)' % expected)
|
||||
except ValueError:
|
||||
self.add_warning('revision', 'Revision not found')
|
||||
|
||||
def validate_authors(self):
|
||||
if not self.authors:
|
||||
|
|
|
@ -16,6 +16,7 @@ table.metadata-table tr { vertical-align: top; }
|
|||
table.metadata-table tr.warning td, table.metadata-table tr.warning th { background-color: #ffaaaa; }
|
||||
table.metadata-table div.warn_message { color: red; }
|
||||
table.metadata-table ul.errorlist { color: red; padding: 0px; margin: 0px; list-style-type: none; }
|
||||
pre.twopages { margin: 0px; }
|
||||
{% endblock morecss %}
|
||||
|
||||
{% block pagehead %}
|
||||
|
@ -100,7 +101,7 @@ Your draft has NOT been verified to meet IDNITS requirements.
|
|||
<div class="bd">
|
||||
<div id="stream_dialog_body" style="padding: 0em 5em; height: 400px; overflow: auto;">
|
||||
<pre class="idnits_message" style="display: none;">{{ detail.idnits_message }}</pre>
|
||||
<pre class="twopages" style="display: none;">{{ detail.first_two_pages }}</pre>
|
||||
{{ detail|two_pages_decorated_with_validation:validation }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -136,7 +137,7 @@ returned to the submitter.
|
|||
<tr><th>Document</th><td>{{ detail.filename }} <a class="twopages_trigger" href="#">[View first two pages]</a>
|
||||
{% show_submission_files detail %}
|
||||
</td></tr>
|
||||
<tr{% if validation.warnings.revision %} class="warning"{% endif %}><th>Revision</th><td>{{ detail.revision }}<div class="warn_message">{{ validation.warnings.revision }}</div></td></tr>
|
||||
<tr{% if validation.warnings.revision %} class="warning"{% endif %}><th>Revision</th><td>{{ detail.revision }}<div class="warn_message">{{ validation.warnings.revision }}{% if validation.warnings.revision %}<br /><a class="twopages_trigger" href="#">[View error]</a>{% endif %}</div></td></tr>
|
||||
<tr><th>Submission date</th><td>{{ detail.submission_date }}</td></tr>
|
||||
<tr><th>Title</th><td>{{ detail.id_document_name }}</td></tr>
|
||||
<tr{% if validation.warnings.group %} class="warning"{% endif %}><th>WG</th><td>{{ validation.wg|default:"Individual Submission" }}<div class="warn_message">{{ validation.warnings.group }}</div></td></tr>
|
||||
|
|
Loading…
Reference in a new issue