Finished converting project to the new subtemplate rendering
This commit is contained in:
@@ -10,28 +10,26 @@
|
||||
{% include subtemplate %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
{% for subtemplate in sidebar_subtemplates_dict %}
|
||||
{% with subtemplate.title as title %}
|
||||
{% with subtemplate.object_list as object_list %}
|
||||
{% with subtemplate.extra_columns as extra_columns %}
|
||||
{% with subtemplate.hide_object as hide_object %}
|
||||
{% with subtemplate.main_object as main_object %}
|
||||
{% with subtemplate.hide_link as hide_link %}
|
||||
{% with subtemplate.hide_header as hide_header %}
|
||||
{% with subtemplate.hide_columns as hide_columns %}
|
||||
{% with "true" as side_bar %}
|
||||
{% include subtemplate.name %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
|
||||
{% for subtemplate in sidebar_subtemplates_list %}
|
||||
{% with "true" as side_bar %}
|
||||
{% if subtemplate.form %}
|
||||
{% render_subtemplate subtemplate.name subtemplate.context as rendered_subtemplate %}
|
||||
{% with "true" as read_only %}
|
||||
<div class="generic_subform">
|
||||
{{ rendered_subtemplate }}
|
||||
</div>
|
||||
{% endwith %}
|
||||
{% else %}
|
||||
{% render_subtemplate subtemplate.name subtemplate.context as rendered_subtemplate %}
|
||||
{{ rendered_subtemplate }}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if subtemplate.grid_clear or not subtemplate.grid %}
|
||||
<div class=""></div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
{% block stylesheets %}
|
||||
@@ -45,83 +43,38 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container_12">
|
||||
<div class="">
|
||||
|
||||
{% if form %}
|
||||
{% with "true" as read_only %}
|
||||
<div class="grid_{{ grid|default:11 }}">
|
||||
<div class="">
|
||||
<div class="generic_subform">
|
||||
{% include "generic_form_subtemplate.html" %}
|
||||
</div>
|
||||
</div>
|
||||
{% if grid_clear or not grid %}
|
||||
<div class="clear"></div>
|
||||
<div class=""></div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
|
||||
{% for subtemplate in subtemplates %}
|
||||
{% include subtemplate %}
|
||||
{% endfor %}
|
||||
|
||||
{% for form in form_list %}
|
||||
{% with form.submit_method as submit_method %}
|
||||
{% with form.striptags as striptags %}
|
||||
{% with form.title as title %}
|
||||
{% with form.object as object %}
|
||||
{% with form.object_name as object_name %}
|
||||
{% with form.form_action as form_action %}
|
||||
{% with "true" as read_only %}
|
||||
<div class="grid_{{ form.grid|default:11 }}">
|
||||
{% with form.form as form %}
|
||||
<div class="generic_subform">
|
||||
{% include "generic_form_subtemplate.html" %}
|
||||
</div>
|
||||
{% endwith %}
|
||||
</div>
|
||||
{% if form.grid_clear or not form.grid %}
|
||||
<div class="clear"></div>
|
||||
{% endif %}
|
||||
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
|
||||
{% for subtemplate in subtemplates_list %}
|
||||
|
||||
<div class="grid_{{ subtemplate.grid|default:11 }}">
|
||||
|
||||
{% if subtemplate.form %}
|
||||
{% with subtemplate.submit_method as submit_method %}
|
||||
{% with subtemplate.striptags as striptags %}
|
||||
{% with subtemplate.object as object %}
|
||||
{% with subtemplate.object_name as object_name %}
|
||||
{% with subtemplate.form_action as form_action %}
|
||||
{% with "true" as read_only %}
|
||||
{% with subtemplate.form as form %}
|
||||
<div class="generic_subform">
|
||||
{% include subtemplate.name %}
|
||||
</div>
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% else %}
|
||||
{% render_subtemplate subtemplate.name subtemplate.context as rendered_subtemplate %}
|
||||
{{ rendered_subtemplate }}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if subtemplate.grid_clear or not subtemplate.grid %}
|
||||
<div class="clear"></div>
|
||||
<div class="">
|
||||
{% if subtemplate.form %}
|
||||
{% render_subtemplate subtemplate.name subtemplate.context as rendered_subtemplate %}
|
||||
{% with "true" as read_only %}
|
||||
<div class="generic_subform">
|
||||
{{ rendered_subtemplate }}
|
||||
</div>
|
||||
{% endwith %}
|
||||
{% else %}
|
||||
{% render_subtemplate subtemplate.name subtemplate.context as rendered_subtemplate %}
|
||||
{{ rendered_subtemplate }}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if subtemplate.grid_clear or not subtemplate.grid %}
|
||||
<div class=""></div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -19,49 +19,5 @@
|
||||
</div><!--end generic_subform-->
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
|
||||
{% for subtemplate in subtemplates %}
|
||||
{% include subtemplate %}
|
||||
{% endfor %}
|
||||
|
||||
{% for form in form_list %}
|
||||
{% with form.submit_method as submit_method %}
|
||||
{% with form.striptags as striptags %}
|
||||
{% with form.title as title %}
|
||||
{% with form.object as object %}
|
||||
{% with form.object_name as object_name %}
|
||||
{% with form.form_action as form_action %}
|
||||
{% with "true" as read_only %}
|
||||
{% with form.form as form %}
|
||||
{% include "generic_form_subtemplate.html" %}
|
||||
{% endwith %}
|
||||
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
{% for subtemplate in subtemplates_dict %}
|
||||
{% with subtemplate.title as title %}
|
||||
{% with subtemplate.object_list as object_list %}
|
||||
{% with subtemplate.extra_columns as extra_columns %}
|
||||
{% with subtemplate.hide_object as hide_object %}
|
||||
{% with subtemplate.main_object as main_object %}
|
||||
{% with subtemplate.hide_link as hide_link %}
|
||||
{% with subtemplate.hide_header as hide_header %}
|
||||
{% include subtemplate.name %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
@@ -1,116 +1,51 @@
|
||||
{% extends "base.html" %}
|
||||
{% load subtemplates_tags %}
|
||||
|
||||
{% block title %} :: {% with "true" as striptags %}{% include "calculate_form_title.html" %}{% endwith %}{% endblock %}
|
||||
|
||||
{% block sidebar %}
|
||||
{% for subtemplate in sidebar_subtemplates %}
|
||||
<div class="generic_subform">
|
||||
{% include subtemplate %}
|
||||
</div><!--end subform-->
|
||||
{% endfor %}
|
||||
|
||||
{% for subtemplate in sidebar_subtemplates_list %}
|
||||
{% with subtemplate.title as title %}
|
||||
{% with subtemplate.object_list as object_list %}
|
||||
{% with subtemplate.extra_columns as extra_columns %}
|
||||
{% with subtemplate.hide_object as hide_object %}
|
||||
{% with subtemplate.main_object as main_object %}
|
||||
{% with subtemplate.hide_link as hide_link %}
|
||||
{% with subtemplate.hide_header as hide_header %}
|
||||
{% with subtemplate.hide_columns as hide_columns %}
|
||||
{% with "true" as side_bar %}
|
||||
|
||||
{% with subtemplate.submit_method as submit_method %}
|
||||
{% with subtemplate.striptags as striptags %}
|
||||
{% with subtemplate.title as title %}
|
||||
{% with subtemplate.object as object %}
|
||||
{% with subtemplate.object_name as object_name %}
|
||||
{% with subtemplate.form_action as form_action %}
|
||||
{% with subtemplate.submit_label as submit_label %}
|
||||
{% with subtemplate.form as form %}
|
||||
|
||||
{% with subtemplate.content as content %}
|
||||
{% with subtemplate.paragraphs as paragraphs %}
|
||||
|
||||
{% include subtemplate.name %}
|
||||
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
|
||||
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
{% if subtemplate.form %}
|
||||
{% render_subtemplate subtemplate.name subtemplate.context as rendered_subtemplate %}
|
||||
<div class="generic_subform">
|
||||
{{ rendered_subtemplate }}
|
||||
</div>
|
||||
{% else %}
|
||||
{% render_subtemplate subtemplate.name subtemplate.context as rendered_subtemplate %}
|
||||
{{ rendered_subtemplate }}
|
||||
{% endif %}
|
||||
{% if subtemplate.grid_clear or not subtemplate.grid %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container_12">
|
||||
{% if form %}
|
||||
<div class="grid_{{ form.grid|default:11 }}">
|
||||
{% include "generic_form_subtemplate.html" %}
|
||||
</div>
|
||||
{% if form.grid_clear or not form.grid %}
|
||||
<div class="clear"></div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% for form in form_list %}
|
||||
{% with form.submit_method as submit_method %}
|
||||
{% with form.striptags as striptags %}
|
||||
{% with form.title as title %}
|
||||
{% with form.object as object %}
|
||||
{% with form.object_name as object_name %}
|
||||
{% with form.submit_label as submit_label %}
|
||||
{% with form.form_action as form_action %}
|
||||
<div class="grid_{{ form.grid|default:11 }}">
|
||||
{% with form.form as form %}
|
||||
{% include "generic_form_subtemplate.html" %}
|
||||
{% endwith %}
|
||||
<div class="">
|
||||
{% if form %}
|
||||
<div class="">
|
||||
{% include "generic_form_subtemplate.html" %}
|
||||
</div>
|
||||
{% if form.grid_clear or not form.grid %}
|
||||
<div class="clear"></div>
|
||||
<div class=""></div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% for subtemplate in subtemplates_dict %}
|
||||
{% with subtemplate.title as title %}
|
||||
{% with subtemplate.object_list as object_list %}
|
||||
{% with subtemplate.extra_columns as extra_columns %}
|
||||
{% with subtemplate.hide_object as hide_object %}
|
||||
{% with subtemplate.main_object as main_object %}
|
||||
{% with subtemplate.hide_link as hide_link %}
|
||||
{% with subtemplate.hide_header as hide_header %}
|
||||
{% include subtemplate.name %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
{% for subtemplate in subtemplates_list %}
|
||||
<div class="">
|
||||
{% if subtemplate.form %}
|
||||
{% render_subtemplate subtemplate.name subtemplate.context as rendered_subtemplate %}
|
||||
<div class="generic_subform">
|
||||
{{ rendered_subtemplate }}
|
||||
</div>
|
||||
{% else %}
|
||||
{% render_subtemplate subtemplate.name subtemplate.context as rendered_subtemplate %}
|
||||
{{ rendered_subtemplate }}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if subtemplate.grid_clear or not subtemplate.grid %}
|
||||
<div class=""></div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -4,84 +4,16 @@
|
||||
{% block title %} :: {% blocktrans %}List of {{ title }}{% endblocktrans %}{% endblock %}
|
||||
{#{% block secondary_links %}{{ secondary_links|safe }}{% endblock %}#}
|
||||
|
||||
|
||||
{% block sidebar %}
|
||||
{% for subtemplate in sidebar_subtemplates %}
|
||||
<div class="generic_subform">
|
||||
{% include subtemplate %}
|
||||
</div><!--end subform-->
|
||||
{% endfor %}
|
||||
|
||||
{% for subtemplate in sidebar_subtemplates_list %}
|
||||
{% with subtemplate.title as title %}
|
||||
{% with subtemplate.object_list as object_list %}
|
||||
{% with subtemplate.extra_columns as extra_columns %}
|
||||
{% with subtemplate.hide_object as hide_object %}
|
||||
{% with subtemplate.main_object as main_object %}
|
||||
{% with subtemplate.hide_link as hide_link %}
|
||||
{% with subtemplate.hide_header as hide_header %}
|
||||
{% with subtemplate.hide_columns as hide_columns %}
|
||||
{% with "true" as side_bar %}
|
||||
|
||||
{% with subtemplate.submit_method as submit_method %}
|
||||
{% with subtemplate.striptags as striptags %}
|
||||
{% with subtemplate.title as title %}
|
||||
{% with subtemplate.object as object %}
|
||||
{% with subtemplate.object_name as object_name %}
|
||||
{% with subtemplate.form_action as form_action %}
|
||||
{% with subtemplate.form as form %}
|
||||
|
||||
{% with subtemplate.content as content %}
|
||||
{% with subtemplate.paragraphs as paragraphs %}
|
||||
|
||||
{% include subtemplate.name %}
|
||||
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
|
||||
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% include "generic_list_subtemplate.html" %}
|
||||
|
||||
{% for subtemplate in subtemplates_dict %}
|
||||
{% with subtemplate.title as title %}
|
||||
{% with subtemplate.object_list as object_list %}
|
||||
{% with subtemplate.extra_columns as extra_columns %}
|
||||
{% with subtemplate.hide_object as hide_object %}
|
||||
{% with subtemplate.main_object as main_object %}
|
||||
{% with subtemplate.hide_link as hide_link %}
|
||||
{% with subtemplate.hide_header as hide_header %}
|
||||
{% with subtemplate.multi_select as multi_select %}
|
||||
{% include subtemplate.name %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
@@ -37,8 +37,8 @@ document_list_recent = {'text': _(u'recent documents list'), 'view': 'document_l
|
||||
document_create = {'text': _(u'upload a new document'), 'view': 'document_create', 'famfam': 'page_add', 'permissions': {'namespace': 'documents', 'permissions': [PERMISSION_DOCUMENT_CREATE]}}
|
||||
document_create_multiple = {'text': _(u'upload multiple new documents'), 'view': 'document_create_multiple', 'famfam': 'page_add', 'permissions': {'namespace': 'documents', 'permissions': [PERMISSION_DOCUMENT_CREATE]}}
|
||||
document_create_sibling = {'text': _(u'upload new document using same metadata'), 'view': 'document_create_sibling', 'args': 'object.id', 'famfam': 'page_copy', 'permissions': {'namespace': 'documents', 'permissions': [PERMISSION_DOCUMENT_CREATE]}}
|
||||
document_view = {'text': _(u'details (advanced)'), 'view': 'document_view', 'args': 'object.id', 'famfam': 'page', 'permissions': {'namespace': 'documents', 'permissions': [PERMISSION_DOCUMENT_VIEW]}}
|
||||
document_view_simple = {'text': _(u'details (simple)'), 'view': 'document_view_simple', 'args': 'object.id', 'famfam': 'page', 'permissions': {'namespace': 'documents', 'permissions': [PERMISSION_DOCUMENT_VIEW]}}
|
||||
document_view_advanced = {'text': _(u'details (advanced)'), 'view': 'document_view_advanced', 'args': 'object.id', 'famfam': 'page', 'permissions': {'namespace': 'documents', 'permissions': [PERMISSION_DOCUMENT_VIEW]}}
|
||||
document_delete = {'text': _(u'delete'), 'view': 'document_delete', 'args': 'object.id', 'famfam': 'page_delete', 'permissions': {'namespace': 'documents', 'permissions': [PERMISSION_DOCUMENT_DELETE]}}
|
||||
document_multiple_delete = {'text': _(u'delete'), 'view': 'document_multiple_delete', 'famfam': 'page_delete', 'permissions': {'namespace': 'documents', 'permissions': [PERMISSION_DOCUMENT_DELETE]}}
|
||||
document_edit = {'text': _(u'edit'), 'view': 'document_edit', 'args': 'object.id', 'famfam': 'page_edit', 'permissions': {'namespace': 'documents', 'permissions': [PERMISSION_DOCUMENT_PROPERTIES_EDIT]}}
|
||||
@@ -79,7 +79,7 @@ metadata_group_create_sibling = {'text': _(u'upload new document using same meta
|
||||
staging_file_preview = {'text': _(u'preview'), 'class': 'fancybox-noscaling', 'view': 'staging_file_preview', 'args': 'object.id', 'famfam': 'drive_magnify'}
|
||||
staging_file_delete = {'text': _(u'delete'), 'view': 'staging_file_delete', 'args': 'object.id', 'famfam': 'drive_delete'}
|
||||
|
||||
register_links(Document, [document_view_simple, document_view, document_edit, document_print, document_delete, document_download, document_find_duplicates, document_clear_transformations])
|
||||
register_links(Document, [document_view_simple, document_view_advanced, document_edit, document_print, document_delete, document_download, document_find_duplicates, document_clear_transformations])
|
||||
register_links(Document, [document_create_sibling], menu_name='sidebar')
|
||||
|
||||
register_multi_item_links(['metadatagroup_view', 'document_list', 'document_list_recent'], [document_multiple_clear_transformations, document_multiple_delete])
|
||||
|
||||
@@ -16,7 +16,7 @@ urlpatterns = patterns('documents.views',
|
||||
url(r'^document/create/from/local/multiple/$', 'document_create', {'multiple': True}, 'document_create_multiple'),
|
||||
url(r'^document/type/upload/single/$', 'upload_document_with_type', {'multiple': False}, 'upload_document'),
|
||||
url(r'^document/type/upload/multiple/$', 'upload_document_with_type', {'multiple': True}, 'upload_document_multiple'),
|
||||
url(r'^document/(?P<document_id>\d+)/$', 'document_view', (), 'document_view'),
|
||||
url(r'^document/(?P<document_id>\d+)/$', 'document_view_advanced', (), 'document_view_advanced'),
|
||||
url(r'^document/(?P<document_id>\d+)/simple/$', 'document_view_simple', (), 'document_view_simple'),
|
||||
url(r'^document/(?P<document_id>\d+)/delete/$', 'document_delete', (), 'document_delete'),
|
||||
url(r'^document/multiple/delete/$', 'document_multiple_delete', (), 'document_multiple_delete'),
|
||||
|
||||
@@ -205,16 +205,15 @@ def upload_document_with_type(request, multiple=True):
|
||||
else:
|
||||
return HttpResponseRedirect(reverse('document_list'))
|
||||
|
||||
context = {
|
||||
'document_type_id': document_type_id,
|
||||
'form_list': [
|
||||
{
|
||||
'form': local_form,
|
||||
'title': _(u'upload a local document'),
|
||||
'grid': 6,
|
||||
'grid_clear': False if USE_STAGING_DIRECTORY else True,
|
||||
},
|
||||
],
|
||||
subtemplates_list = []
|
||||
local_upload_form = {
|
||||
'name': 'generic_form_subtemplate.html',
|
||||
'context': {
|
||||
'form': local_form,
|
||||
'title': _(u'upload a local document'),
|
||||
'grid': 6,
|
||||
'grid_clear': False if USE_STAGING_DIRECTORY else True,
|
||||
}
|
||||
}
|
||||
|
||||
if USE_STAGING_DIRECTORY:
|
||||
@@ -224,45 +223,146 @@ def upload_document_with_type(request, multiple=True):
|
||||
messages.error(request, e)
|
||||
filelist = []
|
||||
finally:
|
||||
context.update({
|
||||
'subtemplates_dict': [
|
||||
{
|
||||
'name': 'generic_list_subtemplate.html',
|
||||
subtemplates_list.append(local_upload_form)
|
||||
subtemplates_list.append(
|
||||
{
|
||||
'name': 'generic_form_subtemplate.html',
|
||||
'context': {
|
||||
'form': staging_form,
|
||||
'title': _(u'upload a document from staging'),
|
||||
'grid': 6,
|
||||
'grid_clear': True,
|
||||
}
|
||||
},
|
||||
)
|
||||
subtemplates_list.append(
|
||||
{
|
||||
'name': 'generic_list_subtemplate.html',
|
||||
'context': {
|
||||
'title': _(u'files in staging'),
|
||||
'object_list': filelist,
|
||||
'hide_link': True,
|
||||
},
|
||||
],
|
||||
})
|
||||
context['form_list'].append(
|
||||
{
|
||||
'form': staging_form,
|
||||
'title': _(u'upload a document from staging'),
|
||||
'grid': 6,
|
||||
'grid_clear': True,
|
||||
}
|
||||
},
|
||||
)
|
||||
)
|
||||
else:
|
||||
subtemplates_list.append(local_upload_form)
|
||||
|
||||
|
||||
context = {
|
||||
'document_type_id': document_type_id,
|
||||
|
||||
'subtemplates_list': subtemplates_list,
|
||||
}
|
||||
context.update({
|
||||
'sidebar_subtemplates_list': [
|
||||
{
|
||||
'title': _(u'Current metadata'),
|
||||
'name': 'generic_subtemplate.html',
|
||||
#'content': metadata_repr(decode_metadata_from_url(request.GET)),
|
||||
'paragraphs': metadata_repr_as_list(decode_metadata_from_url(request.GET))
|
||||
'context': {
|
||||
'title': _(u'Current metadata'),
|
||||
#'content': metadata_repr(decode_metadata_from_url(request.GET)),
|
||||
'paragraphs': metadata_repr_as_list(decode_metadata_from_url(request.GET))
|
||||
}
|
||||
}]
|
||||
})
|
||||
})
|
||||
return render_to_response('generic_form.html', context,
|
||||
context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def document_view(request, document_id):
|
||||
def document_view_simple(request, document_id):
|
||||
check_permissions(request.user, 'documents', [PERMISSION_DOCUMENT_VIEW])
|
||||
|
||||
document = get_object_or_404(Document.objects.select_related(), pk=document_id)
|
||||
|
||||
RecentDocument.objects.add_document_for_user(request.user, document)
|
||||
|
||||
subtemplates_list = []
|
||||
|
||||
content_form = DocumentContentForm(document=document)
|
||||
|
||||
preview_form = DocumentPreviewForm(document=document)
|
||||
subtemplates_list.append(
|
||||
{
|
||||
'name': 'generic_form_subtemplate.html',
|
||||
'context': {
|
||||
'form': preview_form,
|
||||
'object': document,
|
||||
}
|
||||
},
|
||||
)
|
||||
subtemplates_list.append(
|
||||
{
|
||||
'name': 'generic_form_subtemplate.html',
|
||||
'context': {
|
||||
'title':_(u'document properties'),
|
||||
'form': content_form,
|
||||
'object': document,
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
if document.tags.count():
|
||||
subtemplates_list.append(get_tags_subtemplate(document))
|
||||
|
||||
if Comment.objects.for_model(document).count():
|
||||
subtemplates_list.append(get_comments_subtemplate(document))
|
||||
|
||||
subtemplates_list.append(
|
||||
{
|
||||
'name': 'generic_list_subtemplate.html',
|
||||
'context': {
|
||||
'title': _(u'metadata'),
|
||||
'object_list': document.documentmetadata_set.all(),
|
||||
'extra_columns': [{'name': _(u'value'), 'attribute': 'value'}],
|
||||
'hide_link': True,
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
metadata_groups, errors = document.get_metadata_groups()
|
||||
if (request.user.is_staff or request.user.is_superuser) and errors:
|
||||
for error in errors:
|
||||
messages.warning(request, _(u'Document group query error: %s' % error))
|
||||
|
||||
if not GROUP_SHOW_EMPTY:
|
||||
#If GROUP_SHOW_EMPTY is False, remove empty groups from
|
||||
#dictionary
|
||||
metadata_groups = dict([(group, data) for group, data in metadata_groups.items() if data])
|
||||
|
||||
if metadata_groups:
|
||||
subtemplates_list.append(
|
||||
{
|
||||
'name': 'generic_form_subtemplate.html',
|
||||
'context': {
|
||||
'title': _(u'document groups (%s)') % len(metadata_groups.keys()),
|
||||
'form': MetaDataGroupForm(
|
||||
groups=metadata_groups, current_document=document,
|
||||
links=[
|
||||
metadata_group_link
|
||||
]
|
||||
),
|
||||
'form_action': reverse('metadatagroup_action'),
|
||||
'submit_method': 'GET',
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
return render_to_response('generic_detail.html', {
|
||||
'object': document,
|
||||
'document': document,
|
||||
'subtemplates_list': subtemplates_list,
|
||||
}, context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def document_view_advanced(request, document_id):
|
||||
check_permissions(request.user, 'documents', [PERMISSION_DOCUMENT_VIEW])
|
||||
|
||||
document = get_object_or_404(Document.objects.select_related(), pk=document_id)
|
||||
|
||||
RecentDocument.objects.add_document_for_user(request.user, document)
|
||||
|
||||
subtemplates_list = []
|
||||
|
||||
form = DocumentForm_view(instance=document, extra_fields=[
|
||||
{'label': _(u'Filename'), 'field': 'file_filename'},
|
||||
{'label': _(u'File extension'), 'field': 'file_extension'},
|
||||
@@ -279,19 +379,27 @@ def document_view(request, document_id):
|
||||
])
|
||||
|
||||
preview_form = DocumentPreviewForm(document=document)
|
||||
form_list = [
|
||||
{
|
||||
'form': preview_form,
|
||||
'object': document,
|
||||
},
|
||||
{
|
||||
'title': _(u'document properties'),
|
||||
'form': form,
|
||||
'object': document,
|
||||
},
|
||||
]
|
||||
|
||||
subtemplates_list = []
|
||||
subtemplates_list.append(
|
||||
{
|
||||
'name': 'generic_form_subtemplate.html',
|
||||
'context': {
|
||||
'form': preview_form,
|
||||
'object': document,
|
||||
}
|
||||
},
|
||||
)
|
||||
subtemplates_list.append(
|
||||
{
|
||||
'name': 'generic_form_subtemplate.html',
|
||||
'context': {
|
||||
'form': form,
|
||||
'title': _(u'document properties'),
|
||||
'object': document,
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
if document.tags.count():
|
||||
subtemplates_list.append(get_tags_subtemplate(document))
|
||||
|
||||
@@ -346,7 +454,6 @@ def document_view(request, document_id):
|
||||
})
|
||||
|
||||
return render_to_response('generic_detail.html', {
|
||||
'form_list': form_list,
|
||||
'object': document,
|
||||
'document': document,
|
||||
'subtemplates_list': subtemplates_list,
|
||||
@@ -723,13 +830,13 @@ def document_clear_transformations(request, document_id=None, document_id_list=N
|
||||
|
||||
if document_id:
|
||||
documents = [get_object_or_404(Document.objects, pk=document_id)]
|
||||
post_redirect = reverse('document_view', args=[documents[0].pk])
|
||||
post_redirect = reverse('document_view_simple', args=[documents[0].pk])
|
||||
elif document_id_list:
|
||||
documents = [get_object_or_404(Document, pk=document_id) for document_id in document_id_list.split(',')]
|
||||
post_redirect = None
|
||||
else:
|
||||
messages.error(request, _(u'Must provide at least one document.'))
|
||||
return HttpResponseRedirect(request.META.get('HTTP_REFERER', '/'))
|
||||
return HttpResponseRedirect(request.META.get('HTTP_REFERER', u'/'))
|
||||
|
||||
previous = request.POST.get('previous', request.GET.get('previous', request.META.get('HTTP_REFERER', post_redirect or reverse('document_list'))))
|
||||
next = request.POST.get('next', request.GET.get('next', request.META.get('HTTP_REFERER', post_redirect or reverse('document_list'))))
|
||||
@@ -768,83 +875,6 @@ def document_multiple_clear_transformations(request):
|
||||
return document_clear_transformations(request, document_id_list=request.GET.get('id_list', []))
|
||||
|
||||
|
||||
def document_view_simple(request, document_id):
|
||||
check_permissions(request.user, 'documents', [PERMISSION_DOCUMENT_VIEW])
|
||||
|
||||
document = get_object_or_404(Document.objects.select_related(), pk=document_id)
|
||||
|
||||
RecentDocument.objects.add_document_for_user(request.user, document)
|
||||
|
||||
content_form = DocumentContentForm(document=document)
|
||||
|
||||
preview_form = DocumentPreviewForm(document=document)
|
||||
form_list = [
|
||||
{
|
||||
'form': preview_form,
|
||||
'object': document,
|
||||
},
|
||||
{
|
||||
'title':_(u'document properties'),
|
||||
'form': content_form,
|
||||
'object': document,
|
||||
},
|
||||
]
|
||||
|
||||
subtemplates_list = []
|
||||
if document.tags.count():
|
||||
subtemplates_list.append(get_tags_subtemplate(document))
|
||||
|
||||
if Comment.objects.for_model(document).count():
|
||||
subtemplates_list.append(get_comments_subtemplate(document))
|
||||
|
||||
subtemplates_list.append(
|
||||
{
|
||||
'name': 'generic_list_subtemplate.html',
|
||||
'context': {
|
||||
'title': _(u'metadata'),
|
||||
'object_list': document.documentmetadata_set.all(),
|
||||
'extra_columns': [{'name': _(u'value'), 'attribute': 'value'}],
|
||||
'hide_link': True,
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
metadata_groups, errors = document.get_metadata_groups()
|
||||
if (request.user.is_staff or request.user.is_superuser) and errors:
|
||||
for error in errors:
|
||||
messages.warning(request, _(u'Document group query error: %s' % error))
|
||||
|
||||
if not GROUP_SHOW_EMPTY:
|
||||
#If GROUP_SHOW_EMPTY is False, remove empty groups from
|
||||
#dictionary
|
||||
metadata_groups = dict([(group, data) for group, data in metadata_groups.items() if data])
|
||||
|
||||
if metadata_groups:
|
||||
subtemplates_list.append(
|
||||
{
|
||||
'name': 'generic_form_subtemplate.html',
|
||||
'context': {
|
||||
'title': _(u'document groups (%s)') % len(metadata_groups.keys()),
|
||||
'form': MetaDataGroupForm(
|
||||
groups=metadata_groups, current_document=document,
|
||||
links=[
|
||||
metadata_group_link
|
||||
]
|
||||
),
|
||||
'form_action': reverse('metadatagroup_action'),
|
||||
'submit_method': 'GET',
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
return render_to_response('generic_detail.html', {
|
||||
'form_list': form_list,
|
||||
'object': document,
|
||||
'document': document,
|
||||
'subtemplates_list': subtemplates_list,
|
||||
}, context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def document_missing_list(request):
|
||||
check_permissions(request.user, 'documents', [PERMISSION_DOCUMENT_VIEW])
|
||||
|
||||
@@ -876,16 +906,11 @@ def document_page_view(request, document_page_id):
|
||||
rotation = int(request.GET.get('rotation', 0))
|
||||
document_page_form = DocumentPageForm(instance=document_page, zoom=zoom, rotation=rotation)
|
||||
|
||||
form_list = [
|
||||
{
|
||||
'form': document_page_form,
|
||||
'title': _(u'details for: %s') % document_page,
|
||||
},
|
||||
]
|
||||
return render_to_response('generic_detail.html', {
|
||||
'form_list': form_list,
|
||||
'object': document_page,
|
||||
'web_theme_hide_menus': True,
|
||||
'form': document_page_form,
|
||||
'title': _(u'details for: %s') % document_page,
|
||||
}, context_instance=RequestContext(request))
|
||||
|
||||
|
||||
@@ -895,16 +920,11 @@ def document_page_text(request, document_page_id):
|
||||
document_page = get_object_or_404(DocumentPage, pk=document_page_id)
|
||||
document_page_form = DocumentPageForm_text(instance=document_page)
|
||||
|
||||
form_list = [
|
||||
{
|
||||
'form': document_page_form,
|
||||
'title': _(u'details for: %s') % document_page,
|
||||
},
|
||||
]
|
||||
return render_to_response('generic_detail.html', {
|
||||
'form_list': form_list,
|
||||
'object': document_page,
|
||||
'web_theme_hide_menus': True,
|
||||
'form': document_page_form,
|
||||
'title': _(u'details for: %s') % document_page,
|
||||
}, context_instance=RequestContext(request))
|
||||
|
||||
|
||||
@@ -934,12 +954,12 @@ def document_page_edit(request, document_page_id):
|
||||
|
||||
def document_page_navigation_next(request, document_page_id):
|
||||
check_permissions(request.user, 'documents', [PERMISSION_DOCUMENT_VIEW])
|
||||
view = resolve_to_name(urlparse.urlparse(request.META.get('HTTP_REFERER', '/')).path)
|
||||
view = resolve_to_name(urlparse.urlparse(request.META.get('HTTP_REFERER', u'/')).path)
|
||||
|
||||
document_page = get_object_or_404(DocumentPage, pk=document_page_id)
|
||||
if document_page.page_number >= document_page.document.documentpage_set.count():
|
||||
messages.warning(request, _(u'There are no more pages in this document'))
|
||||
return HttpResponseRedirect(request.META.get('HTTP_REFERER', '/'))
|
||||
return HttpResponseRedirect(request.META.get('HTTP_REFERER', u'/'))
|
||||
else:
|
||||
document_page = get_object_or_404(DocumentPage, document=document_page.document, page_number=document_page.page_number + 1)
|
||||
return HttpResponseRedirect(reverse(view, args=[document_page.pk]))
|
||||
@@ -947,12 +967,12 @@ def document_page_navigation_next(request, document_page_id):
|
||||
|
||||
def document_page_navigation_previous(request, document_page_id):
|
||||
check_permissions(request.user, 'documents', [PERMISSION_DOCUMENT_VIEW])
|
||||
view = resolve_to_name(urlparse.urlparse(request.META.get('HTTP_REFERER', '/')).path)
|
||||
view = resolve_to_name(urlparse.urlparse(request.META.get('HTTP_REFERER', u'/')).path)
|
||||
|
||||
document_page = get_object_or_404(DocumentPage, pk=document_page_id)
|
||||
if document_page.page_number <= 1:
|
||||
messages.warning(request, _(u'You are already at the first page of this document'))
|
||||
return HttpResponseRedirect(request.META.get('HTTP_REFERER', '/'))
|
||||
return HttpResponseRedirect(request.META.get('HTTP_REFERER', u'/'))
|
||||
else:
|
||||
document_page = get_object_or_404(DocumentPage, document=document_page.document, page_number=document_page.page_number - 1)
|
||||
return HttpResponseRedirect(reverse(view, args=[document_page.pk]))
|
||||
@@ -960,7 +980,7 @@ def document_page_navigation_previous(request, document_page_id):
|
||||
|
||||
def document_page_navigation_first(request, document_page_id):
|
||||
check_permissions(request.user, 'documents', [PERMISSION_DOCUMENT_VIEW])
|
||||
view = resolve_to_name(urlparse.urlparse(request.META.get('HTTP_REFERER', '/')).path)
|
||||
view = resolve_to_name(urlparse.urlparse(request.META.get('HTTP_REFERER', u'/')).path)
|
||||
|
||||
document_page = get_object_or_404(DocumentPage, pk=document_page_id)
|
||||
document_page = get_object_or_404(DocumentPage, document=document_page.document, page_number=1)
|
||||
@@ -969,7 +989,7 @@ def document_page_navigation_first(request, document_page_id):
|
||||
|
||||
def document_page_navigation_last(request, document_page_id):
|
||||
check_permissions(request.user, 'documents', [PERMISSION_DOCUMENT_VIEW])
|
||||
view = resolve_to_name(urlparse.urlparse(request.META.get('HTTP_REFERER', '/')).path)
|
||||
view = resolve_to_name(urlparse.urlparse(request.META.get('HTTP_REFERER', u'/')).path)
|
||||
|
||||
document_page = get_object_or_404(DocumentPage, pk=document_page_id)
|
||||
document_page = get_object_or_404(DocumentPage, document=document_page.document, page_number=document_page.document.documentpage_set.count())
|
||||
@@ -986,11 +1006,11 @@ def document_list_recent(request):
|
||||
|
||||
def transform_page(request, document_page_id, zoom_function=None, rotation_function=None):
|
||||
check_permissions(request.user, 'documents', [PERMISSION_DOCUMENT_VIEW])
|
||||
view = resolve_to_name(urlparse.urlparse(request.META.get('HTTP_REFERER', '/')).path)
|
||||
view = resolve_to_name(urlparse.urlparse(request.META.get('HTTP_REFERER', u'/')).path)
|
||||
|
||||
document_page = get_object_or_404(DocumentPage, pk=document_page_id)
|
||||
# Get the query string from the referer url
|
||||
query = urlparse.urlparse(request.META.get('HTTP_REFERER', '/')).query
|
||||
query = urlparse.urlparse(request.META.get('HTTP_REFERER', u'/')).query
|
||||
# Parse the query string and get the zoom value
|
||||
# parse_qs return a dictionary whose values are lists
|
||||
zoom = int(urlparse.parse_qs(query).get('zoom', ['100'])[0])
|
||||
@@ -1047,7 +1067,7 @@ def metadatagroup_action(request):
|
||||
|
||||
if not action:
|
||||
messages.error(request, _(u'No action selected.'))
|
||||
return HttpResponseRedirect(request.META.get('HTTP_REFERER', '/'))
|
||||
return HttpResponseRedirect(request.META.get('HTTP_REFERER', u'/'))
|
||||
|
||||
return HttpResponseRedirect(action)
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<link rel="stylesheet" href="{{ MEDIA_URL }}css/famfamfam-silk-sprite.css" type="text/css" media="screen" />
|
||||
<link rel="stylesheet" href="{{ MEDIA_URL }}packages/jquery.fancybox-1.3.4/fancybox/jquery.fancybox-1.3.4.css" type="text/css" media="screen" />
|
||||
{#<link rel="stylesheet" href="{{ MEDIA_URL }}packages/nathansmith-960-Grid-System-30906f2/code/css/960.css" type="text/css" media="screen" />#}
|
||||
<link rel="stylesheet" href="{{ MEDIA_URL }}css/960-fluid.css" type="text/css" media="screen" />
|
||||
{#<link rel="stylesheet" href="{{ MEDIA_URL }}css/960-fluid.css" type="text/css" media="screen" />#}
|
||||
<style type="text/css">
|
||||
#fancybox-left-ico {
|
||||
left: 20px;
|
||||
|
||||
@@ -231,20 +231,26 @@ def role_members(request, role_id):
|
||||
context = {
|
||||
'object': role,
|
||||
'object_name': _(u'role'),
|
||||
'form_list': [
|
||||
'subtemplates_list': [
|
||||
{
|
||||
'form': unselected_users_form,
|
||||
'title': _(u'non members of role: %s') % role,
|
||||
'grid': 6,
|
||||
'grid_clear': False,
|
||||
'submit_label': _(u'Add'),
|
||||
},
|
||||
'name':'generic_form_subtemplate.html',
|
||||
'context': {
|
||||
'form': unselected_users_form,
|
||||
'title': _(u'non members of role: %s') % role,
|
||||
'grid': 6,
|
||||
'grid_clear': False,
|
||||
'submit_label': _(u'Add'),
|
||||
}
|
||||
},
|
||||
{
|
||||
'form': selected_users_form,
|
||||
'title': _(u'members of role: %s') % role,
|
||||
'grid': 6,
|
||||
'grid_clear': True,
|
||||
'submit_label': _(u'Remove'),
|
||||
'name':'generic_form_subtemplate.html',
|
||||
'context': {
|
||||
'form': selected_users_form,
|
||||
'title': _(u'members of role: %s') % role,
|
||||
'grid': 6,
|
||||
'grid_clear': True,
|
||||
'submit_label': _(u'Remove'),
|
||||
}
|
||||
},
|
||||
|
||||
],
|
||||
|
||||
@@ -370,20 +370,26 @@ def group_members(request, group_id):
|
||||
context = {
|
||||
'object': group,
|
||||
'object_name': _(u'group'),
|
||||
'form_list': [
|
||||
'subtemplates_list': [
|
||||
{
|
||||
'form': unselected_users_form,
|
||||
'title': _(u'non members of group: %s') % group,
|
||||
'grid': 6,
|
||||
'grid_clear': False,
|
||||
'submit_label': _(u'Add'),
|
||||
'name': u'generic_form_subtemplate.html',
|
||||
'context': {
|
||||
'form': unselected_users_form,
|
||||
'title': _(u'non members of group: %s') % group,
|
||||
'grid': 6,
|
||||
'grid_clear': False,
|
||||
'submit_label': _(u'Add'),
|
||||
}
|
||||
},
|
||||
{
|
||||
'form': selected_users_form,
|
||||
'title': _(u'members of group: %s') % group,
|
||||
'grid': 6,
|
||||
'grid_clear': True,
|
||||
'submit_label': _(u'Remove'),
|
||||
'name': u'generic_form_subtemplate.html',
|
||||
'context': {
|
||||
'form': selected_users_form,
|
||||
'title': _(u'members of group: %s') % group,
|
||||
'grid': 6,
|
||||
'grid_clear': True,
|
||||
'submit_label': _(u'Remove'),
|
||||
}
|
||||
},
|
||||
|
||||
],
|
||||
|
||||
15
docs/TODO
15
docs/TODO
@@ -49,6 +49,8 @@ TODO, WISHLIST
|
||||
* Android App - NOT NEEDED (Use CamScanner, (C) IntSig Information Co, Ltd.)
|
||||
* Extract nagivation code into new navigation app - DONE
|
||||
|
||||
* TODO: Solve css:last column problem
|
||||
* Change task manager from celery/rabbit to gearman
|
||||
* Receive documents via email
|
||||
* Mobile version
|
||||
* Exif to metadata convertion
|
||||
@@ -70,7 +72,7 @@ Common
|
||||
======
|
||||
* Filterform date filtering widget
|
||||
* Divide navigation links search by object and by view
|
||||
* Merge all generic templates into template widget object based rendering
|
||||
* Merge generic templates into template widget object based rendering - DONE
|
||||
* Multiple document select in generic list template - DONE
|
||||
* Keyboard navigation
|
||||
* Default button linking to 'Enter' and ESC key for cancel
|
||||
@@ -80,7 +82,7 @@ Common
|
||||
|
||||
Permissions
|
||||
===========
|
||||
* Add permissions support to menus
|
||||
* Add permissions support to menus - STARTED (secondary menus done)
|
||||
* Role editing view under setup - DONE
|
||||
* Implement permissions decorators
|
||||
* Add user editing under roles menus - DONE
|
||||
@@ -88,7 +90,8 @@ Permissions
|
||||
|
||||
Documents
|
||||
=========
|
||||
* Skip step 2 of wizard (metadata) if no document type metadata types have been defined
|
||||
* Skip step 2 of wizard (metadata) if no document type metadata types - DONE
|
||||
have been defined
|
||||
* Tile based image server
|
||||
* Do separate default transformations for staging and for local uploads
|
||||
* Download a document in different formats: (jpg, png, pdf)
|
||||
@@ -96,7 +99,7 @@ Documents
|
||||
* Download original document or transformed document
|
||||
* Display preferences 'document transformations' (Rotation, default zoom)
|
||||
* Document view temp transformations
|
||||
* Gallery view for document groups
|
||||
* Gallery view for document groups - DONE
|
||||
* Versioning support
|
||||
* Generic document anotations using layer overlays
|
||||
* Field for document language or autodetect
|
||||
@@ -108,7 +111,7 @@ Documents
|
||||
* Allow document type to be changed in document edit view
|
||||
* Document model's delete method might not get called when deleting in bulk
|
||||
from a queryset
|
||||
* Allow metadata entry form to mix required and non required metadata
|
||||
* Allow metadata entry form to mix required and non required metadata - DEFFERED
|
||||
* Block Setup menu item to non staff and non superuser users
|
||||
* Include annotations in transformed documents downloads
|
||||
* Toggable option to include default transformation on document upload
|
||||
@@ -126,7 +129,7 @@ Documents
|
||||
* Use document preview code for staging file also - DONE
|
||||
* Delete physical file on delete method - DEFFERED (Not needed until Django 1.3)
|
||||
* Download individual document pages
|
||||
* Document printing support
|
||||
* Document printing support - STARTED
|
||||
* Document group actions - DONE
|
||||
|
||||
Filesystem serving
|
||||
|
||||
Reference in New Issue
Block a user