add action to send a version via docbow (#4132)
This commit is contained in:
parent
eaa2374669
commit
9f04c7e537
|
@ -5,7 +5,7 @@ from zope.i18nmessageid import MessageFactory
|
|||
|
||||
_ = MessageFactory('pfwbged.policy')
|
||||
|
||||
POOL_SIZE = 1000
|
||||
POOL_SIZE = 10
|
||||
|
||||
|
||||
def initialize(context):
|
||||
|
|
|
@ -50,6 +50,13 @@
|
|||
permission="zope2.View"
|
||||
/>
|
||||
|
||||
<browser:page
|
||||
name="send_with_docbow"
|
||||
for="collective.dms.basecontent.dmsfile.IDmsFile"
|
||||
class=".send_with_docbow.SendWithDocbowView"
|
||||
permission="zope2.View"
|
||||
/>
|
||||
|
||||
<!-- Custom comments viewlet for IBaseTask -->
|
||||
<browser:viewlet
|
||||
name="plone.comments"
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
|
||||
import logging
|
||||
import urllib
|
||||
|
||||
from zope.interface import Interface
|
||||
from zope import schema
|
||||
|
||||
from plone.z3cform.layout import FormWrapper
|
||||
from Products.Five.browser import BrowserView
|
||||
from Products.CMFCore.utils import getToolByName
|
||||
|
||||
from plone import api
|
||||
|
||||
class SendWithDocbowView(BrowserView):
|
||||
def __call__(self):
|
||||
version_url = self.context.absolute_url()
|
||||
if 'test.pfwb.be' in version_url:
|
||||
docbow = 'https://test-secure.pfwb.be'
|
||||
else:
|
||||
docbow = 'https://secure.pfwb.be'
|
||||
docbow += '/send_file/?url=' + urllib.quote(version_url + '/@@download')
|
||||
self.request.response.redirect(docbow)
|
|
@ -1,8 +1,8 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: pfwbged.policy\n"
|
||||
"POT-Creation-Date: 2014-10-10 13:29+0000\n"
|
||||
"PO-Revision-Date: 2014-10-10 15:31+0200\n"
|
||||
"POT-Creation-Date: 2014-10-20 14:13+0000\n"
|
||||
"PO-Revision-Date: 2014-10-20 16:14+0200\n"
|
||||
"Last-Translator: Frederic Peters <fpeters@entrouvert.com>\n"
|
||||
"Language-Team: --\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
|
@ -15,7 +15,7 @@ msgstr ""
|
|||
"Domain: pfwbged.policy\n"
|
||||
"X-Generator: Poedit 1.5.4\n"
|
||||
|
||||
#: ../menu.py:204
|
||||
#: ../menu.py:216
|
||||
msgid "${action} the version ${version}"
|
||||
msgstr "${action} la version ${version}"
|
||||
|
||||
|
@ -35,11 +35,11 @@ msgstr "Une demande de validation a été refusée."
|
|||
msgid "Accept refusal"
|
||||
msgstr "Accepter la désattribution"
|
||||
|
||||
#: ../menu.py:101
|
||||
#: ../menu.py:102
|
||||
msgid "Actions"
|
||||
msgstr "Actions"
|
||||
|
||||
#: ../menu.py:287
|
||||
#: ../menu.py:299
|
||||
msgid "Add ${title}"
|
||||
msgstr "Ajouter ${title}"
|
||||
|
||||
|
@ -87,7 +87,7 @@ msgstr "Note"
|
|||
msgid "Create a new version"
|
||||
msgstr "Créer une nouvelle version"
|
||||
|
||||
#: ../menu.py:400
|
||||
#: ../menu.py:413
|
||||
msgid "Create signed version for version ${version}"
|
||||
msgstr "Créer la version signée pour la version ${version}"
|
||||
|
||||
|
@ -127,7 +127,7 @@ msgstr "Finaliser la version ${version}"
|
|||
msgid "Folders"
|
||||
msgstr "Dossiers"
|
||||
|
||||
#: ../menu.py:182
|
||||
#: ../menu.py:194
|
||||
msgid "Mark document as read"
|
||||
msgstr "Marquer le document comme lu"
|
||||
|
||||
|
@ -179,16 +179,16 @@ msgstr "Refuser la version ${version}"
|
|||
msgid "Render opinion"
|
||||
msgstr "Rendre un avis"
|
||||
|
||||
#: ../menu.py:189
|
||||
#: ../menu.py:201
|
||||
msgid "Return opinion about ${version}"
|
||||
msgstr "Rendre un avis sur la version ${version}"
|
||||
|
||||
#: ../browser/to_process.py:46
|
||||
#: ../menu.py:504
|
||||
#: ../menu.py:517
|
||||
msgid "Save"
|
||||
msgstr "Enregistrer"
|
||||
|
||||
#: ../menu.py:513
|
||||
#: ../menu.py:526
|
||||
msgid "Save As..."
|
||||
msgstr "Enregistrer sous…"
|
||||
|
||||
|
@ -204,6 +204,10 @@ msgstr "Transmettre pour information"
|
|||
msgid "Send version ${version} by email"
|
||||
msgstr "Envoyer la version ${version} par email"
|
||||
|
||||
#: ../menu.py:54
|
||||
msgid "Send version ${version} with PES"
|
||||
msgstr "Envoyer la version ${version} avec la PES"
|
||||
|
||||
#: ../browser/send_by_email.py:30
|
||||
msgid "Subject"
|
||||
msgstr "Objet"
|
||||
|
@ -216,7 +220,7 @@ msgstr "Vue tâches"
|
|||
msgid "Title: %s"
|
||||
msgstr "Titre : %s"
|
||||
|
||||
#: ../menu.py:139
|
||||
#: ../menu.py:140
|
||||
msgid "To process (with comment)"
|
||||
msgstr "À traiter (avec commentaire)"
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import sys, time
|
||||
|
||||
from Acquisition import aq_inner, aq_parent
|
||||
from five import grok
|
||||
from zc.relation.interfaces import ICatalog
|
||||
|
@ -49,6 +51,7 @@ dmsfile_wfactions_mapping = {'ask_opinion': _(u"Ask opinion about version ${vers
|
|||
'finish': _(u"Finish version ${version}"),
|
||||
'finish_without_validation': _(u"Validate and finish version ${version}"),
|
||||
'send_by_email': _(u"Send version ${version} by email"),
|
||||
'send_with_docbow': _(u"Send version ${version} with PES"),
|
||||
}
|
||||
|
||||
|
||||
|
@ -147,6 +150,17 @@ class CustomMenu(menu.WorkflowMenu):
|
|||
'title': 'Send by email',
|
||||
'url': context.absolute_url() + '/@@send_by_email',
|
||||
'icon': None})
|
||||
if request.cookies.get('docbow-user') == 'true':
|
||||
workflowActions.append(
|
||||
{'available': True,
|
||||
'visible': True,
|
||||
'allowed': True,
|
||||
'link_target': None,
|
||||
'id': 'send_with_docbow',
|
||||
'category': 'workflow',
|
||||
'title': 'Send by email',
|
||||
'url': context.absolute_url() + '/@@send_with_docbow',
|
||||
'icon': None})
|
||||
|
||||
for action in workflowActions:
|
||||
if action['category'] != 'workflow':
|
||||
|
@ -363,7 +377,8 @@ class CustomMenu(menu.WorkflowMenu):
|
|||
category='object_buttons',
|
||||
max=-1)
|
||||
editActions = [action for action in _editActions if
|
||||
action['id'] not in ('create_outgoing_mail', 'send_by_email') or (
|
||||
action['id'] not in ('create_outgoing_mail',
|
||||
'send_by_email', 'send_with_docbow') or (
|
||||
is_linked_to_an_incoming_mail(context) and not outgoingmail_created(context))]
|
||||
|
||||
else:
|
||||
|
@ -444,6 +459,8 @@ class CustomMenu(menu.WorkflowMenu):
|
|||
return actions
|
||||
|
||||
def getMenuItems(self, context, request):
|
||||
t0 = time.time()
|
||||
print >> sys.stderr, time.time(), 'getmenuitems'
|
||||
actions = []
|
||||
actions.extend(self.getWorkflowActionsForObject(context, request))
|
||||
|
||||
|
@ -513,4 +530,5 @@ class CustomMenu(menu.WorkflowMenu):
|
|||
if not action.get('icon'):
|
||||
action['extra']['class'] += ' no-icon'
|
||||
|
||||
print >> sys.stderr, time.time(), 'getmenuitems -- end (%.2f)' % (time.time()-t0)
|
||||
return actions
|
||||
|
|
Reference in New Issue