Esempio n. 1
0
 def __init__(self, *args):
     super(EditForm, self).__init__(*args)
     # For bungeni content, mark the request that we are in edit mode e.g. 
     # useful for when editing a question's response, but not wanting to 
     # offer option to submit the response while in response edit mode. 
     if IBungeniContent.providedBy(self.context): # and self.mode=="edit"
         interface.alsoProvides(self.request, IFormEditLayer)
Esempio n. 2
0
 def __init__(self, *args):
     super(EditForm, self).__init__(*args)
     # For bungeni content, mark the request that we are in edit mode e.g.
     # useful for when editing a question's response, but not wanting to
     # offer option to submit the response while in response edit mode.
     if IBungeniContent.providedBy(self.context):  # and self.mode=="edit"
         interface.alsoProvides(self.request, IFormEditLayer)
Esempio n. 3
0
 def getMenuItems(self, context, request):
     results = []
     _url = url.absoluteURL(context, request)
     if IBungeniContent.providedBy(context):
         doc_templates = self.documentTemplates()
         for doc_type in ["pdf", "odt"]:
             if doc_templates:
                 for template in doc_templates:
                     i18n_title = translate_i18n(globals()["i18n_%s" % doc_type])
                     results.append(dict(
                         title="%s [%s]" % (i18n_title,template.get("title")),
                         description="",
                         action="%s/%s?template=%s" % (_url, doc_type, 
                             template.get("location")),
                         selected=False,
                         extra = {
                             "id": "download-%s-%s" %(doc_type,
                                 misc.slugify(template.get("location"))
                             ),
                             "class": "download-document"
                         },
                         icon=None,
                         submenu=None
                     ))
                 
             else:
                 results.append(dict(
                     title = doc_type,
                     description=doc_type,
                     action = "%s/%s" %(_url, doc_type),
                     selected=False,
                     icon=None,
                     extra={},
                     submenu=None
                 ))
     if interfaces.IRSSRepresentationLayer.providedBy(request):
         for doc_type in ["akomantoso", "rss"]:
             results.append(dict(
                     title = globals()["i18n_%s" % doc_type],
                     description="",
                     action = "%s/feed.%s" %(_url, doc_type),
                     selected=False,
                     icon=None,
                     extra={
                         "id": "download-%s" % doc_type
                     },
                     submenu=None
             ))
     return results
Esempio n. 4
0
    def getMenuItems(self, context, request):
        results = []
        _url = url.absoluteURL(context, request)
        if IBungeniContent.providedBy(context):
            doc_templates = self.documentTemplates()
            for doc_type in ["pdf", "odt"]:
                if doc_templates:
                    for template in doc_templates:
                        i18n_title = translate_i18n(globals()["i18n_%s" %
                                                              doc_type])
                        results.append(
                            dict(title="%s [%s]" %
                                 (i18n_title, template.get("title")),
                                 description="",
                                 action="%s/%s?template=%s" %
                                 (_url, doc_type, template.get("location")),
                                 selected=False,
                                 extra={
                                     "id":
                                     "download-%s-%s" %
                                     (doc_type,
                                      misc.slugify(template.get("location"))),
                                     "class":
                                     "download-document"
                                 },
                                 icon=None,
                                 submenu=None))

                else:
                    results.append(
                        dict(title=doc_type,
                             description=doc_type,
                             action="%s/%s" % (_url, doc_type),
                             selected=False,
                             icon=None,
                             extra={},
                             submenu=None))
        if interfaces.IRSSRepresentationLayer.providedBy(request):
            for doc_type in ["akomantoso", "rss"]:
                results.append(
                    dict(title=globals()["i18n_%s" % doc_type],
                         description="",
                         action="%s/feed.%s" % (_url, doc_type),
                         selected=False,
                         icon=None,
                         extra={"id": "download-%s" % doc_type},
                         submenu=None))
        return results
Esempio n. 5
0
 def is_workflowed(self):
     """() -> bool : is this view's context a workflowed object?
     """
     return IBungeniContent.providedBy(self.context)