def load_template(self, templatename, template_string=None): """Find a template specified in python 'dot' notation, or load one from a string.""" if template_string is not None: loader = templates.get_loader() return loader.compile(templatename, template_string) else: return templates.get_class(templatename)
def _load(self): from woost.extensions.opengraph import ( strings, publishable, opengraphtype, opengraphcategory ) OpenGraphExtension.add_member( schema.Collection("categories", items = schema.Reference( type = opengraphcategory.OpenGraphCategory ), related_end = schema.Collection(), member_group = "open_graph" ) ) # Install an overlay to BaseView to automatically add OpenGraph # metadata to HTML documents templates.get_class("woost.extensions.opengraph.BaseViewOverlay") self.install()
def get_class_overlays(cls): """Determine the overlayed classes that apply to the specified class. :param cls: The class to determine the overlays for. :type cls: `Element` class :return: An iterable sequence of overlay classes that apply to the specified class. :rtype: Iterable sequence of `Overlay` classes """ if _overlays: for cls in reversed(cls.__mro__): view_name = getattr(cls, "view_name", None) if view_name: class_overlays = _overlays.get(view_name) if class_overlays: from cocktail.html import templates for overlay_name in class_overlays: yield templates.get_class(overlay_name)
#-*- coding: utf-8 -*- u""" @author: Martí Congost @contact: [email protected] @organization: Whads/Accent SL @since: October 2008 """ from cocktail.html import templates, Element from cocktail.translations import translations from woost.models import Style TinyMCE = templates.get_class("cocktail.html.TinyMCE") class RichTextEditor(TinyMCE): # Required TinyMCE version: 3.2.2.3 tinymce_params = { "plugins": "fullscreen, paste, media, inlinepopups, advimage, " "contextmenu, tabfocus, -advimagescale", "entity_encoding": "raw", "dialog_type": "modal", "theme": "advanced", "theme_advanced_buttons1_add": "removeformat", "theme_advanced_buttons2_add": "selectall, | , fullscreen", "theme_advanced_buttons3": "", "theme_advanced_toolbar_location": "top", "theme_advanced_resizing": True, "theme_advanced_statusbar_location": "bottom",
@organization: Whads/Accent SL @since: September 2008 """ from cocktail.pkgutils import resolve from cocktail.translations import translations from cocktail.schema import RelationMember from cocktail.schema.expressions import ( PositiveExpression, NegativeExpression ) from cocktail.html import Element, templates from cocktail.controllers import view_state from woost.models import Item from woost.views.contentdisplaymixin import ContentDisplayMixin Table = templates.get_class("cocktail.html.Table") class ContentTable(ContentDisplayMixin, Table): base_url = None entry_selector = "tbody tr.item_row" def __init__(self, *args, **kwargs): Table.__init__(self, *args, **kwargs) ContentDisplayMixin.__init__(self) self.set_member_sortable("element", False) self.set_member_sortable("class", False) def _fill_head(self): Table._fill_head(self)
#-*- coding: utf-8 -*- u""" .. moduleauthor:: Martí Congost <*****@*****.**> """ from cocktail.html import templates BackOfficeBlockHeading = \ templates.get_class("woost.views.BackOfficeBlockHeading")
u""" @author: Martí Congost @contact: [email protected] @organization: Whads/Accent SL @since: February 2009 """ from cocktail.translations import translations, get_language from cocktail.html.element import Element from cocktail.html import templates from cocktail.html.utils import rendering_xml from cocktail.controllers import context from woost.models import (Configuration, get_current_user, ReadTranslationPermission) LinkSelector = templates.get_class("cocktail.html.LinkSelector") class LanguageSelector(LinkSelector): tag = "ul" translated_labels = True missing_translations = "redirect" # "redirect", "hide", "disable" autohide = True def create_entry(self, value, label, selected): entry = Element("li") link = self.create_entry_link(value, label) if selected:
#-*- coding: utf-8 -*- u""" .. moduleauthor:: Martí Congost <*****@*****.**> """ from cocktail.html import templates LoginBlockView = templates.get_class("woost.views.LoginBlockView")
#-*- coding: utf-8 -*- u""" @author: Martí Congost @contact: [email protected] @organization: Whads/Accent SL @since: November 2008 """ from cocktail.html import templates from woost.models import Configuration, Document TreeContentView = templates.get_class("woost.views.TreeContentView") class PublishableTreeContentView(TreeContentView): children_collection = Document.children def __init__(self, *args, **kwargs): TreeContentView.__init__(self, *args, **kwargs) self.root = [ website.home for website in Configuration.instance.websites ]
""" .. moduleauthor:: Martí Congost <*****@*****.**> """ from cocktail.html import templates templates.get_class("woost.extensions.identity.LoginBlockViewOverlay")
#-*- coding: utf-8 -*- u""" .. moduleauthor:: Martí Congost <*****@*****.**> """ from cocktail.html import templates SlideShowImageBullet = templates.get_class("woost.views.SlideShowImageBullet")
#-*- coding: utf-8 -*- u""" @author: Martí Congost @contact: [email protected] @organization: Whads/Accent SL @since: February 2009 """ from cocktail.html import templates from woost.models import get_current_user, ReadPermission List = templates.get_class("cocktail.html.List") class ContentList(List): referer = None def _fill_entries(self): user = get_current_user() items = self.items if items is not None: items = [ item for item in self.items if user.has_permission(ReadPermission, target=item) ] if items: List._fill_entries(self)
#-*- coding: utf-8 -*- u""" .. moduleauthor:: Martí Congost <*****@*****.**> """ from cocktail.html import templates GenericThumbnailBlockDisplay = \ templates.get_class("woost.views.GenericThumbnailBlockDisplay")
#-*- coding: utf-8 -*- u""" .. moduleauthor:: Martí Congost <*****@*****.**> """ from cocktail.html import templates TextBlockForm = templates.get_class("woost.views.TextBlockForm")
#-*- coding: utf-8 -*- u""" .. moduleauthor:: Martí Congost <*****@*****.**> """ from cocktail.html import templates VideoBlockDisplay = templates.get_class("woost.views.VideoBlockDisplay")
#-*- coding: utf-8 -*- u""" @author: Javier Marrero @contact: [email protected] @organization: Whads/Accent SL @since: March 2009 """ from cocktail.html import templates, Element from cocktail.controllers import context from woost.models import get_current_website TreeView = templates.get_class("cocktail.html.TreeView") class Menu(TreeView): """A visual component used to render navigation menus and site maps. @var emphasized_selection: When set to True, adds a <strong> tag to highlight the selected item. @type emphasized_selection: bool @var linked_selection: Indicates if the entry for the selected item should behave as a link or not. @type linked_selection: bool @var linked_containers: Indicates if entries that contain other entries should behave as links. @type linked_containers: bool """ root_visibility = TreeView.HIDDEN_ROOT
""" .. moduleauthor:: Martí Congost <*****@*****.**> """ from cocktail.html import templates templates.get_class("woost.extensions.staticpub.AdminFrontendPanelOverlay")
#-*- coding: utf-8 -*- """ @author: Martí Congost @contact: [email protected] @organization: Whads/Accent SL @since: October 2008 """ from cocktail.html import Element, templates from cocktail.html.selector import Selector from cocktail.html.selectable import selectable, MULTIPLE_SELECTION CheckBox = templates.get_class("cocktail.html.CheckBox") class CheckList(Selector): empty_option_displayed = False column_count = None column_height = None apply_selectable_behavior = True exclusive_selection = False def _ready(self): if self.apply_selectable_behavior: selectable(self, mode=MULTIPLE_SELECTION, exclusive=self.exclusive_selection) Selector._ready(self) def _create_entries(self, items, container):
#-*- coding: utf-8 -*- u""" .. moduleauthor:: Martí Congost <*****@*****.**> """ from cocktail.html import templates SlideShowTextAndImageBullet = \ templates.get_class("woost.views.SlideShowTextAndImageBullet")
#-*- coding: utf-8 -*- u""" .. moduleauthor:: Martí Congost <*****@*****.**> """ from cocktail.html import templates EditBlocksSlotList = templates.get_class("woost.views.EditBlocksSlotList")
#-*- coding: utf-8 -*- u""" .. moduleauthor:: Martí Congost <*****@*****.**> """ from cocktail.html import templates TextBlockView = templates.get_class("woost.views.TextBlockView")
#-*- coding: utf-8 -*- u""" @author: Martí Congost @contact: [email protected] @organization: Whads/Accent SL @since: October 2008 """ from cocktail.html import Element, templates from woost.models import Item ContentTypeSelector = \ templates.get_class("woost.views.ContentTypeSelector") class ContentTypePath(Element): tag = "ul" value = None root = Item Entry = Element Selector = ContentTypeSelector def _ready(self): inheritance_line = [] for content_type in self.value.ascend_inheritance(True): inheritance_line.insert(0, content_type) if content_type is self.root:
#-*- coding: utf-8 -*- u""" @author: Martí Congost @contact: [email protected] @organization: Whads/Accent SL @since: February 2009 """ from cocktail.html import templates from woost.views.contentdisplaymixin import ContentDisplayMixin PropertyTable = templates.get_class("cocktail.html.PropertyTable") class ContentPropertyTable(ContentDisplayMixin, PropertyTable): def __init__(self, *args, **kwargs): PropertyTable.__init__(self, *args, **kwargs) ContentDisplayMixin.__init__(self)
""" .. moduleauthor:: Martí Congost <*****@*****.**> """ from cocktail.html import templates templates.get_class("woost.extensions.attributes.BaseViewOverlay") templates.get_class("woost.extensions.attributes.LinkOverlay") templates.get_class("woost.extensions.attributes.MenuOverlay")
#-*- coding: utf-8 -*- """ .. moduleauthor:: Martí Congost <*****@*****.**> """ from cocktail.html import templates from cocktail.html.utils import rendering_html5 TextBox = templates.get_class("cocktail.html.TextBox") class URLBox(TextBox): def _ready(self): TextBox._ready(self) if rendering_html5(): self["type"] = "url"
#-*- coding: utf-8 -*- u""" .. moduleauthor:: Martí Congost <*****@*****.**> """ from cocktail.html import templates VideoBlockView = templates.get_class("woost.views.VideoBlockView")
#-*- coding: utf-8 -*- u""" .. moduleauthor:: Martí Congost <*****@*****.**> """ from cocktail.html import templates PublishableListingDisplay = \ templates.get_class("woost.views.PublishableListingDisplay")
#-*- coding: utf-8 -*- u""" .. moduleauthor:: Martí Congost <*****@*****.**> """ from cocktail.html import templates EditBlocksActionBar = templates.get_class("woost.views.EditBlocksActionBar")
""" .. moduleauthor:: Martí Congost <*****@*****.**> """ from cocktail.html import templates templates.get_class("woost.extensions.googleanalytics.BaseViewOverlay") templates.get_class("woost.extensions.googleanalytics.StandardViewOverlay") templates.get_class("woost.extensions.googleanalytics.LanguageSelectorOverlay") templates.get_class("woost.extensions.googleanalytics.LinkOverlay") templates.get_class("woost.extensions.googleanalytics.MenuOverlay") templates.get_class("woost.extensions.googleanalytics.TextBlockViewOverlay")
#-*- coding: utf-8 -*- u""" .. moduleauthor:: Martí Congost <*****@*****.**> """ from cocktail.html import templates SlideShowTextBullet = templates.get_class("woost.views.SlideShowTextBullet")