Example #1
0
        # Filter by price
        if resource.get_resource('prices-range', soft=True):
            namespace['filter_by_price'] = FilterByPriceBox_View().GET(
                resource, context)
        else:
            namespace['filter_by_price'] = None
        # XXX Hack Nb results
        nb_results = None
        if isinstance(context.view, Shop_ProductSearch):
            nb_results = str(context.view.nb_results)
        # Build namespace
        namespace['title'] = resource.get_title()
        namespace['product_search_text'] = query.get('product_search_text')
        namespace['show_list_categories'] = self.show_list_categories
        namespace['widget_categories'] = widget
        namespace['nb_results'] = nb_results
        # Return namespace
        return namespace


class SearchBox(BoxAware, Folder):

    class_id = 'sidebar-item-search-box'
    class_title = MSG(u'Search box')
    class_description = MSG(u'Product research box')
    view = SearchBox_View()


register_resource_class(SearchBox)
register_box(SearchBox, allow_instanciation=True)
Example #2
0
        if (self.is_admin(resource, context) is False and
            cart.get_nb_products() == 0 and
            show_if_empty is False):
            self.set_view_is_empty(True)

        default_order_title = MSG(u'Commander')
        return merge_dicts(
            cart.get_namespace(resource),
            order_title=resource.get_property('order_title') or default_order_title,
            title=resource.get_title())



class CartBox(Box):

    class_id = 'vertical-item-cart-box'
    class_title = MSG(u'Boîte panier')
    view = CartBox_View()


    edit_schema = {'order_title': Unicode(multilingual=True),
                   'show_if_empty': Boolean}

    edit_widgets = [TextWidget('order_title', title=MSG(u'Order title')),
                    BooleanRadio('show_if_empty',
                                 title=MSG(u'Show cart if empty ?'))]


register_resource_class(CartBox)
register_box(CartBox, allow_instanciation=False)
Example #3
0
    class_id = "sidebar-item-filter-order"
    class_title = MSG(u"Cross-Selling Table")
    class_handler = ResourcesOrderedTableFile

    order_root_path = "../"
    orderable_classes = (Filter_Criterium, Filter_Criterium_Categorie, FilterRange_Table)


class FilterBox(BoxAware, Folder):

    class_id = "sidebar-item-filter-box"
    class_title = MSG(u"Filter box")
    class_description = MSG(u"Filter box")
    class_views = ["edit", "browse_content", "new_resource"]
    view = FilterBox_View()

    @staticmethod
    def _make_resource(cls, folder, name, *args, **kw):
        Folder._make_resource(cls, folder, name, *args, **kw)
        # Order
        cls = OrderCriterium
        cls._make_resource(cls, folder, "%s/order" % name)

    def get_document_types(self):
        return [Filter_Criterium, Filter_Criterium_Categorie, FilterRange_Table]


register_resource_class(FilterBox)
register_box(FilterBox, allow_instanciation=True)
        viewbox.skin_template = '/sidebar/viewbox.xml'
        for product in table.get_products(context, product_class_id, categories):
            namespace['viewboxes'].append(viewbox.GET(product, context))
        return namespace



class SideBarProductCrossSellingBox(Box):

    class_id = 'sidebar-product-cross-selling-box'
    class_version = '20090122'
    class_title = MSG(u'Vertical item cross selling (product)')
    class_description = MSG(u"""Show on sidebar the
                                cross selling configure in product""")

    view = SideBarCrossSellingBox_View()


    # XXX Need ?
    edit_schema = {'thumb_width': Integer(mandatory=True),
                   'thumb_height': Integer(mandatory=True)}

    edit_widgets = [TextWidget('thumb_width', size=3,
                               title=MSG(u'Largeur des miniatures')),
                    TextWidget('thumb_height', size=3,
                               title=MSG(u'Hauteur des miniatures'))]


register_resource_class(SideBarProductCrossSellingBox)
register_box(SideBarProductCrossSellingBox, allow_instanciation=True)
Example #5
0
        ]
        return context.root.search(AndQuery(*queries))

    def get_nb_items_to_show(self, resource):
        return resource.get_property("nb_items_to_show")


class ReviewBox(Box):

    class_id = "shop_module_review_sidebar"
    class_title = MSG(u"Bar that list last reviews")
    class_description = MSG(u"Bar that list last reviews")

    view = ReviewBox_View()

    edit_schema = {
        "show_title": Boolean,
        "nb_items_to_show": Integer,
        "note_range": IntegerRangeDatatype(default=[0, 5]),
    }

    edit_widgets = [
        BooleanRadio("show_title", title=MSG(u"Show title ?")),
        TextWidget("nb_items_to_show", title=MSG(u"Numbers of items to show ?")),
        NumberRangeWidget("note_range", title=MSG(u"Note range")),
    ]


register_resource_class(ReviewBox)
register_box(ReviewBox, allow_instanciation=True, is_content=True, is_side=False)
Example #6
0
        return {'title': resource.get_title(), 'tree': tree}


class SubCategoriesBox(Box):

    class_id = 'vertical-item-sub-categories-box'
    class_title = MSG(u'Vertical item that list sub categories')
    class_version = '20100712'

    view = SubCategoriesBox_View()

    edit_schema = {
        'show_first_category': Boolean,
        'show_second_level': Boolean,
        'show_nb_products': Boolean,
        'use_small_title': Boolean
    }

    edit_widgets = [
        BooleanRadio('show_first_category', title=MSG(u'Show level 1 ?')),
        BooleanRadio('show_second_level', title=MSG(u'Show level 2 ?')),
        BooleanRadio('show_nb_products',
                     title=MSG(u'Afficher le nombre de produits')),
        BooleanRadio('use_small_title', title=MSG(u'Use small title'))
    ]


register_resource_class(SubCategoriesBox)
register_box(SubCategoriesBox, allow_instanciation=True)
Example #7
0
    edit = AutomaticEditView()

    edit_schema = {'code': XHTMLBody(sanitize_html=False)}
    edit_widgets = [MultilineWidget('code', title=MSG(u'Code'))]

    @classmethod
    def get_metadata_schema(cls):
        return merge_dicts(ShopFolder.get_metadata_schema(),
                           cls.edit_schema)


class ShopModule_Advertising(ShopModule):

    class_id = 'shop_module_advertising'
    class_title = MSG(u'Advertising')
    class_views = ['browse_content']
    class_description = MSG(u'Advertising')

    def render(self, resource, context):
        d = DynamicProperty()
        d.resource = self
        return d


    def get_document_types(self):
        return [ShopModule_Advertising_Ad]


register_resource_class(ShopModule_Advertising)
register_box(Advertising_SidebarBox, allow_instanciation=True)
Example #8
0
class CrossSellingBox(Folder):

    class_id = 'vertical-item-cross-selling-box'
    class_version = '20090122'
    class_title = MSG(u'Vertical item cross selling')
    class_description = MSG(u'Boîte de vente liée')
    class_views = ['edit']
    order_path = 'order-products'
    order_class = CrossSellingTable
    __fixed_handlers__ = [order_path]

    edit = GoToSpecificDocument(specific_document=order_path,
                                specific_view='edit?is_admin_popup=1')
    view = CrossSellingBox_View()

    @staticmethod
    def _make_resource(cls, folder, name, **kw):
        Folder._make_resource(cls, folder, name, **kw)
        order_class = cls.order_class
        order_class._make_resource(order_class, folder,
                                   '%s/%s' % (name, cls.order_path))

    @classmethod
    def get_metadata_schema(cls):
        return merge_dicts(Folder.get_metadata_schema(), show_title=Boolean)


register_resource_class(CrossSellingBox)
register_box(CrossSellingBox, allow_instanciation=True)
register_box(CrossSellingBox, allow_instanciation=True, is_content=True)
Example #9
0
                   PhraseQuery('workflow_state', 'public'),
                   RangeQuery('shop_module_review_note', min_v, max_v)]
        return context.root.search(AndQuery(*queries))


    def get_nb_items_to_show(self, resource):
        return resource.get_property('nb_items_to_show')



class ReviewBox(Box):

    class_id = 'shop_module_review_sidebar'
    class_title = MSG(u'Bar that list last reviews')
    class_description = MSG(u'Bar that list last reviews')

    view = ReviewBox_View()

    edit_schema = {'show_title': Boolean,
                   'nb_items_to_show': Integer,
                   'note_range': IntegerRangeDatatype(default=[0, 5])}

    edit_widgets = [BooleanRadio('show_title', title=MSG(u'Show title ?')),
                    TextWidget('nb_items_to_show', title=MSG(u'Numbers of items to show ?')),
                    NumberRangeWidget('note_range', title=MSG(u'Note range'))]


register_resource_class(ReviewBox)
register_box(ReviewBox, allow_instanciation=True,
             is_content=True, is_side=False)
Example #10
0
        # Filter by price
        if resource.get_resource('prices-range', soft=True):
            namespace['filter_by_price'] = FilterByPriceBox_View().GET(resource, context)
        else:
            namespace['filter_by_price'] = None
        # XXX Hack Nb results
        nb_results = None
        if isinstance(context.view, Shop_ProductSearch):
            nb_results = str(context.view.nb_results)
        # Build namespace
        namespace['title'] = resource.get_title()
        namespace['product_search_text'] = query.get('product_search_text')
        namespace['show_list_categories'] = self.show_list_categories
        namespace['widget_categories'] =  widget
        namespace['nb_results'] = nb_results
        # Return namespace
        return namespace



class SearchBox(BoxAware, Folder):

    class_id = 'sidebar-item-search-box'
    class_title = MSG(u'Search box')
    class_description = MSG(u'Product research box')
    view = SearchBox_View()


register_resource_class(SearchBox)
register_box(SearchBox, allow_instanciation=True)
Example #11
0
    class_views = ['edit']

    edit = AutomaticEditView()

    edit_schema = {'code': XHTMLBody(sanitize_html=False)}
    edit_widgets = [MultilineWidget('code', title=MSG(u'Code'))]

    @classmethod
    def get_metadata_schema(cls):
        return merge_dicts(ShopFolder.get_metadata_schema(), cls.edit_schema)


class ShopModule_Advertising(ShopModule):

    class_id = 'shop_module_advertising'
    class_title = MSG(u'Advertising')
    class_views = ['browse_content']
    class_description = MSG(u'Advertising')

    def render(self, resource, context):
        d = DynamicProperty()
        d.resource = self
        return d

    def get_document_types(self):
        return [ShopModule_Advertising_Ad]


register_resource_class(ShopModule_Advertising)
register_box(Advertising_SidebarBox, allow_instanciation=True)
Example #12
0
    def get_items_search(self, resource, context, *args):
        query = PhraseQuery('format', 'user')
        return context.root.search(query)

    def get_nb_items_to_show(self, resource):
        return resource.get_property('nb_items_to_show')


class LastUsersBox(Box):

    class_id = 'shop_sidebar_last_users'
    class_title = MSG(u'Bar that list last users')
    class_description = MSG(
        u'Bar that list last users that registred into website')

    view = LastUsersBox_View()

    edit_schema = {'show_title': Boolean, 'nb_items_to_show': Integer}
    edit_widgets = [
        BooleanRadio('show_title', title=MSG(u'Show title ?')),
        TextWidget('nb_items_to_show', title=MSG(u'Nb users to show ?'))
    ]


register_resource_class(LastUsersBox)
register_box(LastUsersBox,
             allow_instanciation=True,
             is_content=True,
             is_side=False)
Example #13
0
    class_version = '20090122'
    class_title = MSG(u'Vertical item cross selling')
    class_description = MSG(u'Boîte de vente liée')
    class_views = ['edit']
    order_path = 'order-products'
    order_class = CrossSellingTable
    __fixed_handlers__ = [order_path]


    edit = GoToSpecificDocument(specific_document=order_path,
                                specific_view='edit?is_admin_popup=1')
    view = CrossSellingBox_View()

    @staticmethod
    def _make_resource(cls, folder, name, **kw):
        Folder._make_resource(cls, folder, name, **kw)
        order_class = cls.order_class
        order_class._make_resource(order_class, folder,
                                   '%s/%s' % (name, cls.order_path))


    @classmethod
    def get_metadata_schema(cls):
        return merge_dicts(Folder.get_metadata_schema(),
                           show_title=Boolean)


register_resource_class(CrossSellingBox)
register_box(CrossSellingBox, allow_instanciation=True)
register_box(CrossSellingBox, allow_instanciation=True, is_content=True)
        return namespace


class SideBarProductCrossSellingBox(Box):

    class_id = 'sidebar-product-cross-selling-box'
    class_version = '20090122'
    class_title = MSG(u'Vertical item cross selling (product)')
    class_description = MSG(u"""Show on sidebar the
                                cross selling configure in product""")

    view = SideBarCrossSellingBox_View()

    # XXX Need ?
    edit_schema = {
        'thumb_width': Integer(mandatory=True),
        'thumb_height': Integer(mandatory=True)
    }

    edit_widgets = [
        TextWidget('thumb_width', size=3,
                   title=MSG(u'Largeur des miniatures')),
        TextWidget('thumb_height',
                   size=3,
                   title=MSG(u'Hauteur des miniatures'))
    ]


register_resource_class(SideBarProductCrossSellingBox)
register_box(SideBarProductCrossSellingBox, allow_instanciation=True)
Example #15
0
                'tree': tree}



class SubCategoriesBox(Box):

    class_id = 'vertical-item-sub-categories-box'
    class_title = MSG(u'Vertical item that list sub categories')
    class_version = '20100712'

    view = SubCategoriesBox_View()

    edit_schema = {'show_first_category': Boolean,
                   'show_second_level': Boolean,
                   'show_nb_products': Boolean,
                   'use_small_title': Boolean}

    edit_widgets = [
        BooleanRadio('show_first_category',
                                 title=MSG(u'Show level 1 ?')),
        BooleanRadio('show_second_level',
                                 title=MSG(u'Show level 2 ?')),
        BooleanRadio('show_nb_products',
                     title=MSG(u'Afficher le nombre de produits')),
        BooleanRadio('use_small_title', title=MSG(u'Use small title'))]



register_resource_class(SubCategoriesBox)
register_box(SubCategoriesBox, allow_instanciation=True)
Example #16
0
    sort_reverse = True

    def get_items_search(self, resource, context, *args):
        query = PhraseQuery('format', 'user')
        return context.root.search(query)


    def get_nb_items_to_show(self, resource):
        return resource.get_property('nb_items_to_show')



class LastUsersBox(Box):

    class_id = 'shop_sidebar_last_users'
    class_title = MSG(u'Bar that list last users')
    class_description = MSG(u'Bar that list last users that registred into website')

    view = LastUsersBox_View()

    edit_schema = {'show_title': Boolean,
                   'nb_items_to_show': Integer}
    edit_widgets = [BooleanRadio('show_title', title=MSG(u'Show title ?')),
                    TextWidget('nb_items_to_show', title=MSG(u'Nb users to show ?'))]



register_resource_class(LastUsersBox)
register_box(LastUsersBox, allow_instanciation=True,
             is_content=True, is_side=False)
Example #17
0
    class_handler = ResourcesOrderedTableFile

    order_root_path = '../'
    orderable_classes = (Filter_Criterium, Filter_Criterium_Categorie,
                         FilterRange_Table)


class FilterBox(BoxAware, Folder):

    class_id = 'sidebar-item-filter-box'
    class_title = MSG(u'Filter box')
    class_description = MSG(u'Filter box')
    class_views = ['edit', 'browse_content', 'new_resource']
    view = FilterBox_View()

    @staticmethod
    def _make_resource(cls, folder, name, *args, **kw):
        Folder._make_resource(cls, folder, name, *args, **kw)
        # Order
        cls = OrderCriterium
        cls._make_resource(cls, folder, '%s/order' % name)

    def get_document_types(self):
        return [
            Filter_Criterium, Filter_Criterium_Categorie, FilterRange_Table
        ]


register_resource_class(FilterBox)
register_box(FilterBox, allow_instanciation=True)