コード例 #1
0
ファイル: custom_info_wdg.py プロジェクト: zieglerm/TACTIC
    def get_display(self):
        search_type = self.options.get("search_type")
        view = self.options.get("view")
        filter = self.options.get("filter")
        if type(filter) in types.StringTypes:
            filters = [filter]
        elif not filter:
            filters = []
        else:
            filters = filter

        # create the search
        search = Search(search_type)

        widget = Widget()
        div = DivWdg(css="filter_box")
        widget.add(div)

        for i, filter in enumerate(filters):

            if filter.find("|") != -1:
                filter_name, expression = filter.split("|", 1)
            else:
                filter_name = filter
                expression = None

            span = SpanWdg(css="med")

            filter_wdg = Container.get_dict("widgets", filter_name)
            if not filter_wdg:
                filter_wdg = Common.create_from_class_path(filter_name)
                span.add(filter_wdg)
                div.add(span)
            else:
                span.add("%s: " % filter_wdg.get_name())

            if expression:
                name = filter_wdg.get_name()
                value = filter_wdg.get_value()
                if value != "":
                    expression = expression.replace("{name}", name)
                    expression = expression.replace("{value}", value)
                    search.add_where(expression)
            else:
                filter_wdg.alter_search(search)

            filter_wdg.set_name(filter_name)

            span = SpanWdg(css="med")
            span.add("%s: " % filter_name)
            span.add(filter_wdg)
            div.add(span)

        table = TableWdg(search_type, view)
        table.set_search(search)
        table.do_search()

        widget.add(table)
        return widget
コード例 #2
0
ファイル: sobject_planner_wdg.py プロジェクト: mincau/TACTIC
    def get_display(self):

        web = WebContainer.get_web()
        args = web.get_form_args()

        # get the args in the URL
        search_type = args['search_type']
        search_id = args['search_id']

        sobject = Search.get_by_search_key("%s|%s" % (search_type,search_id) )

        planner_search_type = self.get_search_type()


        # get parent instances first
        '''
        all_instances = []
        parent_code = ""
        if sobject.has_value("parent_code"):
            parent_code = sobject.get_value("parent_code")
        if parent_code != "":
            parent = sobject.get_by_code(parent_code)

            search = Search(planner_search_type)
            search.add_filter(sobject.get_foreign_key(), parent.get_code())
            instances = search.get_sobjects()

            all_instances.extend(instances)
        '''


        search = Search(planner_search_type)
        search.add_filter(sobject.get_foreign_key(), sobject.get_code())
        instances = search.get_sobjects()
        #all_instances.extend(instances)

        widget = DivWdg()
        widget.add( HiddenWdg("planner_search_type", planner_search_type) )
        widget.add_style("width: 95%")
        widget.add_style("float: right")
        table = TableWdg(search_type, "layout", css='minimal')
        table.table.set_max_width(use_css=True)
        #table.set_sobjects(all_instances)
        table.set_search(search)
        table.do_search()
        table.set_show_property(False)

        #aux_data = ShotInstance.get_aux_data(all_instances)
        #table.set_aux_data(aux_data)
        widget.add(table)
        return widget
コード例 #3
0
    def get_display(my):

        web = WebContainer.get_web()
        args = web.get_form_args()

        # get the args in the URL
        search_type = args['search_type']
        search_id = args['search_id']

        sobject = Search.get_by_search_key("%s|%s" % (search_type,search_id) )

        planner_search_type = my.get_search_type()


        # get parent instances first
        '''
        all_instances = []
        parent_code = ""
        if sobject.has_value("parent_code"):
            parent_code = sobject.get_value("parent_code")
        if parent_code != "":
            parent = sobject.get_by_code(parent_code)

            search = Search(planner_search_type)
            search.add_filter(sobject.get_foreign_key(), parent.get_code())
            instances = search.get_sobjects()

            all_instances.extend(instances)
        '''


        search = Search(planner_search_type)
        search.add_filter(sobject.get_foreign_key(), sobject.get_code())
        instances = search.get_sobjects()
        #all_instances.extend(instances)

        widget = DivWdg()
        widget.add( HiddenWdg("planner_search_type", planner_search_type) )
        widget.add_style("width: 95%")
        widget.add_style("float: right")
        table = TableWdg(search_type, "layout", css='minimal')
        table.table.set_max_width(use_css=True)
        #table.set_sobjects(all_instances)
        table.set_search(search)
        table.do_search()
        table.set_show_property(False)

        #aux_data = ShotInstance.get_aux_data(all_instances)
        #table.set_aux_data(aux_data)
        widget.add(table)
        return widget
コード例 #4
0
    def get_display(my):
        search_type = my.options.get("search_type")
        view = my.options.get("view")
        filter = my.options.get("filter")
        if type(filter) in types.StringTypes:
            filters = [filter]
        elif not filter:
            filters = []
        else:
            filters = filter

        # create the search
        search = Search(search_type)

        widget = Widget()
        div = DivWdg(css="filter_box")
        widget.add(div)

        for i, filter in enumerate(filters):

            if filter.find("|") != -1:
                filter_name, expression = filter.split("|", 1)
            else:
                filter_name = filter
                expression = None


            span = SpanWdg(css="med")

            filter_wdg = Container.get_dict("widgets", filter_name)
            if not filter_wdg:
                filter_wdg = Common.create_from_class_path(filter_name)
                span.add(filter_wdg)
                div.add(span)
            else:
                span.add("%s: " % filter_wdg.get_name())

            if expression:
                name = filter_wdg.get_name()
                value = filter_wdg.get_value()
                if value != "":
                    expression = expression.replace("{name}", name)
                    expression = expression.replace("{value}", value)
                    search.add_where(expression)
            else:
                filter_wdg.alter_search(search)

            filter_wdg.set_name(filter_name)

            span = SpanWdg(css="med")
            span.add("%s: " % filter_name)
            span.add(filter_wdg)
            div.add(span)


        table = TableWdg(search_type, view)
        table.set_search(search)
        table.do_search()
        
        widget.add(table)
        return widget