Single document upload can now be enabled or disable to allow users to work faster (1 less click)

This commit is contained in:
Roberto Rosario
2011-02-18 23:35:18 -04:00
parent 875c772e5a
commit ee7e9f34a2
4 changed files with 22 additions and 6 deletions

View File

@@ -14,6 +14,8 @@ from staging import StagingFile
from common.conf import settings as common_settings from common.conf import settings as common_settings
from conf.settings import ENABLE_SINGLE_DOCUMENT_UPLOAD
PERMISSION_DOCUMENT_CREATE = 'document_create' PERMISSION_DOCUMENT_CREATE = 'document_create'
PERMISSION_DOCUMENT_PROPERTIES_EDIT = 'document_properties_edit' PERMISSION_DOCUMENT_PROPERTIES_EDIT = 'document_properties_edit'
PERMISSION_DOCUMENT_METADATA_EDIT = 'document_metadata_edit' PERMISSION_DOCUMENT_METADATA_EDIT = 'document_metadata_edit'
@@ -55,7 +57,11 @@ staging_file_delete = {'text':_('delete'), 'view':'staging_file_delete', 'args':
register_links(Document, [document_view, document_edit, document_edit_metadata, document_delete, document_download], menu_name='sidebar') register_links(Document, [document_view, document_edit, document_edit_metadata, document_delete, document_download], menu_name='sidebar')
register_links(Document, [document_list, document_create, document_create_multiple, document_create_sibling], menu_name='sidebar') register_links(Document, [document_list, document_create, document_create_multiple, document_create_sibling], menu_name='sidebar')
register_links(['document_list', 'document_create', 'document_create_multiple', 'upload_document_with_type', 'upload_multiple_documents_with_type'], [document_list, document_create, document_create_multiple], menu_name='sidebar')
if ENABLE_SINGLE_DOCUMENT_UPLOAD:
register_links(['document_list', 'document_create', 'document_create_multiple', 'upload_document_with_type', 'upload_multiple_documents_with_type'], [document_list, document_create, document_create_multiple], menu_name='sidebar')
else:
register_links(['document_list', 'document_create', 'document_create_multiple', 'upload_document_with_type', 'upload_multiple_documents_with_type'], [document_list, document_create_multiple], menu_name='sidebar')
register_links(DocumentPage, [document_page_go_back], menu_name='sidebar') register_links(DocumentPage, [document_page_go_back], menu_name='sidebar')
@@ -76,9 +82,16 @@ register_model_list_columns(Document, [
]) ])
register_menu([ print 'ENABLE_SINGLE_DOCUMENT_UPLOAD', ENABLE_SINGLE_DOCUMENT_UPLOAD
{'text':_('documents'), 'view':'document_create', 'links':[ if ENABLE_SINGLE_DOCUMENT_UPLOAD:
document_create, document_create_multiple, document_list register_menu([
],'famfam':'page','position':1}]) {'text':_('documents'), 'view':'document_create', 'links':[
document_create, document_create_multiple, document_list
],'famfam':'page','position':1}])
else:
register_menu([
{'text':_('documents'), 'view':'document_create_multiple', 'links':[
document_create_multiple, document_list
],'famfam':'page','position':1}])
TEMPORARY_DIRECTORY = common_settings.TEMPORARY_DIRECTORY if common_settings.TEMPORARY_DIRECTORY else tempfile.mkdtemp() TEMPORARY_DIRECTORY = common_settings.TEMPORARY_DIRECTORY if common_settings.TEMPORARY_DIRECTORY else tempfile.mkdtemp()

View File

@@ -35,6 +35,7 @@ DELETE_STAGING_FILE_AFTER_UPLOAD = getattr(settings, 'DOCUMENTS_DELETE_STAGING_F
STAGING_FILES_PREVIEW_SIZE = getattr(settings, 'DOCUMENTS_STAGING_FILES_PREVIEW_SIZE', '640x480') STAGING_FILES_PREVIEW_SIZE = getattr(settings, 'DOCUMENTS_STAGING_FILES_PREVIEW_SIZE', '640x480')
DELETE_LOCAL_ORIGINAL = getattr(settings, 'DOCUMENTS_DELETE_LOCAL_ORIGINAL', False) DELETE_LOCAL_ORIGINAL = getattr(settings, 'DOCUMENTS_DELETE_LOCAL_ORIGINAL', False)
AUTOMATIC_OCR = getattr(settings, 'DOCUMENTS_AUTOMATIC_OCR', False) AUTOMATIC_OCR = getattr(settings, 'DOCUMENTS_AUTOMATIC_OCR', False)
ENABLE_SINGLE_DOCUMENT_UPLOAD = getattr(settings, 'DOCUMENTS_ENABLE_SINGLE_DOCUMENT_UPLOAD', True)
# Saving # Saving
CHECKSUM_FUNCTION = getattr(settings, 'DOCUMENTS_CHECKSUM_FUNCTION', lambda x: hashlib.sha256(x).hexdigest()) CHECKSUM_FUNCTION = getattr(settings, 'DOCUMENTS_CHECKSUM_FUNCTION', lambda x: hashlib.sha256(x).hexdigest())

View File

@@ -6,6 +6,7 @@ from documents.conf.settings import PREVIEW_SIZE
from documents.conf.settings import THUMBNAIL_SIZE from documents.conf.settings import THUMBNAIL_SIZE
from documents.conf.settings import DISPLAY_SIZE from documents.conf.settings import DISPLAY_SIZE
from documents.conf.settings import MULTIPAGE_PREVIEW_SIZE from documents.conf.settings import MULTIPAGE_PREVIEW_SIZE
from documents.conf.settings import ENABLE_SINGLE_DOCUMENT_UPLOAD
from converter.api import QUALITY_HIGH from converter.api import QUALITY_HIGH
@@ -25,7 +26,7 @@ urlpatterns = patterns('documents.views',
url(r'^document/(?P<document_id>\d+)/display/thumbnail/$', 'get_document_image', {'size':THUMBNAIL_SIZE}, 'document_thumbnail'), url(r'^document/(?P<document_id>\d+)/display/thumbnail/$', 'get_document_image', {'size':THUMBNAIL_SIZE}, 'document_thumbnail'),
url(r'^document/(?P<document_id>\d+)/display/$', 'get_document_image', {'size':DISPLAY_SIZE,'quality':QUALITY_HIGH}, 'document_display'), url(r'^document/(?P<document_id>\d+)/display/$', 'get_document_image', {'size':DISPLAY_SIZE,'quality':QUALITY_HIGH}, 'document_display'),
url(r'^document/(?P<document_id>\d+)/download/$', 'document_download', (), 'document_download'), url(r'^document/(?P<document_id>\d+)/download/$', 'document_download', (), 'document_download'),
url(r'^document/(?P<document_id>\d+)/create/siblings/$', 'document_create_sibling', {'multiple':False}, 'document_create_sibling'), url(r'^document/(?P<document_id>\d+)/create/siblings/$', 'document_create_sibling', {'multiple':True if ENABLE_SINGLE_DOCUMENT_UPLOAD == False else False}, 'document_create_sibling'),
url(r'^staging_file/(?P<staging_file_id>\w+)/preview/$', 'staging_file_preview', (), 'staging_file_preview'), url(r'^staging_file/(?P<staging_file_id>\w+)/preview/$', 'staging_file_preview', (), 'staging_file_preview'),
url(r'^staging_file/(?P<staging_file_id>\w+)/delete/$', 'staging_file_delete', (), 'staging_file_delete'), url(r'^staging_file/(?P<staging_file_id>\w+)/delete/$', 'staging_file_delete', (), 'staging_file_delete'),

View File

@@ -180,6 +180,7 @@ LOGIN_EXEMPT_URLS = (
#DOCUMENTS_DELETE_STAGING_FILE_AFTER_UPLOAD = False #DOCUMENTS_DELETE_STAGING_FILE_AFTER_UPLOAD = False
#DOCUMENTS_STAGING_FILES_PREVIEW_SIZE = '640x480' #DOCUMENTS_STAGING_FILES_PREVIEW_SIZE = '640x480'
#DOCUMENTS_AUTOMATIC_OCR = False #DOCUMENTS_AUTOMATIC_OCR = False
#DOCUMENTS_ENABLE_SINGLE_DOCUMENT_UPLOAD = True
# Saving # Saving