Example #1
0
 def other_calendars(self):
     """A list of URLs to other calendars - Loaded when selected"""
     menu = menu = component.queryUtility(IBrowserMenu, "context_calendar")
     if menu is None:
         return []
     items = menu.getMenuItems(self.context, self.request)
     colors = utils.generate_event_colours(len(items))
     map(lambda item: item[1].update([("color", colors[item[0]])]), enumerate(items))
     return items
Example #2
0
 def calendar_urls(self):
     """A list of URLs to other calendars - Loaded when selected"""
     menu = component.queryUtility(IBrowserMenu, "context_calendar")
     if menu is None:
         return []
     items = menu.getMenuItems(self.context, self.request)
     colors = utils.generate_event_colours(len(items))
     return [ { "url": item[1]["action"], "color": colors[item[0]] }
         for item in enumerate(items)
     ]
Example #3
0
 def other_calendars(self):
     """A list of URLs to other calendars - Loaded when selected"""
     menu = menu = component.queryUtility(IBrowserMenu, "context_calendar")
     if menu is None:
         return []
     items = menu.getMenuItems(self.context, self.request)
     colors = utils.generate_event_colours(len(items))
     map(lambda item: item[1].update([("color", colors[item[0]])]),
         enumerate(items))
     return items
Example #4
0
 def calendar_urls(self):
     """A list of URLs to other calendars - Loaded when selected"""
     menu = component.queryUtility(IBrowserMenu, "context_calendar")
     if menu is None:
         return []
     items = menu.getMenuItems(self.context, self.request)
     colors = utils.generate_event_colours(len(items))
     return [{
         "url": item[1]["action"],
         "color": colors[item[0]]
     } for item in enumerate(items)]
Example #5
0
        super(UserSettings, self).update()


SIMPLE_LIST = "<ul/>"
X_TITLE = "font-weight:bold; padding:5px; color:#fff; display:block; background-color:#%s;"


def add_sub_element(parent, tag, text=None, **kw):
    _element = etree.SubElement(parent, tag, **kw)
    if text:
        _element.text = str(text)
    return _element


COLOUR_COUNT = 10
COLOURS = calendar_utils.generate_event_colours(COLOUR_COUNT)
GROUP_SITTING_EXTRAS = dict(questions="Question",
                            motions="Motion",
                            tableddocuments="TabledDocument",
                            bills="Bill",
                            agendaitems="AgendaItem")


def generate_doc_for(domain_class, title=None, color=0):
    doc = etree.fromstring(SIMPLE_LIST)
    _color = COLOURS[color]
    if color:
        doc.attrib["style"] = "background-color:#%s;" % _color
    if title:
        add_sub_element(doc, "li", title)
Example #6
0
        return super(VocabulariesIndex, self).__init__(context, request)
    
    def __call__(self):
        return self.render()

SIMPLE_LIST = "<ul/>"
X_TITLE = "font-weight:bold; padding:5px; color:#fff; display:block; background-color:#%s;"

def add_sub_element(parent, tag, text=None, **kw):
    _element = etree.SubElement(parent, tag, **kw)
    if text: 
        _element.text = str(text)
    return _element

COLOUR_COUNT = 10
COLOURS = calendar_utils.generate_event_colours(COLOUR_COUNT)
GROUP_SITTING_EXTRAS = dict(questions="Question", motions="Motion", 
    tableddocuments="TabledDocument", bills="Bill", agendaitems="AgendaItem"
)
def generate_doc_for(domain_class, title=None, color=0):
    doc = etree.fromstring(SIMPLE_LIST)
    _color = COLOURS[color]
    if color:
        doc.attrib["style"] = "background-color:#%s;" % _color
    if title:
        add_sub_element(doc, "li", title)
    
    proxy_dict = domain_class.__dict__
    class_dict = {}
    class_dict.update(proxy_dict)
    if domain_class is domain.GroupSitting: