示例#1
0
    def get_display(self):

        button = ProdIconSubmitWdg("Introspect", long=True)
        button.add_style("height: 14px")
        button.add_style("font-size: 0.8em")
        #self.add_style("padding: 3px 10px 2px 10px")
        button.add_behavior({
            'type': "click",
            'cbjs_action': "introspect(bvr)"
        })

        self.top.add(button)
        return self.top
示例#2
0
    def get_watchlist_wdg(my):

        widget = Widget()
        WebContainer.register_cmd("pyasm.widget.ClipboardMoveToCategoryCbk")

        div = DivWdg(css="filter_box")

        select = FilterSelectWdg("clipboard_category",\
            label="Current Watch List: ", css='med')
        select.set_option("values", "watch_list|watch_list2|watch_list3")
        select.add_empty_option("-- Any Category --")
        div.add(select)

        search_type_sel = SearchTypeFilterWdg()
       
        div.add(search_type_sel)


        widget.add(div)

        div = DivWdg()
        from pyasm.prod.web import ProdIconSubmitWdg
        copy = ProdIconSubmitWdg(ClipboardMoveToCategoryCbk.COPY_BUTTON)
        copy.add_style("float: right")
        #clear = ProdIconSubmitWdg("Clear All")
        #clear.add_style("float: right")
        div.add(copy)
        #div.add(clear)
        div.add(HtmlElement.br(2))
        widget.add(div)

        # get all of the clipboard items
        value = select.get_value()
        search = Clipboard.get_search(category=value)
        search_type_sel.alter_search(search)
        table = TableWdg("sthpw/clipboard", "watch_list")
        table.set_search(search)
        widget.add(table)
        return widget
示例#3
0
    def get_display(self):

        button = ProdIconSubmitWdg("Introspect", long=True)
        button.add_style("height: 14px")
        button.add_style("font-size: 0.8em")
        #self.add_style("padding: 3px 10px 2px 10px")
        button.add_behavior({
            'type': "click",
            'cbjs_action': "introspect(bvr)"
        })

        self.top.add(button)
        return self.top
示例#4
0
    def get_new_custom_widget(my, view):

        custom_table = Table(css="table")
        name_text = TextWdg("new_custom_name")
        custom_table.add_row()
        custom_table.add_cell("Name: ")
        custom_table.add_cell(name_text)

        type_select = SelectWdg("new_custom_type")
        #type_select.add_empty_option("-- Select --")
        type_select.set_option("values", "Name/Code|Foreign Key|List|Checkbox|Text|Number|Date|Date Range")
        custom_table.add_row()
        custom_table.add_cell("Predefined Type: ")
        td = custom_table.add_cell(type_select)
        td.add( HtmlElement.script('''
        function property_type_select(el) {
            if (el.value == "Foreign Key") {
                set_display_on('foreign_key_options')
            }
            else if (el.value == "List") {
                set_display_on('list_options')
            }
            else {
                set_display_off('foreign_key_options')
                set_display_off('list_options')
            }
        }
        ''') )
        type_select.add_event("onchange", "property_type_select(this)")


        # extra info for foreign key
        custom_table.add_row()
        div = DivWdg()
        div.set_id("foreign_key_options")
        div.add_style("display: none")
        div.add_style("margin-top: 10px")
        div.add("Options")
        div.add(HtmlElement.br())
        # TODO: this class should not be in prod!!
        from pyasm.prod.web import SearchTypeSelectWdg
        div.add("Relate to: ")
        search_type_select = SearchTypeSelectWdg("foreign_key_search_select", mode=SearchTypeSelectWdg.CURRENT_PROJECT)
        div.add(search_type_select)
        td.add(div)


        # extra info for foreign key
        custom_table.add_row()
        div = DivWdg()
        div.set_id("list_options")
        div.add_style("display: none")
        div.add_style("margin-top: 10px")
        div.add("Options")
        div.add(HtmlElement.br())
        # TODO: this class should not be in prod!!
        from pyasm.prod.web import SearchTypeSelectWdg
        div.add("Values: ")
        search_type_text = TextWdg("list_values")
        div.add(search_type_text)
        td.add(div)


        custom_table.add_row()
        description_wdg = TextAreaWdg("new_description")
        custom_table.add_cell( "Description: " )
        custom_table.add_cell( description_wdg )

        # add to current view
        if view not in ['edit', 'insert']:
            custom_table.add_row()
            current_view_wdg = CheckboxWdg("add_to_current_view")
            current_view_wdg.set_checked()
            custom_table.add_cell("Add To Current View: ")
            td = custom_table.add_cell(current_view_wdg)


        
        custom_table.add_row()
        edit_view_wdg = CheckboxWdg("add_to_edit_view")
        edit_view_wdg.set_checked()
        custom_table.add_cell("Add To Edit View: ")
        custom_table.add_cell(edit_view_wdg)

        # add to edit view
        custom_table.add_row()
        custom_table.add_blank_cell()
        custom_table.add_cell(SpanWdg('If you check this for a search type already in the system, it will create an edit view that overrides the built-in edit view. This may affect its editability. You can always delete the edit view in the Configure Widgets tab afterwards.', css='warning smaller'))

        custom_table.add_row()
       


        from pyasm.prod.web import ProdIconSubmitWdg, ProdIconButtonWdg
        submit = ProdIconSubmitWdg("Insert/Next")
        tr, td = custom_table.add_row_cell(submit)
        td.add_style("text-align: center")

        submit = ProdIconSubmitWdg("Insert/Exit")
        td.add(submit)

        iframe = WebContainer.get_iframe()
        cancel = ProdIconButtonWdg("Cancel")
        iframe_close_script = "window.parent.%s" % iframe.get_off_script() 
        cancel.add_event("onclick", iframe_close_script)


        td.add(cancel)
        
        return custom_table