diff --git a/last_commit.txt b/last_commit.txt index 7bd7849061..22b7546a29 100644 --- a/last_commit.txt +++ b/last_commit.txt @@ -2,593 +2,163 @@ Repository: plone.app.content Branch: refs/heads/master -Date: 2015-07-22T12:17:58+02:00 -Author: Philip Bauer (pbauer) -Commit: https://github.com/plone/plone.app.content/commit/d7c28bfaab56813bce13064aecde671cbe39ff20 +Date: 2015-07-22T16:30:21+02:00 +Author: Alessandro Pisa (ale-rt) +Commit: https://github.com/plone/plone.app.content/commit/44299dc0631f4c2b50735f9016963f64dcf52a7c -translate buttons +When clicking cancel on the delete_confirmation got to the view_url Files changed: -M plone/app/content/browser/contents/__init__.py -M plone/app/content/browser/contents/copy.py -M plone/app/content/browser/contents/cut.py -M plone/app/content/browser/contents/delete.py -M plone/app/content/browser/contents/paste.py -M plone/app/content/browser/contents/properties.py -M plone/app/content/browser/contents/rename.py -M plone/app/content/browser/contents/tags.py -M plone/app/content/browser/contents/workflow.py +M CHANGES.rst +M plone/app/content/browser/actions.py +M plone/app/content/tests/test_actions.py -diff --git a/plone/app/content/browser/contents/__init__.py b/plone/app/content/browser/contents/__init__.py -index 89dc0ce..22d8f8e 100644 ---- a/plone/app/content/browser/contents/__init__.py -+++ b/plone/app/content/browser/contents/__init__.py -@@ -327,4 +327,4 @@ def __call__(self): - ordering.moveObjectToPosition(brain.id, idx) - else: - self.errors.append(_(u'cannot rearrange folder')) -- return self.message() -\ No newline at end of file -+ return self.message() -diff --git a/plone/app/content/browser/contents/copy.py b/plone/app/content/browser/contents/copy.py -index e353b1d..dbb4c19 100644 ---- a/plone/app/content/browser/contents/copy.py -+++ b/plone/app/content/browser/contents/copy.py -@@ -1,3 +1,4 @@ -+# -*- coding: utf-8 -*- - from OFS.CopySupport import CopyError - from OFS.CopySupport import _cb_encode - from OFS.CopySupport import cookie_path -@@ -7,6 +8,7 @@ - from cgi import escape - from plone.app.content.browser.contents import ContentsBaseAction - from plone.app.content.interfaces import IStructureAction -+from zope.i18n import translate - from zope.interface import implements - - -@@ -21,7 +23,7 @@ def __init__(self, context, request): - - def get_options(self): - return { -- 'title': _('Copy'), -+ 'title': translate(_('Copy'), context=self.request), - 'id': 'copy', - 'icon': 'copy', - 'url': self.context.absolute_url() + '/@@fc-copy' -@@ -50,4 +52,4 @@ def finish(self): - - def __call__(self): - self.oblist = [] -- return super(CopyActionView, self).__call__() -\ No newline at end of file -+ return super(CopyActionView, self).__call__() -diff --git a/plone/app/content/browser/contents/cut.py b/plone/app/content/browser/contents/cut.py -index ae86724..391c474 100644 ---- a/plone/app/content/browser/contents/cut.py -+++ b/plone/app/content/browser/contents/cut.py -@@ -1,3 +1,4 @@ -+# -*- coding: utf-8 -*- - from OFS.CopySupport import CopyError - from OFS.CopySupport import _cb_encode - from OFS.CopySupport import cookie_path -@@ -8,6 +9,7 @@ - from plone.app.content.browser.contents import ContentsBaseAction - from plone.app.content.interfaces import IStructureAction - from webdav.Lockable import ResourceLockedError -+from zope.i18n import translate - from zope.interface import implements - - -@@ -22,7 +24,7 @@ def __init__(self, context, request): - - def get_options(self): - return { -- 'title': _('Cut'), -+ 'title': translate(_('Cut'), context=self.request), - 'id': 'cut', - 'icon': 'scissors', - 'url': self.context.absolute_url() + '/@@fc-cut' -diff --git a/plone/app/content/browser/contents/delete.py b/plone/app/content/browser/contents/delete.py -index 806c868..b6f3f0b 100644 ---- a/plone/app/content/browser/contents/delete.py -+++ b/plone/app/content/browser/contents/delete.py -@@ -1,9 +1,11 @@ -+# -*- coding: utf-8 -*- - from AccessControl import Unauthorized - from AccessControl.Permissions import delete_objects - from Products.CMFPlone import PloneMessageFactory as _ - from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile - from plone.app.content.browser.contents import ContentsBaseAction - from plone.app.content.interfaces import IStructureAction -+from zope.i18n import translate - from zope.interface import implements - - -@@ -19,7 +21,7 @@ def __init__(self, context, request): - - def get_options(self): - return { -- 'title': _('Delete'), -+ 'title': translate(_('Delete'), context=self.request), - 'id': 'delete', - 'icon': 'trash', - 'context': 'danger', -@@ -58,4 +60,4 @@ def action(self, obj): - except Unauthorized: - self.errors.append( - _(u'You are not authorized to delete ${title}.', -- mapping={u'title': self.objectTitle(self.dest)})) -\ No newline at end of file -+ mapping={u'title': self.objectTitle(self.dest)})) -diff --git a/plone/app/content/browser/contents/paste.py b/plone/app/content/browser/contents/paste.py -index 15a42e9..32ad49f 100644 ---- a/plone/app/content/browser/contents/paste.py -+++ b/plone/app/content/browser/contents/paste.py -@@ -1,3 +1,4 @@ -+# -*- coding: utf-8 -*- - from AccessControl import Unauthorized - from OFS.CopySupport import cookie_path - from Products.CMFPlone import PloneMessageFactory as _ -@@ -5,6 +6,7 @@ - from plone.app.content.browser.contents import ContentsBaseAction - from plone.app.content.interfaces import IStructureAction - from zope.component.hooks import getSite -+from zope.i18n import translate - from zope.interface import implements - - -@@ -19,7 +21,7 @@ def __init__(self, context, request): - - def get_options(self): - return { -- 'title': _('Paste'), -+ 'title': translate(_('Paste'), context=self.request), - 'id': 'paste', - 'icon': 'paste', - 'url': self.context.absolute_url() + '/@@fc-paste' -@@ -56,4 +58,4 @@ def __call__(self): - path='%s' % cookie_path(self.request), - expires='Wed, 31-Dec-97 23:59:59 GMT') - self.request['__cp'] = None -- return self.message() -\ No newline at end of file -+ return self.message() -diff --git a/plone/app/content/browser/contents/properties.py b/plone/app/content/browser/contents/properties.py -index 037a2b7..b018327 100644 ---- a/plone/app/content/browser/contents/properties.py -+++ b/plone/app/content/browser/contents/properties.py -@@ -1,3 +1,4 @@ -+# -*- coding: utf-8 -*- - from DateTime import DateTime - from Products.CMFPlone import PloneMessageFactory as _ - from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile -@@ -5,6 +6,7 @@ - from plone.app.content.interfaces import IStructureAction - from plone.dexterity.interfaces import IDexterityContent - from zope.component.hooks import getSite -+from zope.i18n import translate - from zope.interface import implements - - -@@ -23,7 +25,7 @@ def get_options(self): - base_url = site.absolute_url() - base_vocabulary = '%s/@@getVocabulary?name=' % base_url - return { -- 'title': _('Properties'), -+ 'title': translate(_('Properties'), context=self.request), - 'id': 'properties', - 'icon': 'edit', - 'url': self.context.absolute_url() + '/@@fc-properties', -@@ -87,4 +89,4 @@ def action(self, obj): - obj.setCreators(self.creators) - if self.exclude: - obj.setExcludeFromNav(self.exclude == 'yes') -- obj.reindexObject() -\ No newline at end of file -+ obj.reindexObject() -diff --git a/plone/app/content/browser/contents/rename.py b/plone/app/content/browser/contents/rename.py -index 185587e..38806b3 100644 ---- a/plone/app/content/browser/contents/rename.py -+++ b/plone/app/content/browser/contents/rename.py -@@ -1,3 +1,4 @@ -+# -*- coding: utf-8 -*- - from AccessControl import getSecurityManager - from Acquisition import aq_inner - from Acquisition import aq_parent -@@ -7,12 +8,13 @@ - from ZODB.POSException import ConflictError - from plone.app.content.browser.contents import ContentsBaseAction - from plone.app.content.interfaces import IStructureAction --import transaction - from zope.component import getMultiAdapter - from zope.container.interfaces import INameChooser - from zope.event import notify -+from zope.i18n import translate - from zope.interface import implements - from zope.lifecycleevent import ObjectModifiedEvent -+import transaction - - - class RenameAction(object): -@@ -27,7 +29,7 @@ def __init__(self, context, request): - - def get_options(self): - return { -- 'title': _('Rename'), -+ 'title': translate(_('Rename'), context=self.request), - 'id': 'rename', - 'icon': 'random', - 'url': self.context.absolute_url() + '/@@fc-rename', -@@ -99,4 +101,4 @@ def __call__(self): - self.errors.append(_('Error renaming ${title}', mapping={ - 'title': title})) - -- return self.message(missing) -\ No newline at end of file -+ return self.message(missing) -diff --git a/plone/app/content/browser/contents/tags.py b/plone/app/content/browser/contents/tags.py -index b568cce..cf6f581 100644 ---- a/plone/app/content/browser/contents/tags.py -+++ b/plone/app/content/browser/contents/tags.py -@@ -1,8 +1,10 @@ -+# -*- coding: utf-8 -*- - from Products.CMFPlone import PloneMessageFactory as _ - from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile - from plone.app.content.browser.contents import ContentsBaseAction - from plone.app.content.interfaces import IStructureAction - from zope.component.hooks import getSite -+from zope.i18n import translate - from zope.interface import implements - - -@@ -21,7 +23,7 @@ def get_options(self): - base_url = site.absolute_url() - base_vocabulary = '%s/@@getVocabulary?name=' % base_url - return { -- 'title': _('Tags'), -+ 'title': translate(_('Tags'), context=self.request), - 'id': 'tags', - 'icon': 'tags', - 'url': self.context.absolute_url() + '/@@fc-tags', -@@ -54,4 +56,4 @@ def action(self, obj): - tags = tags - toremove - tags = tags | toadd - obj.setSubject(list(tags)) -- obj.reindexObject() -\ No newline at end of file -+ obj.reindexObject() -diff --git a/plone/app/content/browser/contents/workflow.py b/plone/app/content/browser/contents/workflow.py -index 8ab276e..d960f8b 100644 ---- a/plone/app/content/browser/contents/workflow.py -+++ b/plone/app/content/browser/contents/workflow.py -@@ -1,3 +1,4 @@ -+# -*- coding: utf-8 -*- - from DateTime import DateTime - from Products.CMFCore.interfaces._content import IFolderish - from Products.CMFCore.utils import getToolByName -@@ -6,6 +7,7 @@ - from ZODB.POSException import ConflictError - from plone.app.content.browser.contents import ContentsBaseAction - from plone.app.content.interfaces import IStructureAction -+from zope.i18n import translate - from zope.interface import implements - - -@@ -21,7 +23,7 @@ def __init__(self, context, request): - - def get_options(self): - return { -- 'title': _('State'), -+ 'title': translate(_('State'), context=self.request), - 'id': 'workflow', - 'icon': 'lock', - 'url': self.context.absolute_url() + '/@@fc-workflow', -@@ -84,4 +86,5 @@ def action(self, obj): - raise - except Exception: - self.errors.append( -- _('Could not transition: ${title}', mapping={'title': self.objectTitle(obj)})) -\ No newline at end of file -+ _('Could not transition: ${title}', -+ mapping={'title': self.objectTitle(obj)})) +diff --git a/CHANGES.rst b/CHANGES.rst +index 28729ef..931f9bf 100644 +--- a/CHANGES.rst ++++ b/CHANGES.rst +@@ -5,6 +5,8 @@ Changelog + ------------------ + + - Fix i18n of '"title" has already been deleted'. ++- When clicking cancel on the delete_confirmation got to the view_url. ++ [ale-rt] + + + 3.0.7 (2015-07-18) +diff --git a/plone/app/content/browser/actions.py b/plone/app/content/browser/actions.py +index cb95120..30d130e 100644 +--- a/plone/app/content/browser/actions.py ++++ b/plone/app/content/browser/actions.py +@@ -40,6 +40,15 @@ class DeleteConfirmationForm(form.Form, LockingBase): + template = ViewPageTemplateFile('templates/delete_confirmation.pt') + enableCSRFProtection = True + ++ def view_url(self): ++ ''' Facade to the homonymous plone_context_state method ++ ''' ++ context_state = getMultiAdapter( ++ (self.context, self.request), ++ name='plone_context_state' ++ ) ++ return context_state.view_url() ++ + @property + def items_to_delete(self): + catalog = getToolByName(self.context, 'portal_catalog') +@@ -72,7 +81,12 @@ def handle_delete(self, action): + @button.buttonAndHandler( + _(u'label_cancel', default=u'Cancel'), name='Cancel') + def handle_cancel(self, action): +- self.request.response.redirect(self.context.absolute_url()) ++ environ = self.request.environ ++ if environ.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest': ++ target = self.context.absolute_url() ++ else: ++ target = self.view_url() ++ return self.request.response.redirect(target) + + + def valid_id(self): +diff --git a/plone/app/content/tests/test_actions.py b/plone/app/content/tests/test_actions.py +index 9494341..9206fc6 100644 +--- a/plone/app/content/tests/test_actions.py ++++ b/plone/app/content/tests/test_actions.py +@@ -99,7 +99,11 @@ def test_delete_confirmation_cancel(self): + + self.browser.open(folder.absolute_url() + '/delete_confirmation') + self.browser.getControl(name='form.buttons.Cancel').click() +- self.assertEqual(self.browser.url, folder.absolute_url()) ++ context_state = getMultiAdapter( ++ (folder, self.request), ++ name='plone_context_state' ++ ) ++ self.assertEqual(self.browser.url, context_state.view_url()) + + def prepare_for_acquisition_tests(self): + """create content and an alternate authenticated browser session Repository: plone.app.content Branch: refs/heads/master -Date: 2015-07-22T16:19:46+02:00 -Author: Jens W. Klein (jensens) -Commit: https://github.com/plone/plone.app.content/commit/9b0225b12f9724ced2423754938bbac537ff357a +Date: 2015-07-22T10:41:29-05:00 +Author: Nathan Van Gheem (vangheem) +Commit: https://github.com/plone/plone.app.content/commit/bf4527cbec824a1e171f7301ff54949c8ec5ac2f -Merge pull request #40 from plone/translate_buttons +Merge pull request #41 from plone/38-fix-delete-confirmation-redirect -translate buttons +When clicking cancel on the delete_confirmation got to the view_url Files changed: -M plone/app/content/browser/contents/__init__.py -M plone/app/content/browser/contents/copy.py -M plone/app/content/browser/contents/cut.py -M plone/app/content/browser/contents/delete.py -M plone/app/content/browser/contents/paste.py -M plone/app/content/browser/contents/properties.py -M plone/app/content/browser/contents/rename.py -M plone/app/content/browser/contents/tags.py -M plone/app/content/browser/contents/workflow.py +M CHANGES.rst +M plone/app/content/browser/actions.py +M plone/app/content/tests/test_actions.py -diff --git a/plone/app/content/browser/contents/__init__.py b/plone/app/content/browser/contents/__init__.py -index 89dc0ce..22d8f8e 100644 ---- a/plone/app/content/browser/contents/__init__.py -+++ b/plone/app/content/browser/contents/__init__.py -@@ -327,4 +327,4 @@ def __call__(self): - ordering.moveObjectToPosition(brain.id, idx) - else: - self.errors.append(_(u'cannot rearrange folder')) -- return self.message() -\ No newline at end of file -+ return self.message() -diff --git a/plone/app/content/browser/contents/copy.py b/plone/app/content/browser/contents/copy.py -index e353b1d..dbb4c19 100644 ---- a/plone/app/content/browser/contents/copy.py -+++ b/plone/app/content/browser/contents/copy.py -@@ -1,3 +1,4 @@ -+# -*- coding: utf-8 -*- - from OFS.CopySupport import CopyError - from OFS.CopySupport import _cb_encode - from OFS.CopySupport import cookie_path -@@ -7,6 +8,7 @@ - from cgi import escape - from plone.app.content.browser.contents import ContentsBaseAction - from plone.app.content.interfaces import IStructureAction -+from zope.i18n import translate - from zope.interface import implements - - -@@ -21,7 +23,7 @@ def __init__(self, context, request): - - def get_options(self): - return { -- 'title': _('Copy'), -+ 'title': translate(_('Copy'), context=self.request), - 'id': 'copy', - 'icon': 'copy', - 'url': self.context.absolute_url() + '/@@fc-copy' -@@ -50,4 +52,4 @@ def finish(self): - - def __call__(self): - self.oblist = [] -- return super(CopyActionView, self).__call__() -\ No newline at end of file -+ return super(CopyActionView, self).__call__() -diff --git a/plone/app/content/browser/contents/cut.py b/plone/app/content/browser/contents/cut.py -index ae86724..391c474 100644 ---- a/plone/app/content/browser/contents/cut.py -+++ b/plone/app/content/browser/contents/cut.py -@@ -1,3 +1,4 @@ -+# -*- coding: utf-8 -*- - from OFS.CopySupport import CopyError - from OFS.CopySupport import _cb_encode - from OFS.CopySupport import cookie_path -@@ -8,6 +9,7 @@ - from plone.app.content.browser.contents import ContentsBaseAction - from plone.app.content.interfaces import IStructureAction - from webdav.Lockable import ResourceLockedError -+from zope.i18n import translate - from zope.interface import implements - - -@@ -22,7 +24,7 @@ def __init__(self, context, request): - - def get_options(self): - return { -- 'title': _('Cut'), -+ 'title': translate(_('Cut'), context=self.request), - 'id': 'cut', - 'icon': 'scissors', - 'url': self.context.absolute_url() + '/@@fc-cut' -diff --git a/plone/app/content/browser/contents/delete.py b/plone/app/content/browser/contents/delete.py -index 806c868..b6f3f0b 100644 ---- a/plone/app/content/browser/contents/delete.py -+++ b/plone/app/content/browser/contents/delete.py -@@ -1,9 +1,11 @@ -+# -*- coding: utf-8 -*- - from AccessControl import Unauthorized - from AccessControl.Permissions import delete_objects - from Products.CMFPlone import PloneMessageFactory as _ - from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile - from plone.app.content.browser.contents import ContentsBaseAction - from plone.app.content.interfaces import IStructureAction -+from zope.i18n import translate - from zope.interface import implements - - -@@ -19,7 +21,7 @@ def __init__(self, context, request): - - def get_options(self): - return { -- 'title': _('Delete'), -+ 'title': translate(_('Delete'), context=self.request), - 'id': 'delete', - 'icon': 'trash', - 'context': 'danger', -@@ -58,4 +60,4 @@ def action(self, obj): - except Unauthorized: - self.errors.append( - _(u'You are not authorized to delete ${title}.', -- mapping={u'title': self.objectTitle(self.dest)})) -\ No newline at end of file -+ mapping={u'title': self.objectTitle(self.dest)})) -diff --git a/plone/app/content/browser/contents/paste.py b/plone/app/content/browser/contents/paste.py -index 15a42e9..32ad49f 100644 ---- a/plone/app/content/browser/contents/paste.py -+++ b/plone/app/content/browser/contents/paste.py -@@ -1,3 +1,4 @@ -+# -*- coding: utf-8 -*- - from AccessControl import Unauthorized - from OFS.CopySupport import cookie_path - from Products.CMFPlone import PloneMessageFactory as _ -@@ -5,6 +6,7 @@ - from plone.app.content.browser.contents import ContentsBaseAction - from plone.app.content.interfaces import IStructureAction - from zope.component.hooks import getSite -+from zope.i18n import translate - from zope.interface import implements - - -@@ -19,7 +21,7 @@ def __init__(self, context, request): - - def get_options(self): - return { -- 'title': _('Paste'), -+ 'title': translate(_('Paste'), context=self.request), - 'id': 'paste', - 'icon': 'paste', - 'url': self.context.absolute_url() + '/@@fc-paste' -@@ -56,4 +58,4 @@ def __call__(self): - path='%s' % cookie_path(self.request), - expires='Wed, 31-Dec-97 23:59:59 GMT') - self.request['__cp'] = None -- return self.message() -\ No newline at end of file -+ return self.message() -diff --git a/plone/app/content/browser/contents/properties.py b/plone/app/content/browser/contents/properties.py -index 037a2b7..b018327 100644 ---- a/plone/app/content/browser/contents/properties.py -+++ b/plone/app/content/browser/contents/properties.py -@@ -1,3 +1,4 @@ -+# -*- coding: utf-8 -*- - from DateTime import DateTime - from Products.CMFPlone import PloneMessageFactory as _ - from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile -@@ -5,6 +6,7 @@ - from plone.app.content.interfaces import IStructureAction - from plone.dexterity.interfaces import IDexterityContent - from zope.component.hooks import getSite -+from zope.i18n import translate - from zope.interface import implements - - -@@ -23,7 +25,7 @@ def get_options(self): - base_url = site.absolute_url() - base_vocabulary = '%s/@@getVocabulary?name=' % base_url - return { -- 'title': _('Properties'), -+ 'title': translate(_('Properties'), context=self.request), - 'id': 'properties', - 'icon': 'edit', - 'url': self.context.absolute_url() + '/@@fc-properties', -@@ -87,4 +89,4 @@ def action(self, obj): - obj.setCreators(self.creators) - if self.exclude: - obj.setExcludeFromNav(self.exclude == 'yes') -- obj.reindexObject() -\ No newline at end of file -+ obj.reindexObject() -diff --git a/plone/app/content/browser/contents/rename.py b/plone/app/content/browser/contents/rename.py -index 185587e..38806b3 100644 ---- a/plone/app/content/browser/contents/rename.py -+++ b/plone/app/content/browser/contents/rename.py -@@ -1,3 +1,4 @@ -+# -*- coding: utf-8 -*- - from AccessControl import getSecurityManager - from Acquisition import aq_inner - from Acquisition import aq_parent -@@ -7,12 +8,13 @@ - from ZODB.POSException import ConflictError - from plone.app.content.browser.contents import ContentsBaseAction - from plone.app.content.interfaces import IStructureAction --import transaction - from zope.component import getMultiAdapter - from zope.container.interfaces import INameChooser - from zope.event import notify -+from zope.i18n import translate - from zope.interface import implements - from zope.lifecycleevent import ObjectModifiedEvent -+import transaction - - - class RenameAction(object): -@@ -27,7 +29,7 @@ def __init__(self, context, request): - - def get_options(self): - return { -- 'title': _('Rename'), -+ 'title': translate(_('Rename'), context=self.request), - 'id': 'rename', - 'icon': 'random', - 'url': self.context.absolute_url() + '/@@fc-rename', -@@ -99,4 +101,4 @@ def __call__(self): - self.errors.append(_('Error renaming ${title}', mapping={ - 'title': title})) - -- return self.message(missing) -\ No newline at end of file -+ return self.message(missing) -diff --git a/plone/app/content/browser/contents/tags.py b/plone/app/content/browser/contents/tags.py -index b568cce..cf6f581 100644 ---- a/plone/app/content/browser/contents/tags.py -+++ b/plone/app/content/browser/contents/tags.py -@@ -1,8 +1,10 @@ -+# -*- coding: utf-8 -*- - from Products.CMFPlone import PloneMessageFactory as _ - from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile - from plone.app.content.browser.contents import ContentsBaseAction - from plone.app.content.interfaces import IStructureAction - from zope.component.hooks import getSite -+from zope.i18n import translate - from zope.interface import implements - - -@@ -21,7 +23,7 @@ def get_options(self): - base_url = site.absolute_url() - base_vocabulary = '%s/@@getVocabulary?name=' % base_url - return { -- 'title': _('Tags'), -+ 'title': translate(_('Tags'), context=self.request), - 'id': 'tags', - 'icon': 'tags', - 'url': self.context.absolute_url() + '/@@fc-tags', -@@ -54,4 +56,4 @@ def action(self, obj): - tags = tags - toremove - tags = tags | toadd - obj.setSubject(list(tags)) -- obj.reindexObject() -\ No newline at end of file -+ obj.reindexObject() -diff --git a/plone/app/content/browser/contents/workflow.py b/plone/app/content/browser/contents/workflow.py -index 8ab276e..d960f8b 100644 ---- a/plone/app/content/browser/contents/workflow.py -+++ b/plone/app/content/browser/contents/workflow.py -@@ -1,3 +1,4 @@ -+# -*- coding: utf-8 -*- - from DateTime import DateTime - from Products.CMFCore.interfaces._content import IFolderish - from Products.CMFCore.utils import getToolByName -@@ -6,6 +7,7 @@ - from ZODB.POSException import ConflictError - from plone.app.content.browser.contents import ContentsBaseAction - from plone.app.content.interfaces import IStructureAction -+from zope.i18n import translate - from zope.interface import implements - - -@@ -21,7 +23,7 @@ def __init__(self, context, request): - - def get_options(self): - return { -- 'title': _('State'), -+ 'title': translate(_('State'), context=self.request), - 'id': 'workflow', - 'icon': 'lock', - 'url': self.context.absolute_url() + '/@@fc-workflow', -@@ -84,4 +86,5 @@ def action(self, obj): - raise - except Exception: - self.errors.append( -- _('Could not transition: ${title}', mapping={'title': self.objectTitle(obj)})) -\ No newline at end of file -+ _('Could not transition: ${title}', -+ mapping={'title': self.objectTitle(obj)})) +diff --git a/CHANGES.rst b/CHANGES.rst +index 28729ef..931f9bf 100644 +--- a/CHANGES.rst ++++ b/CHANGES.rst +@@ -5,6 +5,8 @@ Changelog + ------------------ + + - Fix i18n of '"title" has already been deleted'. ++- When clicking cancel on the delete_confirmation got to the view_url. ++ [ale-rt] + + + 3.0.7 (2015-07-18) +diff --git a/plone/app/content/browser/actions.py b/plone/app/content/browser/actions.py +index cb95120..30d130e 100644 +--- a/plone/app/content/browser/actions.py ++++ b/plone/app/content/browser/actions.py +@@ -40,6 +40,15 @@ class DeleteConfirmationForm(form.Form, LockingBase): + template = ViewPageTemplateFile('templates/delete_confirmation.pt') + enableCSRFProtection = True + ++ def view_url(self): ++ ''' Facade to the homonymous plone_context_state method ++ ''' ++ context_state = getMultiAdapter( ++ (self.context, self.request), ++ name='plone_context_state' ++ ) ++ return context_state.view_url() ++ + @property + def items_to_delete(self): + catalog = getToolByName(self.context, 'portal_catalog') +@@ -72,7 +81,12 @@ def handle_delete(self, action): + @button.buttonAndHandler( + _(u'label_cancel', default=u'Cancel'), name='Cancel') + def handle_cancel(self, action): +- self.request.response.redirect(self.context.absolute_url()) ++ environ = self.request.environ ++ if environ.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest': ++ target = self.context.absolute_url() ++ else: ++ target = self.view_url() ++ return self.request.response.redirect(target) + + + def valid_id(self): +diff --git a/plone/app/content/tests/test_actions.py b/plone/app/content/tests/test_actions.py +index 9494341..9206fc6 100644 +--- a/plone/app/content/tests/test_actions.py ++++ b/plone/app/content/tests/test_actions.py +@@ -99,7 +99,11 @@ def test_delete_confirmation_cancel(self): + + self.browser.open(folder.absolute_url() + '/delete_confirmation') + self.browser.getControl(name='form.buttons.Cancel').click() +- self.assertEqual(self.browser.url, folder.absolute_url()) ++ context_state = getMultiAdapter( ++ (folder, self.request), ++ name='plone_context_state' ++ ) ++ self.assertEqual(self.browser.url, context_state.view_url()) + + def prepare_for_acquisition_tests(self): + """create content and an alternate authenticated browser session