Exemplo n.º 1
0
    def form_name(self):
        if IVersion.providedBy(self.context):
            context = self.context.head
        else:
            context = self.context
        props = IDCDescriptiveProperties(context, None) or context

        if self.is_translation:
            language = get_language_by_name(self.context.language)["name"]
            return _(u"edit_translation_legend",
                     default=u"Editing $language translation of '$title'",
                     mapping={
                         "title": translate(props.title, context=self.request),
                         "language": language
                     })

        elif IVersion.providedBy(self.context):
            return _(u"edit_version_legend",
                     default=u'Editing "$title" (version $version)',
                     mapping={
                         "title": translate(props.title, context=self.request),
                         "version": self.context.seq
                     })
        return _(
            u"edit_item_legend",
            default=u'Editing "$title"',
            mapping={"title": translate(props.title, context=self.request)})
Exemplo n.º 2
0
    def form_name(self):
        if IVersion.providedBy(self.context):
            context = self.context.head
        else:
            context = self.context
        props = IDCDescriptiveProperties.providedBy(context) and context or IDCDescriptiveProperties(context)

        if self.is_translation:
            language = get_language_by_name(self.context.language)["name"]
            return _(
                u"edit_translation_legend",
                default=u"Editing $language translation of '$title'",
                mapping={"title": translate(props.title, context=self.request), "language": language},
            )

        elif IVersion.providedBy(self.context):
            return _(
                u"edit_version_legend",
                default=u'Editing "$title" (version $version)',
                mapping={"title": translate(props.title, context=self.request), "version": self.context.version_id},
            )

        return _(
            u"edit_item_legend",
            default=u'Editing "$title"',
            mapping={"title": translate(props.title, context=self.request)},
        )
Exemplo n.º 3
0
    def form_name(self):
        if IVersion.providedBy(self.context):
            context = self.context.head

        props = IDCDescriptiveProperties.providedBy(context) \
                and context or IDCDescriptiveProperties(context)

        if self.is_translation:
            language = get_language_by_name(self.context.language)['name']
            return _(u"edit_translation_legend",
                     default=u'Editing $language translation of "$title"',
                     mapping={
                         'title': translate(props.title, context=self.request),
                         'language': language
                     })

        elif IVersion.providedBy(self.context):
            return _(u"edit_version_legend",
                     default=u'Editing "$title" (version $version)',
                     mapping={
                         'title': translate(props.title, context=self.request),
                         'version': self.context.version_id
                     })

        return _(
            u"edit_item_legend",
            default=u'Editing "$title"',
            mapping={'title': translate(props.title, context=self.request)})
Exemplo n.º 4
0
    def getMenuItems(self, context, request):
        """Return menu item entries in a TAL-friendly form."""
        if (not interfaces.IWorkspaceOrAdminSectionLayer.providedBy(request) or
            interfaces.IFormEditLayer.providedBy(request) or
            IVersion.providedBy(context)
        ):
            return ()
        #!+wfc.workflow
        wf = IWorkflow(context, None)
        if wf is None:
            return ()
        #state = IWorkflowController(context).state_controller.get_status()
        wfc = IWorkflowController(context)
        wf = wfc.workflow  # !+wfc.workflow
        tids = wfc.getManualTransitionIds()

        parliament_id = getCurrentParliamentId()
        _url = url.absoluteURL(context, request)
        site_url2 = url.absoluteURL(getSite(), request)
        results = []
        for tid in tids:
            state_transition = wf.get_transition(tid)
            #Compares the current url to homepage to determine whether
            #we are on workspace or not.
            #Fix for bug 319
            #Someone should probably review this.
            if _url == site_url2:
                transition_url = site_url2 + \
                             "/archive/browse/parliaments/obj-" + \
                             str(parliament_id) + \
                             "/change_workflow_state?" + \
                             "transition=%s&next_url=..." % tid
            else:
                transition_url = _url + \
                             "/change_workflow_state?"\
                             "transition=%s&next_url=..." % tid
            extra = {"id": "workflow-transition-%s" % tid,
                     "separator": None,
                     "class": ""}
            state_title = translate(str(state_transition.title),
                    domain="bungeni",
                    context=request)
            results.append(
                dict(title=state_title,
                     description="",
                     action=transition_url,
                     selected=False,
                     transition_id=tid,
                     icon=None,
                     extra=extra,
                     submenu=None))

        return results
Exemplo n.º 5
0
    def form_name(self):
        if IVersion.providedBy(self.context):
            context = self.context.head

        props = IDCDescriptiveProperties.providedBy(context) \
                and context or IDCDescriptiveProperties(context)

        if self.is_translation:
            language = get_language_by_name(self.context.language)['name']
            return _(u"edit_translation_legend",
                     default=u'Editing $language translation of "$title"',
                     mapping={'title': translate(props.title, context=self.request),
                              'language': language})
        
        elif IVersion.providedBy(self.context):
            return _(u"edit_version_legend",
                     default=u'Editing "$title" (version $version)',
                     mapping={'title': translate(props.title, context=self.request),
                              'version': self.context.version_id})

        return _(u"edit_item_legend", default=u'Editing "$title"',
                 mapping={'title': translate(props.title, context=self.request)})
Exemplo n.º 6
0
    def getMenuItems(self, context, request):
        """Return menu item entries in a TAL-friendly form.
        !+TAL-friendly(mr, sep-2011) means what?
        """
        if (not interfaces.IWorkspaceOrAdminSectionLayer.providedBy(request)
                or interfaces.IFormEditLayer.providedBy(request)
                or IVersion.providedBy(context)):
            return ()
        #!+wfc.workflow
        wf = IWorkflow(context, None)
        if wf is None:
            return ()
        #state = IWorkflowController(context).state_controller.get_status()
        wfc = IWorkflowController(context)
        wf = wfc.workflow
        tids = wfc.getManualTransitionIds()

        _url = url.absoluteURL(context, request)
        results = []
        for tid in tids:
            transit_url = \
                "%s/change_workflow_state?transition_id=%s&next_url=..." % (
                    _url, tid)
            extra = {
                "id": "workflow-transition-%s" % tid,
                "separator": None,
                "class": ""
            }
            state_title = translate(str(wf.get_transition(tid).title),
                                    domain="bungeni",
                                    context=request)
            results.append(
                dict(title=state_title,
                     description="",
                     action=transit_url,
                     selected=False,
                     transition_id=tid,
                     icon=None,
                     extra=extra,
                     submenu=None))
        return results
Exemplo n.º 7
0
 def getMenuItems(self, context, request):
     """Return menu item entries in a TAL-friendly form.
     !+TAL-friendly(mr, sep-2011) means what?
     """
     if (not interfaces.IWorkspaceOrAdminSectionLayer.providedBy(request) or
             interfaces.IFormEditLayer.providedBy(request) or
             IVersion.providedBy(context)
         ):
         return ()
     #!+wfc.workflow
     wf = IWorkflow(context, None)
     if wf is None:
         return ()
     #state = IWorkflowController(context).state_controller.get_status()
     wfc = IWorkflowController(context)
     wf = wfc.workflow
     tids = wfc.getManualTransitionIds()
     
     _url = url.absoluteURL(context, request)
     results = []
     for tid in tids:
         transit_url = ("%s/change_workflow_state?transition_id=%s&"
             "next_url=./workflow-redirect" % (_url, tid)
         )
         extra = {"id": "workflow-transition-%s" % tid,
                  "separator": None,
                  "class": ""}
         state_title = translate(wf.get_transition(tid).title,
             domain="bungeni",
             context=request)
         results.append(
             dict(title=state_title,
                  description="",
                  action=transit_url,
                  selected=False,
                  transition_id=tid,
                  icon=None,
                  extra=extra,
                  submenu=None))
     return results
Exemplo n.º 8
0
def is_translation(context):
    return IVersion.providedBy(context) and \
           context.status in (u"draft_translation",)
Exemplo n.º 9
0
def is_translation(context):
    return IVersion.providedBy(context) and \
           context.status in (u"draft-translation",)