Пример #1
0
    def get_context_wdg(self, search_type):
        '''drop down which selects which context to checkin'''
        # add a filter
        # use a regular SelectWdg with submit instead of FilterSelectWdg
        filter_div = FloatDivWdg("Context / subcontext:")
        select = SelectWdg("publish_context")
        labels, values = self.get_context_data(search_type, self.process)
        select.set_option("values", "|".join(values))
        select.set_option("labels", "|".join(labels))
        select.append_option('publish','publish')
        select.add_style("font-size: 0.8em")
        select.add_style("margin: 0px 3px")

        # explicitly set the value
        current = select.get_value()
        if current in values:
            context = current
        elif values:
            context = values[0]
        else:
            context = ""
 
        web = WebContainer.get_web()
        web.set_form_value("publish_context", context)

        select.set_value( context )

        # set it to a instance variable
        self.context_select = select

        filter_div.add(select)

        # if specified, add a sub_context
        base_search_type = SearchType(search_type).get_base_key()
        settings = ProdSetting.get_value_by_key("%s/sub_context" % context,\
                base_search_type)
        filter_div.add( "/ ")
        sub_context = None
        if settings:
            sub_context = SelectWdg("publish_sub_context")
            sub_context.set_option("values", settings)
            sub_context.set_submit_onchange()
            sub_context.add_empty_option("<- Select ->")
        else:
            # provide a text field
            sub_context = TextWdg("publish_sub_context")
            sub_context.set_attr('size','10') 
        sub_context.set_persistence()
        filter_div.add( sub_context )
        self.sub_context_select = sub_context
        #filter_div.add_style('padding-right','10px')

        return filter_div
Пример #2
0
    def get_context_wdg(my, search_type):
        '''drop down which selects which context to checkin'''
        # add a filter
        # use a regular SelectWdg with submit instead of FilterSelectWdg
        filter_div = FloatDivWdg("Context / subcontext:")
        select = SelectWdg("publish_context")
        labels, values = my.get_context_data(search_type, my.process)
        select.set_option("values", "|".join(values))
        select.set_option("labels", "|".join(labels))
        select.append_option('publish','publish')
        select.add_style("font-size: 0.8em")
        select.add_style("margin: 0px 3px")

        # explicitly set the value
        current = select.get_value()
        if current in values:
            context = current
        elif values:
            context = values[0]
        else:
            context = ""
 
        web = WebContainer.get_web()
        web.set_form_value("publish_context", context)

        select.set_value( context )

        # set it to a instance variable
        my.context_select = select

        filter_div.add(select)

        # if specified, add a sub_context
        base_search_type = SearchType(search_type).get_base_key()
        settings = ProdSetting.get_value_by_key("%s/sub_context" % context,\
                base_search_type)
        filter_div.add( "/ ")
        sub_context = None
        if settings:
            sub_context = SelectWdg("publish_sub_context")
            sub_context.set_option("values", settings)
            sub_context.set_submit_onchange()
            sub_context.add_empty_option("<- Select ->")
        else:
            # provide a text field
            sub_context = TextWdg("publish_sub_context")
            sub_context.set_attr('size','10') 
        sub_context.set_persistence()
        filter_div.add( sub_context )
        my.sub_context_select = sub_context
        #filter_div.add_style('padding-right','10px')

        return filter_div
Пример #3
0
    def get_hier_sel(self, search_type):
        sel = SelectWdg(self.RELATED_SEARCH_TYPE, label='Related Search Type: ')
        sel.add_empty_option()
        schema = Schema.get()
        search_type_list = [search_type]
        if schema:
            parent_search_type = schema.get_parent_type(search_type)
            if parent_search_type:
                search_type_list.append(parent_search_type)
            child_types = schema.get_child_types(search_type)
            search_type_list.extend(child_types)

        sel.set_option('values', search_type_list)

        sel.set_value(self.related_search_type)
        return sel
Пример #4
0
    def get_hier_sel(my, search_type):
        sel = SelectWdg(my.RELATED_SEARCH_TYPE, label='Related Search Type: ')
        sel.add_empty_option()
        schema = Schema.get()
        search_type_list = [search_type]
        if schema:
            parent_search_type = schema.get_parent_type(search_type)
            if parent_search_type:
                search_type_list.append(parent_search_type)
            child_types = schema.get_child_types(search_type)
            search_type_list.extend(child_types)

        sel.set_option('values', search_type_list)

        sel.set_value(my.related_search_type)
        return sel