예제 #1
0
 def description(self):
     session = Session()
     context = session.merge(removeSecurityProxy(self.context))
     text = "%s %s %s" % (translate_i18n(_(u"Submitted by")), context.owner.first_name, context.owner.last_name)
     if context.notice_date:
         text += " (%s %s)" % (translate_i18n(_(u"notice given on")), self.formatDate(context.notice_date))
     return text + "."
예제 #2
0
 def calendar_js_globals(self):
     limit_start = ISchedulingContext(self.context).start_date
     limit_end = ISchedulingContext(self.context).end_date
     cal_globals = dict(
         limit_start=limit_start.isoformat() if limit_start else None,
         limit_end=limit_end.isoformat() if limit_end else None,
         ical_url=self.ical_url,
         required_fields=[
             field.field.getName()
             for field in self.partial_event_form.form_fields
             if field.field.required
         ],
         view_url=self.url,
         venues_view_title=translate_i18n(TITLE_VENUES_VIEW),
         text_group=translate_i18n(FIELD_GROUP),
         text_start_date=translate_i18n(FIELD_START_DATE),
         text_end_date=translate_i18n(FIELD_END_DATE),
         text_venue=translate_i18n(FIELD_VENUE),
         text_activity_type=translate_i18n(_(u"Activity Type")),
         text_meeting_type=translate_i18n(_(u"Meeting Type")),
         text_convocation_type=translate_i18n(_(u"Convocation Type")),
         text_sitting=translate_i18n(TITLE_SITTING),
         text_view=translate_i18n(ACTION_VIEW_SITTING),
         error_messages=dict(
             default=_(u"Please check the highlighted sittings. "
                       "Failed to apply changes"),
             updated=_(u"Please review the highlighted sittings."
                       " Could not apply changes."),
             deleted=_(u"Please review the highlighted events."
                       " Could not be deleted.")))
     return """var cal_globals = %s;
         var timeline_data = { venues: %s, combined: %s };
         var group_urls= %s;""" % (
         json.dumps(cal_globals), json.dumps(self.venues_data),
         json.dumps(self.groups_data), json.dumps(self.calendar_urls()))
예제 #3
0
 def calendar_js_globals(self):
     cal_globals = dict(
         ical_url=self.ical_url,
         required_fields=[field.field.getName() 
             for field in self.partial_event_form.form_fields
             if field.field.required
         ],
         view_url=self.url,
         venues_view_title=translate_i18n(TITLE_VENUES_VIEW),
         text_group=translate_i18n(FIELD_GROUP),
         text_start_date=translate_i18n(FIELD_START_DATE),
         text_end_date=translate_i18n(FIELD_END_DATE),
         text_venue=translate_i18n(FIELD_VENUE),
         text_activity_type=translate_i18n(_(u"Activity Type")),
         text_meeting_type=translate_i18n(_(u"Meeting Type")),
         text_convocation_type=translate_i18n(_(u"Convocation Type")),
         text_sitting=translate_i18n(TITLE_SITTING),
         text_view=translate_i18n(ACTION_VIEW_SITTING),
         error_messages=dict(
             default=_(u"Please check the highlighted sittings. " 
                 "Failed to apply changes"),
             updated=_(u"Please review the highlighted sittings." 
                 " Could not apply changes."),
             deleted=_(u"Please review the highlighted events."
                 " Could not be deleted.")
         )
     )
     return """var cal_globals = %s;
         var timeline_data = { venues: %s, committees: %s };
         var group_urls= %s;""" %(
         json.dumps(cal_globals), 
         json.dumps(self.venues_data),
         json.dumps(self.groups_data),
         json.dumps(self.calendar_urls())
     )
예제 #4
0
 def description(self):
     context = _merged(self.context)
     text = "%s %s %s" % (translate_i18n(_(u"Submitted by")),
                          context.owner.first_name, context.owner.last_name)
     if context.notice_date:
         text += " (%s %s)" % (translate_i18n(
             _(u"notice given on")), self.formatDate(context.notice_date))
     return text + "."
예제 #5
0
 def description(self):
     context = _merged(self.context)
     text = "%s %s %s" % (translate_i18n(_("Submitted by")), context.owner.first_name, context.owner.last_name)
     if context.group:
         text += " to %s" % IDCDescriptiveProperties(context.group).title
     if context.admissible_date:
         text += " (%s %s)" % (translate_i18n(_(u"Approved on")), self.formatDate(context.admissible_date))
     return text + "."
예제 #6
0
 def description(self):
     context = _merged(self.context)
     text = "%s %s %s" % (translate_i18n(_("Submitted by")),
                          context.owner.first_name, context.owner.last_name)
     if context.publication_date:
         text += " (%s %s)" % (translate_i18n(
             _(u"published on")), self.formatDate(context.publication_date))
     return text + "."
예제 #7
0
 def description(self):
     session = Session()
     context = session.merge(removeSecurityProxy(self.context))
     text = "%s %s %s" % (translate_i18n(_(u"Submitted by")),
                          context.owner.first_name, context.owner.last_name)
     if context.notice_date:
         text += " (%s %s)" % (translate_i18n(
             _(u"notice given on")), self.formatDate(context.notice_date))
     return text + "."
예제 #8
0
 def description(self):
     context = _merged(self.context)
     text = "%s %s %s" % (translate_i18n(_("Submitted by")),
                          context.owner.first_name, context.owner.last_name)
     if context.group:
         text += " to %s" % IDCDescriptiveProperties(context.group).title
     if context.admissible_date:
         text += " (%s %s)" % (translate_i18n(
             _(u"Approved on")), self.formatDate(context.admissible_date))
     return text + "."
예제 #9
0
 def verbose_title(self):
     context = _merged(self.context)
     sitting_title = _(
         "verbose_sitting_title",
         default=u"Sitting of ${group_name} @ ${sitting_venue}",
         mapping={
             "group_name":
             IDCDescriptiveProperties(context.group).title,
             "sitting_venue":
             (IDCDescriptiveProperties(context.venue).title
              if context.venue else translate_i18n(_(u"no venue")))
         })
     return translate_i18n(sitting_title)
예제 #10
0
파일: dc.py 프로젝트: gelie/bungeni_src
 def verbose_title(self):
     context = _merged(self.context)
     sitting_title = _("verbose_sitting_title", 
         default=u"Sitting of ${group_name} @ ${sitting_venue}",
         mapping = {
             "group_name": IDCDescriptiveProperties(context.group).title,
             "sitting_venue": (
                 IDCDescriptiveProperties(context.venue).title 
                 if context.venue else translate_i18n(_(u"no venue"))
             )
         }
     )
     return translate_i18n(sitting_title)
예제 #11
0
 def add_wf_meta(enum):
     index, item = enum
     node = nodes[index]
     wfc = IWorkflowController(node.item, None)
     if wfc is None:
         return
     #!+SCHEDULING_FILTERS(mb, mar-2012) Find a more elegant way to do this
     # perhaps as a workflow feature
     if not len(wfc.workflow.get_state_ids(keys=["draft"], restrict=False)):
         return
     item["wf_state"] = translate_i18n(wfc.state_controller.get_state().title)
     item["wf_actions"] = [
         dict(value=transition, text=translate_i18n(wfc.workflow.get_transition(transition).title))
         for transition in wfc.getFireableTransitionIds()
     ]
예제 #12
0
파일: dc.py 프로젝트: gelie/bungeni_src
 def title(self):
     context = _merged(self.context)
     return "%s %s, %s %s %s" % (translate_i18n(_(u"Debate Record:")), 
             self.translate(context.sitting, "short_name"), 
             context.sitting.start_date.strftime('%Y-%m-%d, %H:%M'), 
             _(u"to"), 
             context.sitting.end_date.strftime('%H:%M'))
예제 #13
0
파일: dc.py 프로젝트: gelie/bungeni_src
 def description(self):
     context = _merged(self.context)
     return "%s %s (%s %s %s)" % (translate_i18n(_(u"Debate record of ")),
             self.translate(context.sitting, "short_name"),
             context.sitting.start_date.strftime('%Y-%m-%d %H:%M'), 
             _(u"to"),
             context.sitting.end_date.strftime('%H:%M'))
예제 #14
0
 def process_document_tree(root, context):
     """Iterate and optionally update children of provided root node.
     
     Rendering is based on type of node. Further calls to this function
     happen when a node with children exists - and so on.
     
     Only nodes with the bungeni namespace tags "br:type" are modified
     with content from the provided context.
     """
     iter_children = root.getchildren() or [root]
     if not (root in iter_children):
         root_typ = get_attr(root, "type")
         if root_typ:
             process_single_node(root, context, root_typ,
                                 get_attr(root, "source"))
     for child in iter_children:
         typ = get_attr(child, "type")
         src = get_attr(child, "source")
         children = child.getchildren()
         if len(children) == 0:
             if typ:
                 process_single_node(child, context, typ, src)
         else:
             if typ:
                 if typ == "listing":
                     clean_element(child)
                     children = child.getchildren()
                     listing = get_element_value(context,
                                                 src,
                                                 default=[])
                     if IAlchemistContainer.providedBy(listing):
                         listing = [
                             item for item in
                             common.list_container_items(listing)
                         ]
                     len_listing = len(listing)
                     expanded_children = [
                         deepcopy(children) for x in range(len_listing)
                     ]
                     empty_element(child)
                     if len(listing) == 0:
                         no_items_tag = "p"
                         if child.tag == "tr":
                             no_items_tag = "td"
                         no_items_node = etree.SubElement(
                             child, no_items_tag)
                         no_items_node.text = translate_i18n(
                             _(u"No items found"))
                     else:
                         for (index, item) in enumerate(listing):
                             for inner_element in expanded_children[
                                     index]:
                                 iroot = process_document_tree(
                                     inner_element, item)
                                 child.append(iroot)
                 else:
                     process_document_tree(child, context)
             else:
                 process_document_tree(child, context)
     return root
def get_listings(context, request, sub_container_name=""):
    trusted = removeSecurityProxy(context)    
    if hasattr(trusted, sub_container_name):
        sub_container = removeSecurityProxy(
            getattr(trusted, sub_container_name)
        )
        #!+DESCRIPTOR_LOOKUP(murithi, jul-2011) descriptor lookup fails in 
        # testing - as at r8474 : use sub_container_name as title
        #table_title = (CONTAINER_TITLES.get(sub_container_name, None) or 
        #    IDCDescriptiveProperties(sub_container).title
        #)
        table_title = sub_container_name
        columns = [
            LinkColumn("title", lambda i,f:IDCDescriptiveProperties(i).title),
        ]
        for extra_col in EXTRA_COLUMNS.get(sub_container_name, []):
            columns.append(column.GetterColumn(extra_col, 
                    lambda i,f:getattr(IDCDescriptiveProperties(i), extra_col)
                )
            )
        if hasattr(sub_container, "values"):
            items = [ removeSecurityProxy(it) for it in sub_container.values() ]
        else:
            items = [ removeSecurityProxy(it) for it in sub_container ]
        if not len(items):
            return u""
        formatter = SimpleContainerListing(context, request, items,
            columns=columns
        )
        return formatter(translate_i18n(table_title))
    else:
        return u""
예제 #16
0
 def description(self):
     session = Session()
     context = session.merge(removeSecurityProxy(self.context))
     return u"%s %s to %s" % (translate_i18n(_(u"Covers")), 
         context.start_date.strftime('%Y-%m-%d'),
         context.end_date.strftime('%Y-%m-%d')
     )
예제 #17
0
 def title(self):
     context = _merged(self.context)
     return "%s %s, %s %s %s" % (
         translate_i18n(_(u"Debate Record:")),
         self.translate(context.sitting, "short_name"),
         context.sitting.start_date.strftime('%Y-%m-%d, %H:%M'), _(u"to"),
         context.sitting.end_date.strftime('%H:%M'))
예제 #18
0
 def process_document_tree(root, context):
     """Iterate and optionally update children of provided root node.
     
     Rendering is based on type of node. Further calls to this function
     happen when a node with children exists - and so on.
     
     Only nodes with the bungeni namespace tags "br:type" are modified
     with content from the provided context.
     """
     cond = get_attr(root, "condition")
     if cond and not check_exists(context, cond):
         return None
     iter_children = root.getchildren() or [root]
     if not (root in iter_children):
         root_typ = get_attr(root, "type")
         if root_typ:
             process_single_node(root, context, root_typ, get_attr(root, "source"))
     for child in iter_children:
         typ = get_attr(child, "type")
         src = get_attr(child, "source")
         cond = get_attr(child, "condition")
         if cond and not check_exists(context, cond):
             drop_element(child)
             continue
         children = child.getchildren()
         if len(children) == 0:
             if typ:
                 process_single_node(child, context, typ, src)
         else:
             if typ:
                 if typ == "listing":
                     clean_element(child)
                     children = child.getchildren()
                     listing = get_element_value(context, src, default=[])
                     if IAlchemistContainer.providedBy(listing):
                         listing = [item for item in common.list_container_items(listing)]
                     len_listing = len(listing)
                     expanded_children = [deepcopy(children) for x in range(len_listing)]
                     empty_element(child)
                     if len(listing) == 0:
                         no_items_tag = "p"
                         if child.tag == "tr":
                             no_items_tag = "td"
                         no_items_node = etree.SubElement(child, no_items_tag)
                         no_items_node.text = translate_i18n(_(u"No items found"))
                     else:
                         for (index, item) in enumerate(listing):
                             for inner_element in expanded_children[index]:
                                 iroot = process_document_tree(inner_element, item)
                                 if iroot is not None:
                                     child.append(iroot)
                 elif typ == "block" and src:
                     block_context = get_element_value(context, src, default=None)
                     process_document_tree(child, block_context)
                 else:
                     process_document_tree(child, context)
             else:
                 process_document_tree(child, context)
     clean_element(root)
     return root
예제 #19
0
 def description(self):
     context = _merged(self.context)
     return "%s %s (%s %s %s)" % (
         translate_i18n(_(u"Debate record of ")),
         self.translate(context.sitting, "short_name"),
         context.sitting.start_date.strftime('%Y-%m-%d %H:%M'), _(u"to"),
         context.sitting.end_date.strftime('%H:%M'))
예제 #20
0
 def description(self):
     context = _merged(self.context)
     return "%s %s (%s %s %s)" % (
         translate_i18n(_(u"Sitting scheduled for")),
         self.translate(context.group, "short_name"),
         context.start_date.strftime('%Y-%m-%d %H:%M'), _(u"to"),
         context.end_date.strftime('%H:%M'))
예제 #21
0
파일: dc.py 프로젝트: gelie/bungeni_src
 def description(self):
     context = _merged(self.context)
     return "%s %s (%s %s %s)" % (translate_i18n(_(u"Sitting scheduled for")),
             self.translate(context.group, "short_name"),
             context.start_date.strftime('%Y-%m-%d %H:%M'), 
             _(u"to"),
             context.end_date.strftime('%H:%M'))
예제 #22
0
def get_listings(context, request, sub_container_name=""):
    trusted = removeSecurityProxy(context)
    if hasattr(trusted, sub_container_name):
        sub_container = removeSecurityProxy(
            getattr(trusted, sub_container_name))
        #!+DESCRIPTOR_LOOKUP(murithi, jul-2011) descriptor lookup fails in
        # testing - as at r8474 : use sub_container_name as title
        #table_title = (CONTAINER_TITLES.get(sub_container_name, None) or
        #    IDCDescriptiveProperties(sub_container).title
        #)
        table_title = sub_container_name
        columns = [
            LinkColumn("title",
                       lambda i, f: IDCDescriptiveProperties(i).title),
        ]
        for extra_col in EXTRA_COLUMNS.get(sub_container_name, []):
            columns.append(
                column.GetterColumn(
                    extra_col, lambda i, f: getattr(
                        IDCDescriptiveProperties(i), extra_col)))
        if hasattr(sub_container, "values"):
            items = [removeSecurityProxy(it) for it in sub_container.values()]
        else:
            items = [removeSecurityProxy(it) for it in sub_container]
        if not len(items):
            return u""
        formatter = SimpleContainerListing(context,
                                           request,
                                           items,
                                           columns=columns)
        return formatter(translate_i18n(table_title))
    else:
        return u""
예제 #23
0
 def description(self):
     session = Session()
     context = session.merge(removeSecurityProxy(self.context))
     return "%s %s (%s %s %s)" % (
         translate_i18n(_(u"Sitting scheduled for")),
         self.translate(context.group, "short_name"),
         context.start_date.strftime('%Y-%m-%d %H:%M'), _(u"to"),
         context.end_date.strftime('%H:%M'))
예제 #24
0
 def title(self):
     session = Session()
     context = session.merge(removeSecurityProxy(self.context))
     return "%s %s, %s %s %s" % (
         translate_i18n(
             _(u"Sitting:")), self.translate(context.group, "short_name"),
         context.start_date.strftime('%Y-%m-%d, %H:%M'), _(u"to"),
         context.end_date.strftime('%H:%M'))
예제 #25
0
 def title(self):
     session = Session()
     context = session.merge(removeSecurityProxy(self.context))
     return "%s %s, %s %s %s" % (translate_i18n(_(u"Sitting:")), 
             self.translate(context.group, "short_name"), 
             context.start_date.strftime('%Y-%m-%d, %H:%M'), 
             _(u"to"), 
             context.end_date.strftime('%H:%M'))
예제 #26
0
 def description(self):
     session = Session()
     context = session.merge(removeSecurityProxy(self.context))
     return "%s %s (%s %s %s)" % (translate_i18n(_(u"Sitting scheduled for")),
             self.translate(context.group, "short_name"),
             context.start_date.strftime('%Y-%m-%d %H:%M'), 
             _(u"to"),
             context.end_date.strftime('%H:%M'))
예제 #27
0
 def generate_tree(root, context):
     for element in root.getiterator():
         typ = get_attr(element, "type")
         src = get_attr(element, "source")
         if typ:
             if typ=="text":
                 clean_element(element)
                 element.text = get_element_value(context, src)
             elif typ=="link":
                 clean_element(element)
                 url_source = get_attr(element, "url")
                 if url_source:
                     link_url = get_element_value(context, url_source)
                 else:
                     link_url = url.absoluteURL(context, 
                         common.get_request()
                     )
                 element.attrib["href"] = link_url
                 if src:
                     element.text = get_element_value(context, src)
             elif typ=="html":
                 clean_element(element)
                 _html = u"<div>%s</div>" % get_element_value(context, 
                     src
                 )
                 new_html = element.insert(0, etree.fromstring(_html))
             elif typ=="listing":
                 listing = get_element_value(context, src, default=[])
                 
                 if IAlchemistContainer.providedBy(listing):
                     _listing = common.list_container_items(listing)
                     listing = [ item for item in _listing ]
                 
                 log.debug("[LISTING] %s @@ %s", src, listing)
                 listing_count = len(listing)
                 new_children = [
                     deepcopy(element.getchildren()) 
                     for x in range(listing_count) 
                 ]
                 empty_element(element)
                 clean_element(element)
                 
                 if listing_count == 0:
                     parent = element.getparent()
                     no_items_element = etree.SubElement(element, "p")
                     no_items_element.text = translate_i18n(
                         _(u"No items found")
                     )
                 else:
                     for (index, item) in enumerate(listing):
                         for child in new_children[index]:
                             generate_tree(child, item)
                     for children in new_children:
                         for descendant in children:
                             element.append(descendant)
                 break
     return etree.tostring(root)
예제 #28
0
 def title(self):
     context = _merged(self.context)
     return "%s %s, %s %s %s" % (
         translate_i18n(_(u"Sitting:")),
         self.translate(context.group, "short_name"),
         context.start_date.strftime("%Y-%m-%d, %H:%M"),
         _(u"to"),
         context.end_date.strftime("%H:%M"),
     )
예제 #29
0
 def calendar_js_globals(self):
     cal_globals = dict(
         ical_url=self.ical_url,
         view_url=self.url,
         venues_view_title=translate_i18n(_(u"Venues")),
         text_group=translate_i18n(_(u"Group")),
         text_start_date=translate_i18n(_(u"Start Date")),
         text_end_date=translate_i18n(_(u"End Date")),
         text_venue=translate_i18n(_(u"Venue")),
         text_activity_type=translate_i18n(_(u"Activity Type")),
         text_meeting_type=translate_i18n(_(u"Meeting Type")),
         text_convocation_type=translate_i18n(_(u"Convocation Type")),
         text_sitting=translate_i18n(_(u"Sitting")),
     )
     return """var cal_globals = %s;var venues_data=%s;""" % (json.dumps(cal_globals), json.dumps(self.venues_data))
예제 #30
0
 def add_wf_meta(enum):
     index, item = enum
     node = nodes[index]
     item["item_id"] = node.item_id
     if model_interfaces.IScheduleText.providedBy(node.item):
         return
     if not include_wf:
         return
     wfc = IWorkflowController(node.item, None)
     if wfc is None:
         return
     item["wf_state"] = translate_i18n(
         wfc.state_controller.get_state().title)
     item["wf_actions"] = [
         dict(value=transition,
              text=translate_i18n(
                  wfc.workflow.get_transition(transition).title))
         for transition in wfc.getFireableTransitionIds()
     ]
예제 #31
0
def format_change_description(change):
    """Format/i18n a document's change object description for timeline listing
    """
    description = change.description
    if change.action == "new-version":
        version = change.origin.versions.get(
            int(change.extras.get("version_id")))
        chg_url = url.absoluteURL(version, common.get_request())
        if chg_url:
            description = "<a href='%s'>%s</a>" % (chg_url, (translate_i18n(
                change.description) or translate_i18n(u"New Version")))
    elif change.action == "workflow":
        description = translate_i18n(change.description)
    if not description:
        # use principal effecting the change as description as a fallback
        dc = IDCDescriptiveProperties(change.user, None)
        if dc:
            description = translate_i18n(dc.title_member)
    return description
예제 #32
0
 def add_wf_meta(enum):
     index, item = enum
     node = nodes[index]
     wfc = IWorkflowController(node.item, None)
     if wfc is None:
         return
     #!+SCHEDULING_FILTERS(mb, mar-2012) Find a more elegant way to do this
     # perhaps as a workflow feature
     if not len(
             wfc.workflow.get_state_ids(keys=["draft"],
                                        restrict=False)):
         return
     item["wf_state"] = translate_i18n(
         wfc.state_controller.get_state().title)
     item["wf_actions"] = [
         dict(value=transition,
              text=translate_i18n(
                  wfc.workflow.get_transition(transition).title))
         for transition in wfc.getFireableTransitionIds()
     ]
예제 #33
0
 def verbose_title(self):
     session = Session()
     context = session.merge(removeSecurityProxy(self.context))
     sitting_title = _("verbose_sitting_title", 
         default=u"Sitting of ${group_name} @ ${sitting_venue}",
         mapping = {
             "group_name": IDCDescriptiveProperties(context.group).title,
             "sitting_venue": IDCDescriptiveProperties(context.venue).title
         }
     )
     return translate_i18n(sitting_title)
예제 #34
0
 def verbose_title(self):
     session = Session()
     context = session.merge(removeSecurityProxy(self.context))
     sitting_title = _(
         "verbose_sitting_title",
         default=u"Sitting of ${group_name} @ ${sitting_venue}",
         mapping={
             "group_name": IDCDescriptiveProperties(context.group).title,
             "sitting_venue": IDCDescriptiveProperties(context.venue).title
         })
     return translate_i18n(sitting_title)
예제 #35
0
        def generate_tree(root, context):
            for element in root.getiterator():
                typ = get_attr(element, "type")
                src = get_attr(element, "source")
                if typ:
                    if typ == "text":
                        clean_element(element)
                        element.text = get_element_value(context, src)
                    elif typ == "link":
                        clean_element(element)
                        url_source = get_attr(element, "url")
                        if url_source:
                            link_url = get_element_value(context, url_source)
                        else:
                            link_url = url.absoluteURL(context,
                                                       common.get_request())
                        element.attrib["href"] = link_url
                        if src:
                            element.text = get_element_value(context, src)
                    elif typ == "html":
                        clean_element(element)
                        _html = u"<div>%s</div>" % get_element_value(
                            context, src)
                        new_html = element.insert(0, etree.fromstring(_html))
                    elif typ == "listing":
                        listing = get_element_value(context, src, default=[])

                        if IAlchemistContainer.providedBy(listing):
                            _listing = common.list_container_items(listing)
                            listing = [item for item in _listing]

                        log.debug("[LISTING] %s @@ %s", src, listing)
                        listing_count = len(listing)
                        new_children = [
                            deepcopy(element.getchildren())
                            for x in range(listing_count)
                        ]
                        empty_element(element)
                        clean_element(element)

                        if listing_count == 0:
                            parent = element.getparent()
                            no_items_element = etree.SubElement(element, "p")
                            no_items_element.text = translate_i18n(
                                _(u"No items found"))
                        else:
                            for (index, item) in enumerate(listing):
                                for child in new_children[index]:
                                    generate_tree(child, item)
                            for children in new_children:
                                for descendant in children:
                                    element.append(descendant)
                        break
            return etree.tostring(root)
예제 #36
0
 def calendar_js_globals(self):
     cal_globals = dict(
         ical_url=self.ical_url,
         view_url=self.url,
         venues_view_title=translate_i18n(_(u"Venues")),
         text_group=translate_i18n(_(u"Group")),
         text_start_date=translate_i18n(_(u"Start Date")),
         text_end_date=translate_i18n(_(u"End Date")),
         text_venue=translate_i18n(_(u"Venue")),
         text_activity_type=translate_i18n(_(u"Activity Type")),
         text_meeting_type=translate_i18n(_(u"Meeting Type")),
         text_convocation_type=translate_i18n(_(u"Convocation Type")),
         text_sitting=translate_i18n(_(u"Sitting")),
     )
     return """var cal_globals = %s;var venues_data=%s;""" %(
         json.dumps(cal_globals), json.dumps(self.venues_data)
     )
예제 #37
0
 def add_wf_meta(enum):
     index, item = enum
     node = nodes[index]
     item["item_id"] = node.item_id
     if model_interfaces.IScheduleText.providedBy(node.item):
         return
     if not include_wf:
         return
     wfc = IWorkflowController(node.item, None)
     if wfc is None:
         return
     item["wf_state"] = translate_i18n(
         wfc.state_controller.get_state().title
     )
     item["wf_actions"] = [ 
         dict(
             value=transition, 
             text=translate_i18n(
                 wfc.workflow.get_transition(transition).title
             )
         )
         for transition in wfc.getFireableTransitionIds()
     ]
예제 #38
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
예제 #39
0
def format_change_description(change):
    """Format/i18n a document's change object description for timeline listing
    """
    description = change.description
    if change.action == "new-version":
        version = change.origin.versions.get(
            int(change.extras.get("version_id"))
        )
        chg_url = url.absoluteURL(version, common.get_request())
        if chg_url:
            description = "<a href='%s'>%s</a>" % (
                chg_url, 
                (translate_i18n(change.description) 
                    or translate_i18n(u"New Version")
                )
            )
    elif change.action == "workflow":
        description = translate_i18n(change.description)
    if not description:
        # use principal effecting the change as description as a fallback
        dc = IDCDescriptiveProperties(change.user, None)
        if dc:
            description = translate_i18n(dc.title_member)
    return description
예제 #40
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
예제 #41
0
 def status(self):
     session = Session()
     context = session.merge(removeSecurityProxy(self.context))
     return translate_i18n(misc.get_wf_state(context))
예제 #42
0
 def description(self):
     context = _merged(self.context)
     text = "%s %s %s" % (translate_i18n(_("Submitted by")), context.owner.first_name, context.owner.last_name)
     if context.publication_date:
         text += " (%s %s)" % (translate_i18n(_(u"published on")), self.formatDate(context.publication_date))
     return text + "."
예제 #43
0
 def description(self):
     return "%s %s" % (translate_i18n(
         _(u"Last modified")), self.context.change.date)
예제 #44
0
파일: dc.py 프로젝트: gelie/bungeni_src
 def mover(self):
     context = _merged(self.context)
     # !+TRANSLATE_MESS(mr, oct-2012) this is content data and NOT a UI msgid?
     # Should then be using translate_obj ?!
     return translate_i18n(
         IDCDescriptiveProperties(context.owner).title_member)
예제 #45
0
 def description(self):
     context = _merged(self.context)
     text = "%s %s %s" % (translate_i18n(_(u"Submitted by")), context.owner.first_name, context.owner.last_name)
     if context.notice_date:
         text += " (%s %s)" % (translate_i18n(_(u"notice given on")), self.formatDate(context.notice_date))
     return text + "."
예제 #46
0
 def title(self):
     return translate_i18n(
         capi.get_type_info(self.context).descriptor_model.display_name)
예제 #47
0
파일: dc.py 프로젝트: gelie/bungeni_src
 def title(self):
     return translate_i18n(
         capi.get_type_info(self.context).descriptor_model.display_name)
예제 #48
0
 def description(self):
     return "%s %s" % (translate_i18n(_(u"Last modified")), self.context.change.date)
예제 #49
0
 def status(self):
     session = Session()
     context = session.merge(removeSecurityProxy(self.context))
     return translate_i18n(misc.get_wf_state(context))
예제 #50
0
 def mover(self):
     session = Session()
     context = session.merge(removeSecurityProxy(self.context))
     return translate_i18n(
         IDCDescriptiveProperties(context.owner).title_member
     )
예제 #51
0
파일: dc.py 프로젝트: gelie/bungeni_src
 def status(self):
     context = _merged(self.context)
     return translate_i18n(misc.get_wf_state(context))
예제 #52
0
    def getMenuItems(self, context, request):
        results = []
        _url = url.absoluteURL(context, request)
        if IFeatureDownload.providedBy(context):
            doc_templates = self.documentTemplates(request.locale)
            for doc_type in document_types:
                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 xml_types:
                if doc_type == TYPE_AKOMANTOSO:
                    if IAlchemistContainer.providedBy(context):
                        if not IFeatureDownload.implementedBy(
                                context.domain_model):
                            continue
                elif doc_type == TYPE_RSS:
                    # rss for content types only availble for auditables
                    if (IFeatureDownload.providedBy(context)
                            and not IFeatureAudit.providedBy(context)):
                        continue
                    elif (IAlchemistContainer.providedBy(context)
                          and not IFeatureAudit.implementedBy(
                              context.domain_model)):
                        continue
                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
예제 #53
0
 def getMenuItems(self, context, request):
     results = []
     _url = url.absoluteURL(context, request)
     if IFeatureDownload.providedBy(context):
         doc_templates = self.documentTemplates(request.locale)
         for doc_type in document_types:
             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 xml_types:
             if doc_type == TYPE_AKOMANTOSO:
                 if IAlchemistContainer.providedBy(context):
                     if not IFeatureDownload.implementedBy(
                             context.domain_model
                         ):
                         continue
             elif doc_type == TYPE_RSS:
                 # rss for content types only availble for auditables
                 if (IFeatureDownload.providedBy(context) and not
                         IFeatureAudit.providedBy(context)
                     ):
                     continue
                 elif (IAlchemistContainer.providedBy(context) and not 
                         IFeatureAudit.implementedBy(context.domain_model)
                     ):
                     continue
             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
예제 #54
0
 def status(self):
     context = _merged(self.context)
     return translate_i18n(misc.get_wf_state(context))
예제 #55
0
 def description(self):
     return "%s (%s)" % (translate_i18n(self.context.description),
                         self.formatDate(self.context.date_active))
예제 #56
0
 def description(self):
     return "%s (%s)" % (translate_i18n(self.context.description), self.formatDate(self.context.date_active))
예제 #57
0
 def mover(self):
     session = Session()
     context = session.merge(removeSecurityProxy(self.context))
     return translate_i18n(
         IDCDescriptiveProperties(context.owner).title_member)
예제 #58
0
 def mover(self):
     context = _merged(self.context)
     # !+TRANSLATE_MESS(mr, oct-2012) this is content data and NOT a UI msgid?
     # Should then be using translate_obj ?!
     return translate_i18n(
         IDCDescriptiveProperties(context.owner).title_member)