add classifying folders to /dossiers, not /documents
This commit is contained in:
parent
ae1260ded3
commit
bb50fe6ee7
|
@ -205,12 +205,17 @@ class FolderView(DefaultView, ClassifiedItems):
|
|||
@grok.subscribe(IDmsDocument, IObjectAddedEvent)
|
||||
def move_to_proper_location(context, event):
|
||||
folder = context.getParentNode()
|
||||
if folder.id == 'documents' and aq_parent(folder).portal_type == 'Plone Site':
|
||||
# the document is already in the right place, good
|
||||
return
|
||||
if folder.id == 'Members' and aq_parent(folder).portal_type == 'Plone Site':
|
||||
# the document is already in the right place, good
|
||||
return
|
||||
if context.portal_type == 'pfwbgedfolder':
|
||||
if folder.id == 'Members' and aq_parent(folder).portal_type == 'Plone Site':
|
||||
# the fodler is already in the right place, good
|
||||
return
|
||||
if folder.id == 'dossiers' and aq_parent(folder).portal_type == 'Plone Site':
|
||||
# the fodler is already in the right place, good
|
||||
return
|
||||
else:
|
||||
if folder.id == 'documents' and aq_parent(folder).portal_type == 'Plone Site':
|
||||
# the document is already in the right place, good
|
||||
return
|
||||
|
||||
# add a link to classifying folder
|
||||
intids = component.getUtility(IIntIds)
|
||||
|
@ -219,8 +224,11 @@ def move_to_proper_location(context, event):
|
|||
|
||||
# then move the document to the general documents folder
|
||||
clipboard = folder.manage_cutObjects([context.id])
|
||||
documents_folder = api.portal.get().documents
|
||||
result = documents_folder.manage_pasteObjects(clipboard)
|
||||
if context.portal_type == 'pfwbgedfolder':
|
||||
target_folder = api.portal.get().dossiers
|
||||
else:
|
||||
target_folder = api.portal.get().documents
|
||||
result = target_folder.manage_pasteObjects(clipboard)
|
||||
|
||||
# makes sure original object is deleted
|
||||
try:
|
||||
|
@ -228,5 +236,5 @@ def move_to_proper_location(context, event):
|
|||
except AttributeError:
|
||||
pass
|
||||
|
||||
new_url = documents_folder.absolute_url() + '/' + result[0]['new_id']
|
||||
new_url = target_folder.absolute_url() + '/' + result[0]['new_id']
|
||||
context.REQUEST.response.redirect(new_url, lock=True)
|
||||
|
|
Reference in New Issue