Ejemplo n.º 1
0
class GeneralPublishElementWdg(BaseTableElementWdg):
    ''' A general publish table element with the option of having a thumbnail '''
    def get_arg_keys(self):
        return {'view': 'a custom view other than publish'}

    def preprocess(self):
        if self.get_option('preview') != 'false':
            self.thumb = ThumbWdg()
            self.thumb.set_sobjects(self.sobjects)
            self.thumb.set_icon_size(60)
            # passing options from this to ThumbWdg, shouldn't have conflicts
            options = self.options
            self.thumb.set_options(options)
        # for its own preprocess and data caching

    def get_display(self):
        self.view = self.kwargs.get('view')
        if not self.view:
            self.view = 'publish'
        widget = Widget()
        sobject = self.get_current_sobject()
        search_type = sobject.get_search_type()
        search_id = sobject.get_id()

        if self.get_option('preview') != 'false':
            self.thumb.set_current_index(self.get_current_index())
            widget.add(self.thumb)

        publish_link = PublishLinkWdg(search_type,
                                      search_id,
                                      config_base=self.view)
        div = DivWdg(publish_link)
        div.set_style('clear: left; padding-top: 6px')
        widget.add(div)

        # build a popup link to show publish browsing
        browse_link = IconButtonWdg("Publish Browser", IconWdg.CONTENTS)
        browse_link.add_behavior({
            'type': 'click_up',
            'cbjs_action': 'spt.popup.get_widget(evt, bvr)',
            'options': {
                'popup_id': 'publish_browser',
                'class_name': 'pyasm.prod.web.PublishBrowserWdg',
                'title': 'Publish Browser'
            },
            'args': {
                'search_type': search_type,
                'search_id': search_id
            }
        })
        div.add(browse_link)
        div.set_style('padding-top: 6px')

        return widget
Ejemplo n.º 2
0
class GeneralPublishElementWdg(BaseTableElementWdg):
    ''' A general publish table element with the option of having a thumbnail '''
    def get_arg_keys(self):
        return {'view': 'a custom view other than publish'}

    def preprocess(self):
        if self.get_option('preview') != 'false':
            self.thumb = ThumbWdg()
            self.thumb.set_sobjects(self.sobjects)
            self.thumb.set_icon_size(60)
            # passing options from this to ThumbWdg, shouldn't have conflicts
            options = self.options
            self.thumb.set_options(options)
        # for its own preprocess and data caching

    def get_display(self):
        self.view = self.kwargs.get('view')
        if not self.view:
            self.view = 'publish'
        widget = Widget()
        sobject = self.get_current_sobject()
        search_type = sobject.get_search_type()
        search_id = sobject.get_id()

        if self.get_option('preview') != 'false': 
            self.thumb.set_current_index(self.get_current_index())
            widget.add(self.thumb)

        publish_link = PublishLinkWdg(search_type,search_id, config_base=self.view) 
        div = DivWdg(publish_link)
        div.set_style('clear: left; padding-top: 6px')
        widget.add(div)

        # build a popup link to show publish browsing
        browse_link = IconButtonWdg("Publish Browser", IconWdg.CONTENTS)
        browse_link.add_behavior({'type': 'click_up',
            'cbjs_action': 'spt.popup.get_widget(evt, bvr)',
            'options': {'popup_id' : 'publish_browser',
                        'class_name' : 'pyasm.prod.web.PublishBrowserWdg' ,
                        'title': 'Publish Browser'},
            'args' : { 'search_type': search_type,
                        'search_id' : search_id }
            })
        div.add(browse_link)
        div.set_style('padding-top: 6px')


        return widget