def get_action_wdg(my): filter_div = DivWdg() select = SelectWdg("filter_action") select.add_empty_option("-- search action --") select.add_style("text-align: right") select.set_option("labels", "Retrieve Search|Save Search") select.set_option("values", "retrieve|save") select.add_event("onchange", "spt.dg_table.search_action_cbk(this)") filter_div.add(select) return filter_div
def get_action_wdg(my): filter_div = DivWdg() select = SelectWdg("filter_action") select.add_empty_option("-- search action --") select.add_style("text-align: right") select.set_option("labels", "Retrieve Search|Save Search") select.set_option("values", "retrieve|save") select.add_event("onchange", "spt.dg_table.search_action_cbk(this)") filter_div.add(select) return filter_div
def get_display(self): # add a view action view_div = DivWdg() view_select = SelectWdg("action|view_action") view_select.add_style("text-align: right") view_select.add_empty_option("-- view --") view_select.set_option("values", "copy_url|add_my_view|edit|save|rename|delete|custom_property|custom_script") view_select.set_option("labels", "X Copy URL to this View|Add to My Views|Edit as Draft|Save Project View As|X Rename View|X Delete View|Add Custom Property|Add Custom Script") view_div.add_style("float: right") view_div.add(view_select) view_select.add_event("onchange", "spt.dg_table.view_action_cbk(this,'%s')" % self.table_id) return view_div
def get_display(my): widget = Widget() div = DivWdg(css="filter_box") show_span = SpanWdg(css="med") show_span.add("Show All Types: ") checkbox = FilterCheckboxWdg("show_all_types") checkbox.set_persistence() show_span.add(checkbox) show_all_types = checkbox.get_value() div.add(show_span) span = SpanWdg(css="med") span.add("Search Type: ") select = SelectWdg("filter|search_type") select.add_empty_option("-- Select --") project = Project.get() project_type = project.get_base_type() search = Search("sthpw/search_object") if show_all_types: search.add_where( """ namespace = '%s' or namespace = '%s' or search_type in ('sthpw/task') """ % (project_type, project.get_code()) ) else: # show only the custom ones search.add_filter("namespace", project.get_code()) search.add_order_by("title") sobjects = search.get_sobjects() select.set_sobjects_for_options(sobjects, "search_type", "title") # select.set_option("query", "sthpw/search_object|search_type|title") select.set_persistence() select.add_event("onchange", "document.form.submit()") search_type = select.get_value() span.add(select) div.add(span) # make sure the current selection exists try: SearchType.get(search_type) except SearchException, e: return div
def get_display(self): # add a view action view_div = DivWdg() view_select = SelectWdg("action|table") view_select.add_style("text-align: right") view_select.add_empty_option("-- items --") view_select.set_option("values", "add|edit|retire|delete|export_all|export_selected") view_select.set_option("labels", "Add New Item|X Edit Selected|Retire Selected|Delete Selected|X CSV Export (all)|X CSV Export (selected)") view_div.add_style("float: right") view_div.add(view_select) #view_select.add_event("onchange", "spt.dg_table.retire_selected_cbk('%s')" % self.target_id) view_select.add_event("onchange", "spt.dg_table.table_action_cbk(this,'%s')" % self.table_id ) return view_div
def get_display(my): widget = Widget() div = DivWdg(css="filter_box") show_span = SpanWdg(css='med') show_span.add('Show All Types: ') checkbox = FilterCheckboxWdg('show_all_types') checkbox.set_persistence() show_span.add(checkbox) show_all_types = checkbox.get_value() div.add(show_span) span = SpanWdg(css="med") span.add("Search Type: ") select = SelectWdg("filter|search_type") select.add_empty_option("-- Select --") project = Project.get() project_type = project.get_base_type() search = Search("sthpw/search_object") if show_all_types: search.add_where(''' namespace = '%s' or namespace = '%s' or search_type in ('sthpw/task') ''' % (project_type, project.get_code())) else: # show only the custom ones search.add_filter('namespace', project.get_code()) search.add_order_by("title") sobjects = search.get_sobjects() select.set_sobjects_for_options(sobjects, "search_type", "title") #select.set_option("query", "sthpw/search_object|search_type|title") select.set_persistence() select.add_event("onchange", "document.form.submit()") search_type = select.get_value() span.add(select) div.add(span) # make sure the current selection exists try: SearchType.get(search_type) except SearchException, e: return div
search_type = select.get_value() span.add(select) div.add(span) # make sure the current selection exists try: SearchType.get(search_type) except SearchException, e: return div except SqlException, e: return div # add the view selector view_select = SelectWdg("view") view_select.add_empty_option("-- View --") view_select.add_event("onchange", "document.form.submit()") view_select.set_persist_on_submit() #view_select.set_persistence() span = SpanWdg(css="med") span.add("Defined Views: ") span.add(view_select) div.add(span) div.add(my.get_create_view_wdg(search_type)) div.add(HtmlElement.br(2)) div.add(my.get_new_tab_wdg()) widget.add(div)
def get_display(self): top_wdg = DivWdg() top_wdg.add_style("color: black") top_wdg.add_style("width: 350px") top_wdg.add_style("margin-top: 10px") top_wdg.add_style("padding: 10px") top_wdg.add_border() title = DivWdg() title.add_style("color: black") title.add_style("margin-top: -22px") top_wdg.add(title) #if not self.name_string: # title.add('No database column') # return top_wdg title.add("Widget Definition") widget_types = { 'foreign_key': 'tactic.ui.table.ForeignKeyElementWdg', 'button': 'tactic.ui.table.ButtonElementWdg', 'expression': 'tactic.ui.table.ExpressionElementWdg' } web = WebContainer.get_web() config_string = web.get_form_value("config_xml") if not config_string: config_string = '<config/>' xml = Xml() xml.read_string(config_string) #print "config_string: ", config_string # get values from the config file element_name = xml.get_value('element/@name') config = WidgetConfig.get(view='element',xml='<config><element>%s</element></config>' % config_string) display_options = config.get_display_options(element_name) title = xml.get_value('element/@title') display_handler = xml.get_value('element/display/@class') if not display_handler: display_handler = 'tactic.ui.panel.TypeTableElementWdg' widget_name = xml.get_value('element/display/@widget') if not widget_name: widget_name = 'custom' custom_table = Table() custom_table.add_style("color: black") top_wdg.add(custom_table) name_text = DivWdg() name_text.add_style("color: black") name_text.add(element_name) custom_table.add_row() custom_table.add_cell("Name: ") custom_table.add_cell(name_text) # add title custom_table.add_row() title_wdg = TextWdg("custom_title") title_wdg.set_value(title) title_wdg.add_attr("size", "50") custom_table.add_cell( "Title: " ) custom_table.add_cell( title_wdg ) # add description #custom_table.add_row() #description_wdg = TextAreaWdg("custom_description") #td = custom_table.add_cell( "Description: " ) #td.add_style("vertical-align: top") #custom_table.add_cell( description_wdg ) type_select = SelectWdg("custom_type") #type_select.add_empty_option("-- Select --") type_select.set_option("values", "string|integer|float|boolean|currency|date|foreign_key|link|list|button|custom") type_select.set_option("labels", "String(db)|Integer(db)|Float(db)|Boolean(db)|Currency(db)|Date(db)|Foreign Key|Link|List|Button|Custom") type_select.set_value(widget_name) #type_select.set_option("values", "string|integer|float|boolean|currency|date|link|list|foreign_key|button|empty") #type_select.set_option("labels", "String|Integer|Float|Boolean|Currency|Date|Link|List|Foreign Key|Button|Empty") custom_table.add_row() td = custom_table.add_cell("Widget Type: ") td.add_style("vertical-align: top") td = custom_table.add_cell(type_select) type_select.add_event("onchange", "spt.CustomProject.property_type_select_cbk(this)") td.add(HtmlElement.br()) display_handler_text = TextWdg("display_handler") display_handler_text.add_attr("size", "50") display_handler_text.set_value(display_handler) td.add(display_handler_text) # extra info for foreign key custom_table.add_row() div = DivWdg() div.add_class("foreign_key_options") div.add_style("display: none") div.add_style("margin-top: 10px") div.add("Options") div.add(HtmlElement.br()) # extra info for foreign key custom_table.add_row() div = DivWdg() div.add_class("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 list custom_table.add_row() div = DivWdg() div.add_class("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) # extra info for button custom_table.add_row() div = DivWdg() div.add_style("color: black") div.add_class("button_options") div.add_style("display: none") div.add_style("margin-top: 10px") #class_path = "tactic.ui.table.ButtonElementWdg" class_path = display_handler button = Common.create_from_class_path(class_path) args_keys = button.get_args_keys() div.add("Options") div.add(HtmlElement.br()) for key in args_keys.keys(): option_name_text = HiddenWdg("option_name") option_name_text.set_value(key) div.add(option_name_text) div.add("%s: " % key) div.add(" ") input = button.get_input_by_arg_key(key) value = display_options.get(key) if value: input.set_value(value) div.add(input) div.add(HtmlElement.br()) td.add(div) # is searchable checkbox #custom_table.add_row() #current_searchable_wdg = CheckboxWdg("is_searchable") #current_view_wdg.set_checked() #custom_table.add_cell("Searchable? ") #td = custom_table.add_cell(current_searchable_wdg) custom_table.close_tbody() return top_wdg
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
def get_display(self): widget = Widget() div = DivWdg(css="filter_box") show_span = SpanWdg(css='med') show_span.add('Show All Types: ') checkbox = FilterCheckboxWdg('show_all_types') checkbox.set_persistence() show_span.add(checkbox) show_all_types = checkbox.get_value() div.add(show_span) span = SpanWdg(css="med") span.add("Search Type: ") select = SelectWdg("filter|search_type") select.add_empty_option("-- Select --") project = Project.get() project_type = project.get_base_type() search = Search("sthpw/search_object") if show_all_types: search.add_where(''' namespace = '%s' or namespace = '%s' or search_type in ('sthpw/task') ''' % (project_type, project.get_code()) ) else: # show only the custom ones search.add_filter('namespace', project.get_code() ) search.add_order_by("title") sobjects = search.get_sobjects() select.set_sobjects_for_options(sobjects,"search_type", "title") #select.set_option("query", "sthpw/search_object|search_type|title") select.set_persistence() select.add_event("onchange", "document.form.submit()") search_type = select.get_value() span.add(select) div.add(span) # make sure the current selection exists try: SearchType.get(search_type) except SearchException as e: return div except SqlException as e: return div # add the view selector view_select = SelectWdg("view") view_select.add_empty_option("-- View --") view_select.add_event("onchange", "document.form.submit()") view_select.set_persist_on_submit() #view_select.set_persistence() span = SpanWdg(css="med") span.add("Defined Views: ") span.add(view_select) div.add(span) div.add( self.get_create_view_wdg(search_type)) div.add( HtmlElement.br(2) ) div.add( self.get_new_tab_wdg() ) widget.add(div) search = Search("sthpw/widget_config") #search.add_user_filter() search.add_filter("search_type", search_type) search.add_where("view != 'definition' and view != 'custom'") #search.add_column("view") widget_configs = search.get_sobjects() if widget_configs: view_select.set_sobjects_for_options(widget_configs,"view","view") view = view_select.get_value() if not view: view = "custom" #return widget # get the selected widget config for widget_config in widget_configs: if widget_config.get_value("view") == view: break else: return widget # get the handler: a little HACKY. config_xml = widget_config.get_xml_value("config") handler = config_xml.get_value("config/%s/@handler" % view) if not search_type: return widget widget.add(HtmlElement.br()) span = SpanWdg() custom_view = CustomViewWdg(search_type) span.add(custom_view) span.add_style("float: right") widget.add(span) widget.add( HtmlElement.br() ) widget.add("<h3>Example View [%s]</h3>" % view) # add a general filter filter_div = DivWdg() for i in range(0,1): filter = GeneralFilterWdg() filter.set_columns_from_search_type(search_type) filter_div.add("Filter: ") filter_div.add(filter) #filter_div.add(IconWdg("Remove Filter", IconWdg.RETIRE)) filter_div.add( HtmlElement.br(2) ) widget.add(filter_div) search = Search(search_type) search.set_limit(5) filter.alter_search(search) if not handler: if view in ["edit","insert"]: table = EditWdg(search_type, view) else: table = TableWdg(search_type, view) else: table = eval("%s(search_type,view)" % handler) #table.alter_search(search) sobjects = search.get_sobjects() if not sobjects and view in ["edit","insert"]: sobjects = [SObjectFactory.create(search_type)] table.set_sobjects(sobjects) widget.add(table) # show the custom properties widget.add("<h3>Custom Properties [%s]</h3>" % search_type) search = Search("prod/custom_property") search.add_filter("search_type", search_type) # This is actually reading the sthpw/custom_property conf file, weird table = TableWdg("prod/custom_property") table.set_search_limit(5) table.set_sobjects(search.get_sobjects() ) widget.add(table) return widget
def handle_simple_mode(my, custom_table, mode): tbody = custom_table.add_tbody() tbody.add_class("spt_custom_simple") if mode != 'simple': tbody.add_style('display: none') name_text = TextWdg("custom_name") name_text.add_class("spt_input") tr = custom_table.add_row() tr.add_color("background", "background", -7) td = custom_table.add_cell("Name: ") td.add_style("min-width: 150px") custom_table.add_cell(name_text) # add title custom_table.add_row() title_wdg = TextWdg("custom_title") title_wdg.add_attr("size", "50") custom_table.add_cell( "Title: " ) custom_table.add_cell( title_wdg ) # add description tr = custom_table.add_row() tr.add_color("background", "background", -7) description_wdg = TextAreaWdg("custom_description") custom_table.add_cell( "Description: " ) custom_table.add_cell( description_wdg ) type_select = SelectWdg("custom_type") type_select.add_class("spt_input") #type_select.add_empty_option("-- Select --") type_select.set_option("values", "string|text|integer|float|boolean|currency|date|foreign_key|list|button|empty") type_select.set_option("labels", "String(db)|Text(db)|Integer(db)|Float(db)|Boolean(db)|Currency(db)|Date(db)|Foreign Key(db)|List(db)|Button|Empty") #type_select.set_option("labels", "String|Integer|Boolean|Currency|Timestamp|Link|Foreign Key|List|Checkbox|Text|Number|Date|Date Range") tr = custom_table.add_row() custom_table.add_cell("Property Type: ") td = custom_table.add_cell(type_select) type_select.add_event("onchange", "spt.custom_property_adder.property_type_select_cbk(this)") # extra info for foreign key custom_table.add_row() div = DivWdg() div.add_class("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 list custom_table.add_row() div = DivWdg() div.add_class("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) # extra info for button custom_table.add_row() div = DivWdg() div.add_class("button_options") div.add_style("display: none") div.add_style("margin-top: 10px") class_path = "tactic.ui.table.ButtonElementWdg" button = Common.create_from_class_path(class_path) args_keys = button.get_args_keys() div.add("Options") div.add(HtmlElement.br()) for key in args_keys.keys(): div.add("Name: ") option_name_text = TextWdg("option_name") option_name_text.add_attr("readonly", "true") option_name_text.set_value(key) div.add(option_name_text) div.add(" ") div.add("Value: ") input = button.get_input_by_arg_key(key) div.add(input) #option_value_text = TextWdg("option_value") #div.add(option_value_text) div.add(HtmlElement.br()) td.add(div) # is searchable checkbox tr = custom_table.add_row() tr.add_color("background", "background", -7) current_searchable_wdg = CheckboxWdg("is_searchable") #current_view_wdg.set_checked() custom_table.add_cell("Is Searchable? ") td = custom_table.add_cell(current_searchable_wdg) custom_table.close_tbody()
def handle_simple_mode(self, custom_table, mode): tbody = custom_table.add_tbody() tbody.add_class("spt_custom_simple") if mode != 'simple': tbody.add_style('display: none') name_text = TextWdg("custom_name") name_text.add_class("spt_input") tr = custom_table.add_row() tr.add_color("background", "background", -7) td = custom_table.add_cell("Name: ") td.add_style("min-width: 150px") custom_table.add_cell(name_text) # add title custom_table.add_row() title_wdg = TextWdg("custom_title") title_wdg.add_attr("size", "50") custom_table.add_cell("Title: ") custom_table.add_cell(title_wdg) # add description tr = custom_table.add_row() tr.add_color("background", "background", -7) description_wdg = TextAreaWdg("custom_description") custom_table.add_cell("Description: ") custom_table.add_cell(description_wdg) type_select = SelectWdg("custom_type") type_select.add_class("spt_input") #type_select.add_empty_option("-- Select --") type_select.set_option( "values", "string|text|integer|float|boolean|currency|date|foreign_key|list|button|empty" ) type_select.set_option( "labels", "String(db)|Text(db)|Integer(db)|Float(db)|Boolean(db)|Currency(db)|Date(db)|Foreign Key(db)|List(db)|Button|Empty" ) #type_select.set_option("labels", "String|Integer|Boolean|Currency|Timestamp|Link|Foreign Key|List|Checkbox|Text|Number|Date|Date Range") tr = custom_table.add_row() custom_table.add_cell("Property Type: ") td = custom_table.add_cell(type_select) type_select.add_event( "onchange", "spt.custom_property_adder.property_type_select_cbk(this)") # extra info for foreign key custom_table.add_row() div = DivWdg() div.add_class("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 list custom_table.add_row() div = DivWdg() div.add_class("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) # extra info for button custom_table.add_row() div = DivWdg() div.add_class("button_options") div.add_style("display: none") div.add_style("margin-top: 10px") class_path = "tactic.ui.table.ButtonElementWdg" button = Common.create_from_class_path(class_path) args_keys = button.get_args_keys() div.add("Options") div.add(HtmlElement.br()) for key in args_keys.keys(): div.add("Name: ") option_name_text = TextWdg("option_name") option_name_text.add_attr("readonly", "true") option_name_text.set_value(key) div.add(option_name_text) div.add(" ") div.add("Value: ") input = button.get_input_by_arg_key(key) div.add(input) #option_value_text = TextWdg("option_value") #div.add(option_value_text) div.add(HtmlElement.br()) td.add(div) # is searchable checkbox tr = custom_table.add_row() tr.add_color("background", "background", -7) current_searchable_wdg = CheckboxWdg("is_searchable") #current_view_wdg.set_checked() custom_table.add_cell("Is Searchable? ") td = custom_table.add_cell(current_searchable_wdg) custom_table.close_tbody()
def get_display(my): div = DivWdg() div.add_style("padding: 10px 0px 10px 0px") behavior = {"type": "keyboard", "kbd_handler_name": "DgTableMultiLineTextEdit"} div.add_behavior(behavior) project_code = None sobject = my.get_current_sobject() if sobject: project_code = sobject.get_project_code() project_filter = Project.get_project_filter(project_code) query_filter = my.get_option("query_filter") if not query_filter: # try getting it from the search_type web = WebContainer.get_web() search_type = web.get_form_value("search_type") if search_type: search_type_obj = SearchType.get(search_type) base_search_type = search_type_obj.get_base_search_type() query_filter = "search_type = '%s'" % base_search_type # add the project filter if query_filter: query_filter = "%s and %s" % (query_filter, project_filter) else: query_filter = project_filter my.set_option("query_filter", query_filter) select = SelectWdg() select.add_empty_option("-- Select --") select.copy(my) select.add_event("onchange", "alert('cow')") div.add(select) span = SpanWdg(css="med") span.add("Add Initial Tasks: ") checkbox = CheckboxWdg("add_initial_tasks") checkbox.set_persistence() if checkbox.is_checked(False): checkbox.set_checked() span.add(checkbox) div.add(span) # list all of the processes with checkboxes pipeline_code = select.get_value() if pipeline_code: pipeline = Pipeline.get_by_code(pipeline_code) if not pipeline: print "WARNING: pipeline '%s' does not exist" % pipeline_code return process_names = pipeline.get_process_names(recurse=True) process_div = DivWdg() for process in process_names: checkbox = CheckboxWdg("add_initial_tasks") process_div.add(checkbox) process_div.add(" ") process_div.add(process) process_div.add(HtmlElement.br()) div.add(process_div) return div
search_type = select.get_value() span.add(select) div.add(span) # make sure the current selection exists try: SearchType.get(search_type) except SearchException, e: return div except SqlException, e: return div # add the view selector view_select = SelectWdg("view") view_select.add_empty_option("-- View --") view_select.add_event("onchange", "document.form.submit()") view_select.set_persist_on_submit() # view_select.set_persistence() span = SpanWdg(css="med") span.add("Defined Views: ") span.add(view_select) div.add(span) div.add(my.get_create_view_wdg(search_type)) div.add(HtmlElement.br(2)) div.add(my.get_new_tab_wdg()) widget.add(div)
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
def get_first_row_wdg(my): # read the csv file my.file_path = "" div = DivWdg() div.add( my.get_upload_wdg() ) if not my.search_type: return div if not my.file_path: return div if not my.file_path.endswith(".csv"): div.add( "Uploaded file [%s] is not a csv file"% my.file_path) return div if not os.path.exists(my.file_path): raise Exception("Path '%s' does not exists" % my.file_path) div.add(HtmlElement.br(2)) div.add( HtmlElement.b("The following is taken from first line in the uploaded csv file. Select the appropriate column to match.") ) div.add(HtmlElement.br()) div.add( HtmlElement.b("Make sure you have all the required columns** in the csv.")) option_div = DivWdg() option_div.add_style("float: left") option_div.add_style("margin-right: 30px") option_div.add("<p>3. Parsing Options:</p>") my.search_type_obj = SearchType.get(my.search_type) # first row and second row option_div.add( HtmlElement.br(2) ) option_div.add("Use Title Row: ") title_row_checkbox = FilterCheckboxWdg("has_title") title_row_checkbox.set_default_checked() option_div.add(title_row_checkbox) option_div.add( HintWdg("Set this to use the first row as a title row to match up columns in the database") ) option_div.add( HtmlElement.br(2) ) option_div.add("Sample Data Row: ") data_row_text = TextWdg("data_row") data_row_text.set_attr("size", "3") option_div.add(data_row_text) option_div.add( HintWdg("Set this as a sample data row to match the columns to the database") ) option_div.add( HtmlElement.br(2) ) div.add(option_div) my.has_title = title_row_checkbox.is_checked() # parse the first fow csv_parser = CsvParser(my.file_path) if my.has_title: csv_parser.set_has_title_row(True) else: csv_parser.set_has_title_row(False) csv_parser.parse() csv_titles = csv_parser.get_titles() csv_data = csv_parser.get_data() data_row = data_row_text.get_value() if not data_row: data_row = 0 else: try: data_row = int(data_row) except ValueError: data_row = 0 if data_row >= len(csv_data): data_row = len(csv_data)-1 data_row_text.set_value(data_row) table = Table() table.set_attr("cellpadding", "10") table.add_row() table.add_header("CSV Column Value") table.add_header("TACTIC Column") table.add_header("Create New Column") columns = my.search_type_obj.get_columns() search_type = my.search_type_obj.get_base_search_type() sobj = SObjectFactory.create(search_type) required_columns = sobj.get_required_columns() row = csv_data[data_row] labels = [] for column in columns: if column in required_columns: label = '%s**'%column else: label = column labels.append(label) for j, cell in enumerate(row): table.add_row() table.add_cell(cell) column_select = SelectWdg("column_%s" % j) column_select.add_event("onchange", "if (this.value!='') {set_display_off('new_column_div_%s')} else {set_display_on('new_column_div_%s')}" % (j,j)) column_select.add_empty_option("-- Select --") column_select.set_option("values", columns) column_select.set_option("labels", labels) # only set the value if it is actually in there if csv_titles[j] in columns: column_select.set_option("default", csv_titles[j]) column_select.set_persist_on_submit() column_select_value = column_select.get_value() display = column_select.get_buffer_display() td = table.add_cell( display ) if csv_titles[j] not in columns: td.add(" <b style='color: red'>*</b>") # new property new_column_div = DivWdg() if column_select_value: new_column_div.add_style("display", "none") else: new_column_div.add_style("display", "block") new_column_div.set_id("new_column_div_%s" % j) td = table.add_cell( new_column_div ) text = TextWdg("new_column_%s" % j) text.set_persist_on_submit() if my.has_title: text.set_value(csv_titles[j]) new_column_div.add( " ... or ..." ) new_column_div.add( text ) my.num_columns = len(row) hidden = HiddenWdg("num_columns", my.num_columns) # need to somehow specify defaults for columns div.add(table) div.add("<br/><br/>") div.add(my.get_preview_wdg()) return div
def get_display(my): top_wdg = DivWdg() top_wdg.add_style("color: black") top_wdg.add_style("width: 350px") top_wdg.add_style("margin-top: 10px") top_wdg.add_style("padding: 10px") top_wdg.add_border() title = DivWdg() title.add_style("color: black") title.add_style("margin-top: -22px") top_wdg.add(title) #if not my.name_string: # title.add('No database column') # return top_wdg title.add("Widget Definition") widget_types = { 'foreign_key': 'tactic.ui.table.ForeignKeyElementWdg', 'button': 'tactic.ui.table.ButtonElementWdg', 'expression': 'tactic.ui.table.ExpressionElementWdg' } web = WebContainer.get_web() config_string = web.get_form_value("config_xml") if not config_string: config_string = '<config/>' xml = Xml() xml.read_string(config_string) #print "config_string: ", config_string # get values from the config file element_name = xml.get_value('element/@name') config = WidgetConfig.get( view='element', xml='<config><element>%s</element></config>' % config_string) display_options = config.get_display_options(element_name) title = xml.get_value('element/@title') display_handler = xml.get_value('element/display/@class') if not display_handler: display_handler = 'tactic.ui.panel.TypeTableElementWdg' widget_name = xml.get_value('element/display/@widget') if not widget_name: widget_name = 'custom' custom_table = Table() custom_table.add_style("color: black") top_wdg.add(custom_table) name_text = DivWdg() name_text.add_style("color: black") name_text.add(element_name) custom_table.add_row() custom_table.add_cell("Name: ") custom_table.add_cell(name_text) # add title custom_table.add_row() title_wdg = TextWdg("custom_title") title_wdg.set_value(title) title_wdg.add_attr("size", "50") custom_table.add_cell("Title: ") custom_table.add_cell(title_wdg) # add description #custom_table.add_row() #description_wdg = TextAreaWdg("custom_description") #td = custom_table.add_cell( "Description: " ) #td.add_style("vertical-align: top") #custom_table.add_cell( description_wdg ) type_select = SelectWdg("custom_type") #type_select.add_empty_option("-- Select --") type_select.set_option( "values", "string|integer|float|boolean|currency|date|foreign_key|link|list|button|custom" ) type_select.set_option( "labels", "String(db)|Integer(db)|Float(db)|Boolean(db)|Currency(db)|Date(db)|Foreign Key|Link|List|Button|Custom" ) type_select.set_value(widget_name) #type_select.set_option("values", "string|integer|float|boolean|currency|date|link|list|foreign_key|button|empty") #type_select.set_option("labels", "String|Integer|Float|Boolean|Currency|Date|Link|List|Foreign Key|Button|Empty") custom_table.add_row() td = custom_table.add_cell("Widget Type: ") td.add_style("vertical-align: top") td = custom_table.add_cell(type_select) type_select.add_event( "onchange", "spt.CustomProject.property_type_select_cbk(this)") td.add(HtmlElement.br()) display_handler_text = TextWdg("display_handler") display_handler_text.add_attr("size", "50") display_handler_text.set_value(display_handler) td.add(display_handler_text) # extra info for foreign key custom_table.add_row() div = DivWdg() div.add_class("foreign_key_options") div.add_style("display: none") div.add_style("margin-top: 10px") div.add("Options") div.add(HtmlElement.br()) # extra info for foreign key custom_table.add_row() div = DivWdg() div.add_class("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 list custom_table.add_row() div = DivWdg() div.add_class("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) # extra info for button custom_table.add_row() div = DivWdg() div.add_style("color: black") div.add_class("button_options") div.add_style("display: none") div.add_style("margin-top: 10px") #class_path = "tactic.ui.table.ButtonElementWdg" class_path = display_handler button = Common.create_from_class_path(class_path) args_keys = button.get_args_keys() div.add("Options") div.add(HtmlElement.br()) for key in args_keys.keys(): option_name_text = HiddenWdg("option_name") option_name_text.set_value(key) div.add(option_name_text) div.add("%s: " % key) div.add(" ") input = button.get_input_by_arg_key(key) value = display_options.get(key) if value: input.set_value(value) div.add(input) div.add(HtmlElement.br()) td.add(div) # is searchable checkbox #custom_table.add_row() #current_searchable_wdg = CheckboxWdg("is_searchable") #current_view_wdg.set_checked() #custom_table.add_cell("Searchable? ") #td = custom_table.add_cell(current_searchable_wdg) custom_table.close_tbody() return top_wdg
def get_first_row_wdg(self): # read the csv file self.file_path = "" div = DivWdg() div.add(self.get_upload_wdg()) if not self.search_type: return div if not self.file_path: return div if not self.file_path.endswith(".csv"): div.add("Uploaded file [%s] is not a csv file" % self.file_path) return div if not os.path.exists(self.file_path): raise Exception("Path '%s' does not exists" % self.file_path) div.add(HtmlElement.br(2)) div.add( HtmlElement. b("The following is taken from first line in the uploaded csv file. Select the appropriate column to match." )) div.add(HtmlElement.br()) div.add( HtmlElement.b( "Make sure you have all the required columns** in the csv.")) option_div = DivWdg() option_div.add_style("float: left") option_div.add_style("margin-right: 30px") option_div.add("<p>3. Parsing Options:</p>") self.search_type_obj = SearchType.get(self.search_type) # first row and second row option_div.add(HtmlElement.br(2)) option_div.add("Use Title Row: ") title_row_checkbox = FilterCheckboxWdg("has_title") title_row_checkbox.set_default_checked() option_div.add(title_row_checkbox) option_div.add( HintWdg( "Set this to use the first row as a title row to match up columns in the database" )) option_div.add(HtmlElement.br(2)) option_div.add("Sample Data Row: ") data_row_text = TextWdg("data_row") data_row_text.set_attr("size", "3") option_div.add(data_row_text) option_div.add( HintWdg( "Set this as a sample data row to match the columns to the database" )) option_div.add(HtmlElement.br(2)) div.add(option_div) self.has_title = title_row_checkbox.is_checked() # parse the first fow csv_parser = CsvParser(self.file_path) if self.has_title: csv_parser.set_has_title_row(True) else: csv_parser.set_has_title_row(False) csv_parser.parse() csv_titles = csv_parser.get_titles() csv_data = csv_parser.get_data() data_row = data_row_text.get_value() if not data_row: data_row = 0 else: try: data_row = int(data_row) except ValueError: data_row = 0 if data_row >= len(csv_data): data_row = len(csv_data) - 1 data_row_text.set_value(data_row) table = Table() table.set_attr("cellpadding", "10") table.add_row() table.add_header("CSV Column Value") table.add_header("TACTIC Column") table.add_header("Create New Column") columns = self.search_type_obj.get_columns() search_type = self.search_type_obj.get_base_search_type() sobj = SObjectFactory.create(search_type) required_columns = sobj.get_required_columns() row = csv_data[data_row] labels = [] for column in columns: if column in required_columns: label = '%s**' % column else: label = column labels.append(label) for j, cell in enumerate(row): table.add_row() table.add_cell(cell) column_select = SelectWdg("column_%s" % j) column_select.add_event( "onchange", "if (this.value!='') {set_display_off('new_column_div_%s')} else {set_display_on('new_column_div_%s')}" % (j, j)) column_select.add_empty_option("-- Select --") column_select.set_option("values", columns) column_select.set_option("labels", labels) # only set the value if it is actually in there if csv_titles[j] in columns: column_select.set_option("default", csv_titles[j]) column_select.set_persist_on_submit() column_select_value = column_select.get_value() display = column_select.get_buffer_display() td = table.add_cell(display) if csv_titles[j] not in columns: td.add(" <b style='color: red'>*</b>") # new property new_column_div = DivWdg() if column_select_value: new_column_div.add_style("display", "none") else: new_column_div.add_style("display", "block") new_column_div.set_id("new_column_div_%s" % j) td = table.add_cell(new_column_div) text = TextWdg("new_column_%s" % j) text.set_persist_on_submit() if self.has_title: text.set_value(csv_titles[j]) new_column_div.add(" ... or ...") new_column_div.add(text) self.num_columns = len(row) hidden = HiddenWdg("num_columns", self.num_columns) # need to somehow specify defaults for columns div.add(table) div.add("<br/><br/>") div.add(self.get_preview_wdg()) return div
def init(my): search = Search("sthpw/queue") search.add_order_by("priority desc") search.add_order_by("timestamp desc") widget = Widget() div = DivWdg(css="filter_box") span = SpanWdg(css="med") from pyasm.prod.web import SearchFilterWdg search_filter = SearchFilterWdg(columns=Queue.get_search_columns()) search_filter.alter_search(search) span.add(search_filter) div.add(span) span = SpanWdg(css="med") priority_wdg = TextWdg("priority_search") priority_wdg.set_persistence() priority = priority_wdg.get_value() if priority: search.add_filter("priority", priority) span.add("Priority: ") span.add(priority_wdg) div.add(span) select = SelectWdg("queue_state") select.set_option("values", "|pending|locked|error|done") select.set_option("labels", "All|pending|locked|error|done") select.add_event("onchange", "document.form.submit()") select.set_persistence() span = SpanWdg(css="med") span.add("State: ") span.add(select) div.add(span) queue_state = select.get_value() if queue_state != "": search.add_filter("state", queue_state) user_select = SelectWdg("user_select") user_select.add_empty_option() user_search = Search("sthpw/login") user_select.set_search_for_options(user_search, "login", "login") user_select.add_event("onchange", "document.form.submit()") user_select.set_persistence() div.add("User: "******"": search.add_filter("login", queue_user) search_limit = SearchLimitWdg() search_limit.set_limit(10) div.add(search_limit) search_limit.alter_search(search) widget.add(div) sobjects = search.get_sobjects() table = TableWdg("sthpw/queue") table.set_sobjects(sobjects) widget.add(table) my.add(widget)
def init(my): search = Search("sthpw/queue") search.add_order_by("priority desc") search.add_order_by("timestamp desc") widget = Widget() div = DivWdg(css="filter_box") span = SpanWdg(css="med") from pyasm.prod.web import SearchFilterWdg search_filter = SearchFilterWdg(columns=Queue.get_search_columns()) search_filter.alter_search(search) span.add(search_filter) div.add(span) span = SpanWdg(css="med") priority_wdg = TextWdg("priority_search") priority_wdg.set_persistence() priority = priority_wdg.get_value() if priority: search.add_filter("priority", priority) span.add("Priority: ") span.add(priority_wdg) div.add(span) select = SelectWdg("queue_state") select.set_option("values", "|pending|locked|error|done") select.set_option("labels", "All|pending|locked|error|done") select.add_event("onchange", "document.form.submit()") select.set_persistence() span = SpanWdg(css="med") span.add("State: ") span.add(select) div.add(span) queue_state = select.get_value() if queue_state != "": search.add_filter("state", queue_state) user_select = SelectWdg("user_select") user_select.add_empty_option() user_search = Search("sthpw/login") user_select.set_search_for_options(user_search, "login", "login") user_select.add_event("onchange", "document.form.submit()") user_select.set_persistence() div.add("User: "******"": search.add_filter("login", queue_user) search_limit = SearchLimitWdg() search_limit.set_limit(10) div.add(search_limit) search_limit.alter_search(search) widget.add(div) sobjects = search.get_sobjects() table = TableWdg("sthpw/queue") table.set_sobjects(sobjects) widget.add(table) my.add(widget)
def get_display(self): div = DivWdg() div.add_style("padding: 10px 0px 10px 0px") behavior = { 'type': 'keyboard', 'kbd_handler_name': 'DgTableMultiLineTextEdit' } div.add_behavior(behavior) project_code = None sobject = self.get_current_sobject() if sobject: project_code = sobject.get_project_code() project_filter = Project.get_project_filter(project_code) query_filter = self.get_option("query_filter") if not query_filter: # try getting it from the search_type web = WebContainer.get_web() search_type = web.get_form_value("search_type") if search_type: search_type_obj = SearchType.get(search_type) base_search_type = search_type_obj.get_base_search_type() query_filter = "search_type = '%s'" % base_search_type # add the project filter if query_filter: query_filter = "%s and %s" % (query_filter, project_filter) else: query_filter = project_filter self.set_option("query_filter", query_filter) select = SelectWdg() select.add_empty_option("-- Select --") select.copy(self) select.add_event("onchange", "alert('cow')") div.add(select) span = SpanWdg(css="med") span.add("Add Initial Tasks: ") checkbox = CheckboxWdg("add_initial_tasks") checkbox.set_persistence() if checkbox.is_checked(False): checkbox.set_checked() span.add(checkbox) div.add(span) # list all of the processes with checkboxes pipeline_code = select.get_value() if pipeline_code: pipeline = Pipeline.get_by_code(pipeline_code) if not pipeline: print "WARNING: pipeline '%s' does not exist" % pipeline_code return process_names = pipeline.get_process_names(recurse=True) process_div = DivWdg() for process in process_names: checkbox = CheckboxWdg("add_initial_tasks") process_div.add(checkbox) process_div.add(" ") process_div.add(process) process_div.add(HtmlElement.br()) div.add(process_div) return div
def get_display(self): widget = Widget() div = DivWdg(css="filter_box") show_span = SpanWdg(css='med') show_span.add('Show All Types: ') checkbox = FilterCheckboxWdg('show_all_types') checkbox.set_persistence() show_span.add(checkbox) show_all_types = checkbox.get_value() div.add(show_span) span = SpanWdg(css="med") span.add("Search Type: ") select = SelectWdg("filter|search_type") select.add_empty_option("-- Select --") project = Project.get() project_type = project.get_base_type() search = Search("sthpw/search_object") if show_all_types: search.add_where(''' namespace = '%s' or namespace = '%s' or search_type in ('sthpw/task') ''' % (project_type, project.get_code())) else: # show only the custom ones search.add_filter('namespace', project.get_code()) search.add_order_by("title") sobjects = search.get_sobjects() select.set_sobjects_for_options(sobjects, "search_type", "title") #select.set_option("query", "sthpw/search_object|search_type|title") select.set_persistence() select.add_event("onchange", "document.form.submit()") search_type = select.get_value() span.add(select) div.add(span) # make sure the current selection exists try: SearchType.get(search_type) except SearchException as e: return div except SqlException as e: return div # add the view selector view_select = SelectWdg("view") view_select.add_empty_option("-- View --") view_select.add_event("onchange", "document.form.submit()") view_select.set_persist_on_submit() #view_select.set_persistence() span = SpanWdg(css="med") span.add("Defined Views: ") span.add(view_select) div.add(span) div.add(self.get_create_view_wdg(search_type)) div.add(HtmlElement.br(2)) div.add(self.get_new_tab_wdg()) widget.add(div) search = Search("sthpw/widget_config") #search.add_user_filter() search.add_filter("search_type", search_type) search.add_where("view != 'definition' and view != 'custom'") #search.add_column("view") widget_configs = search.get_sobjects() if widget_configs: view_select.set_sobjects_for_options(widget_configs, "view", "view") view = view_select.get_value() if not view: view = "custom" #return widget # get the selected widget config for widget_config in widget_configs: if widget_config.get_value("view") == view: break else: return widget # get the handler: a little HACKY. config_xml = widget_config.get_xml_value("config") handler = config_xml.get_value("config/%s/@handler" % view) if not search_type: return widget widget.add(HtmlElement.br()) span = SpanWdg() custom_view = CustomViewWdg(search_type) span.add(custom_view) span.add_style("float: right") widget.add(span) widget.add(HtmlElement.br()) widget.add("<h3>Example View [%s]</h3>" % view) # add a general filter filter_div = DivWdg() for i in range(0, 1): filter = GeneralFilterWdg() filter.set_columns_from_search_type(search_type) filter_div.add("Filter: ") filter_div.add(filter) #filter_div.add(IconWdg("Remove Filter", IconWdg.RETIRE)) filter_div.add(HtmlElement.br(2)) widget.add(filter_div) search = Search(search_type) search.set_limit(5) filter.alter_search(search) if not handler: if view in ["edit", "insert"]: table = EditWdg(search_type, view) else: table = TableWdg(search_type, view) else: table = eval("%s(search_type,view)" % handler) #table.alter_search(search) sobjects = search.get_sobjects() if not sobjects and view in ["edit", "insert"]: sobjects = [SObjectFactory.create(search_type)] table.set_sobjects(sobjects) widget.add(table) # show the custom properties widget.add("<h3>Custom Properties [%s]</h3>" % search_type) search = Search("prod/custom_property") search.add_filter("search_type", search_type) # This is actually reading the sthpw/custom_property conf file, weird table = TableWdg("prod/custom_property") table.set_search_limit(5) table.set_sobjects(search.get_sobjects()) widget.add(table) return widget