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)
|
@grok.subscribe(IDmsDocument, IObjectAddedEvent)
|
||||||
def move_to_proper_location(context, event):
|
def move_to_proper_location(context, event):
|
||||||
folder = context.getParentNode()
|
folder = context.getParentNode()
|
||||||
if folder.id == 'documents' and aq_parent(folder).portal_type == 'Plone Site':
|
if context.portal_type == 'pfwbgedfolder':
|
||||||
# the document is already in the right place, good
|
if folder.id == 'Members' and aq_parent(folder).portal_type == 'Plone Site':
|
||||||
return
|
# the fodler is already in the right place, good
|
||||||
if folder.id == 'Members' and aq_parent(folder).portal_type == 'Plone Site':
|
return
|
||||||
# the document is already in the right place, good
|
if folder.id == 'dossiers' and aq_parent(folder).portal_type == 'Plone Site':
|
||||||
return
|
# 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
|
# add a link to classifying folder
|
||||||
intids = component.getUtility(IIntIds)
|
intids = component.getUtility(IIntIds)
|
||||||
|
@ -219,8 +224,11 @@ def move_to_proper_location(context, event):
|
||||||
|
|
||||||
# then move the document to the general documents folder
|
# then move the document to the general documents folder
|
||||||
clipboard = folder.manage_cutObjects([context.id])
|
clipboard = folder.manage_cutObjects([context.id])
|
||||||
documents_folder = api.portal.get().documents
|
if context.portal_type == 'pfwbgedfolder':
|
||||||
result = documents_folder.manage_pasteObjects(clipboard)
|
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
|
# makes sure original object is deleted
|
||||||
try:
|
try:
|
||||||
|
@ -228,5 +236,5 @@ def move_to_proper_location(context, event):
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
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)
|
context.REQUEST.response.redirect(new_url, lock=True)
|
||||||
|
|
Reference in New Issue