remove "move to pool" subscriber, now provided by pfwbged.policy
This commit is contained in:
parent
c5110ae617
commit
1e9751e431
|
@ -28,10 +28,6 @@ from collective.dms.basecontent.widget import AjaxChosenMultiFieldWidget
|
|||
from plone.autoform import directives as form
|
||||
from plone.directives.form import default_value
|
||||
|
||||
from zope.app.intid.interfaces import IIntIds
|
||||
from z3c.relationfield import RelationValue
|
||||
from zope.lifecycleevent.interfaces import IObjectAddedEvent
|
||||
|
||||
import z3c.table.column
|
||||
|
||||
|
||||
|
@ -184,42 +180,3 @@ class ClassifiedItems:
|
|||
|
||||
class FolderView(DefaultView, ClassifiedItems):
|
||||
pass
|
||||
|
||||
|
||||
@grok.subscribe(IFolder, IObjectAddedEvent)
|
||||
@grok.subscribe(IDmsDocument, IObjectAddedEvent)
|
||||
def move_to_proper_location(context, event):
|
||||
folder = context.getParentNode()
|
||||
if context.portal_type == 'pfwbgedfolder':
|
||||
if folder.id == 'Members' and aq_parent(folder).portal_type == 'Plone Site':
|
||||
# the folder is already in the right place, good
|
||||
return
|
||||
if folder.id == 'dossiers' and aq_parent(folder).portal_type == 'Plone Site':
|
||||
# the folder 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)
|
||||
link = context.invokeFactory('pfwbgedlink', 'pfwbgedlink-0',
|
||||
folder=RelationValue(intids.getId(folder)))
|
||||
|
||||
# then move the document to the general documents folder
|
||||
clipboard = folder.manage_cutObjects([context.id])
|
||||
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:
|
||||
folder.manage_delObjects([context.id])
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
new_url = target_folder.absolute_url() + '/' + result[0]['new_id']
|
||||
context.REQUEST.response.redirect(new_url, lock=True)
|
||||
|
|
Reference in New Issue