def get_new_tab_wdg(my): widget = Widget() span = SpanWdg() swap = SwapDisplayWdg.get_triangle_wdg() title = SpanWdg("Tab Creation") span.add(swap) span.add(title) span.add_style("float: left") widget.add(span) widget.add(HtmlElement.br()) # add the tab selector div = DivWdg() SwapDisplayWdg.create_swap_title(title, swap, div) tab_text = TextWdg("tab") tab_text.set_persistence() span = SpanWdg(css="med") span.add("Tab: ") span.add(tab_text) div.add(span) # parent index_text = TextWdg("parent_tab") index_text.set_persistence() span = SpanWdg(css="med") span.add("Parent Tab: ") span.add(index_text) span.add( HintWdg( "Enter the name of the tab that this will fall under. Leave empty to put on the main tab" )) div.add(span) # index index_text = TextWdg("index") index_text.set_attr("size", "4") index_text.set_persistence() span = SpanWdg(css="med") span.add("Index: ") span.add(index_text) span.add( HintWdg("Enter the numeric location for this tab to be placed")) div.add(span) WebContainer.register_cmd("CreateTabCmd") button = IconSubmitWdg("Create Tab", IconWdg.CREATE, True) div.add(button) widget.add(div) return widget
def get_new_tab_wdg(self): widget = Widget() span = SpanWdg() swap = SwapDisplayWdg.get_triangle_wdg() title = SpanWdg("Tab Creation") span.add(swap) span.add(title) span.add_style("float: left") widget.add(span) widget.add(HtmlElement.br() ) # add the tab selector div = DivWdg() SwapDisplayWdg.create_swap_title( title, swap, div) tab_text = TextWdg("tab") tab_text.set_persistence() span = SpanWdg(css="med") span.add("Tab: ") span.add(tab_text) div.add(span) # parent index_text = TextWdg("parent_tab") index_text.set_persistence() span = SpanWdg(css="med") span.add("Parent Tab: ") span.add(index_text) span.add(HintWdg("Enter the name of the tab that this will fall under. Leave empty to put on the main tab") ) div.add(span) # index index_text = TextWdg("index") index_text.set_attr("size", "4") index_text.set_persistence() span = SpanWdg(css="med") span.add("Index: ") span.add(index_text) span.add(HintWdg("Enter the numeric location for this tab to be placed") ) div.add(span) WebContainer.register_cmd("CreateTabCmd") button = IconSubmitWdg("Create Tab", IconWdg.CREATE, True) div.add(button) widget.add(div) return widget
def get_title(my): widget = Widget() """ search_key_wdg = HiddenWdg('search_key') search_key_wdg.get_value() widget.add(search_key_wdg) """ WebContainer.register_cmd("pyasm.flash.widget.RenderCbk") if not my.get_option("no_button"): render_button = IconSubmitWdg("Render", IconWdg.RENDER, True, add_hidden=True) widget.add(render_button) else: widget.add("Frame Info") float_button = IconSubmitWdg("Render", IconWdg.RENDER, add_hidden=False) span = SpanWdg(float_button, css="med") span.add_style("border-left", "1px solid #777") WebContainer.get_float_menu().add(span) return widget
def get_title(my): widget = Widget() ''' search_key_wdg = HiddenWdg('search_key') search_key_wdg.get_value() widget.add(search_key_wdg) ''' WebContainer.register_cmd("pyasm.flash.widget.RenderCbk") if not my.get_option("no_button"): render_button = IconSubmitWdg("Render", IconWdg.RENDER, True, \ add_hidden=True) widget.add(render_button) else: widget.add("Frame Info") float_button = IconSubmitWdg("Render", IconWdg.RENDER, add_hidden=False) span = SpanWdg(float_button, css='med') span.add_style("border-left", "1px solid #777") WebContainer.get_float_menu().add(span) return widget
def init(my): my.item_cls = my.kwargs.get('left_search_type') my.container_cls = my.kwargs.get('right_search_type') my.grouping_cls = my.kwargs.get('search_type') my.item_sobj = my.container_sobj = None # List the items search = Search(my.item_cls) my._order_search(search) items = search.get_sobjects() if items: my.item_sobj = items[0] #select = MultiSelectWdg("item_ids") #select.set_search_for_options(search,"login", "get_full_name()") user_span = SpanWdg(css='med') user_table = Table(css='table') user_table.add_style("margin-left: 6px") user_table.set_max_width() user_table.add_col(css='small') user_table.add_col() user_table.add_style("min-width: 14em") user_table.add_row_cell(search.get_search_type_obj()\ .get_description(), "heading") for item in items: user_table.add_row() checkbox = CheckboxWdg("item_ids") checkbox.set_option("value", item.get_primary_key_value() ) user_table.add_cell( checkbox ) project_code = item.get_value("project_code", no_exception=True) if project_code: user_table.add_cell( "[ %s ]" % project_code ) else: user_table.add_cell( "[ * ]" ) user_table.add_cell( item.get_description() ) user_span.add(user_table) # control widget in the middle control_div = DivWdg() control_div.add_style('padding: 100px 10px 0 10px') button = IconSubmitWdg(my.ADD_LABEL, "stock_insert-slide.png", True) button.add_style('padding: 2px 30px 4px 30px') control_div.add(button) main_table = Table(css='collapse') main_table.set_max_width() main_table.add_row(css='plain_bg') main_table.add_cell(user_span, 'valign_top') td = main_table.add_cell(control_div, 'valign_top') td.add_style('width','12em') main_table.add_cell(my._get_target_span(), 'valign_top') my.add(main_table) # register command here if my.item_sobj and my.container_sobj: marshaller = WebContainer.register_cmd("pyasm.widget.SObjectGroupCmd") marshaller.set_option("grouping_search_type", my.grouping_cls) marshaller.set_option("item_foreign_key", my.item_sobj.get_foreign_key()) marshaller.set_option("container_foreign_key", my.container_sobj.get_foreign_key())
def get_display(my): web = WebContainer.get_web() if not my.view: my.view = web.get_form_value("view") if not my.view: my.view = get_template_view() widget = Widget() widget.add( HiddenWdg("search_type", my.search_type) ) # get a list of all of the element names possible search_type_obj = SearchType.get(my.search_type) config = WidgetConfigView.get_by_search_type(my.search_type,DEFAULT_VIEW) if config: element_names = config.get_element_names() # FIXME: also get those from the default (not sure about this) config = WidgetConfigView.get_by_search_type(my.search_type,"default") if config: element_names.extend( config.get_element_names() ) if not element_names: element_names = [] # get the custom element names from config custom_config = WidgetConfigView.get_by_search_type(my.search_type,my.view) custom_element_names = custom_config.get_element_names() # get the custom properties search = Search("prod/custom_property") search.add_filter("search_type", my.search_type) custom_properties = search.get_sobjects() # action popup action_popup = my.action_popup action_popup.set_auto_hide(False) action_popup.set_submit(False) action_popup.add( HtmlElement.href("Add ...", "javascript:document.form.submit()") ) for custom_property in custom_properties: element_name = custom_property.get_name() if element_name not in custom_element_names: action_popup.add( " %s" % element_name, "add|%s" % element_name ) for element_name in element_names: if element_name not in custom_element_names: action_popup.add( " %s" % element_name, "add|%s" % element_name ) # add some standard properties if my.view in ["edit", "insert"]: for element_name in PREDEFINED_EDIT_ELEMENTS: if element_name not in custom_element_names: action_popup.add( " %s" % element_name, "add|%s" % element_name ) else: for element_name in PREDEFINED_ELEMENTS: if element_name not in custom_element_names: action_popup.add( " %s" % element_name, "add|%s" % element_name ) action_popup.add_separator() action_popup.add( HtmlElement.href("Remove ...", "javascript:document.form.submit()") ) for element_name in custom_element_names: action_popup.add( " %s" % element_name, "remove|%s" % element_name ) action_popup.add_separator() span = SpanWdg("New Custom ...", css="hand") iframe = WebContainer.get_iframe() url = WebContainer.get_web().get_widget_url() url.set_option("widget", "pyasm.widget.CustomAddPropertyWdg") url.set_option("search_type", my.search_type) url.set_option("view", my.view) action = iframe.get_on_script(url.to_string() ) span.add_event("onclick", action) action_popup.add( span ) WebContainer.register_cmd("pyasm.widget.CustomViewAction") widget.add(action_popup) return widget
def get_title(self): WebContainer.register_cmd("pyasm.prod.web.SObjectRenderCbk") render_button = IconSubmitWdg("Render", IconWdg.RENDER, False) return render_button
def get_title(self): WebContainer.register_cmd("pyasm.prod.web.SObjectRenderCbk") render_button = IconSubmitWdg("Render", IconWdg.RENDER, False) return render_button
def get_display(my): web = WebContainer.get_web() if not my.view: my.view = web.get_form_value("view") if not my.view: my.view = get_template_view() widget = Widget() widget.add( HiddenWdg("search_type", my.search_type) ) # get a list of all of the element names possible search_type_obj = SearchType.get(my.search_type) config = WidgetConfigView.get_by_search_type(my.search_type,DEFAULT_VIEW) if config: element_names = config.get_element_names() # FIXME: also get those from the default (not sure about this) config = WidgetConfigView.get_by_search_type(my.search_type,"default") if config: element_names.extend( config.get_element_names() ) if not element_names: element_names = [] # get the custom element names from config custom_config = WidgetConfigView.get_by_search_type(my.search_type,my.view) custom_element_names = custom_config.get_element_names() # get the custom properties search = Search("prod/custom_property") search.add_filter("search_type", my.search_type) custom_properties = search.get_sobjects() # action popup action_popup = my.action_popup action_popup.set_auto_hide(False) action_popup.set_submit(False) action_popup.add( HtmlElement.href("Add ...", "javascript:document.form.submit()") ) for custom_property in custom_properties: element_name = custom_property.get_name() if element_name not in custom_element_names: action_popup.add( " %s" % element_name, "add|%s" % element_name ) for element_name in element_names: if element_name not in custom_element_names: action_popup.add( " %s" % element_name, "add|%s" % element_name ) # add some standard properties if my.view in ["edit", "insert"]: for element_name in PREDEFINED_EDIT_ELEMENTS: if element_name not in custom_element_names: action_popup.add( " %s" % element_name, "add|%s" % element_name ) else: for element_name in PREDEFINED_ELEMENTS: if element_name not in custom_element_names: action_popup.add( " %s" % element_name, "add|%s" % element_name ) action_popup.add_separator() action_popup.add( HtmlElement.href("Remove ...", "javascript:document.form.submit()") ) for element_name in custom_element_names: action_popup.add( " %s" % element_name, "remove|%s" % element_name ) action_popup.add_separator() span = SpanWdg("New Custom ...", css="hand") iframe = WebContainer.get_iframe() url = WebContainer.get_web().get_widget_url() url.set_option("widget", "pyasm.widget.CustomAddPropertyWdg") url.set_option("search_type", my.search_type) url.set_option("view", my.view) action = iframe.get_on_script(url.to_string() ) span.add_event("onclick", action) action_popup.add( span ) WebContainer.register_cmd("pyasm.widget.CustomViewAction") widget.add(action_popup) return widget
def init(self): self.item_cls = self.kwargs.get('left_search_type') self.container_cls = self.kwargs.get('right_search_type') self.grouping_cls = self.kwargs.get('search_type') self.item_sobj = self.container_sobj = None # List the items search = Search(self.item_cls) self._order_search(search) items = search.get_sobjects() if items: self.item_sobj = items[0] #select = MultiSelectWdg("item_ids") #select.set_search_for_options(search,"login", "get_full_name()") user_span = SpanWdg(css='med') user_table = Table(css='table') user_table.add_style("margin-left: 6px") user_table.set_max_width() user_table.add_col(css='small') user_table.add_col() user_table.add_style("min-width: 14em") user_table.add_row_cell(search.get_search_type_obj()\ .get_description(), "heading") for item in items: user_table.add_row() checkbox = CheckboxWdg("item_ids") checkbox.set_option("value", item.get_primary_key_value()) user_table.add_cell(checkbox) project_code = item.get_value("project_code", no_exception=True) if project_code: user_table.add_cell("[ %s ]" % project_code) else: user_table.add_cell("[ * ]") user_table.add_cell(item.get_description()) user_span.add(user_table) # control widget in the middle control_div = DivWdg() control_div.add_style('padding: 100px 10px 0 10px') button = IconSubmitWdg(self.ADD_LABEL, "stock_insert-slide.png", True) button.add_style('padding: 2px 30px 4px 30px') control_div.add(button) main_table = Table(css='collapse') main_table.set_max_width() main_table.add_row(css='plain_bg') main_table.add_cell(user_span, 'valign_top') td = main_table.add_cell(control_div, 'valign_top') td.add_style('width', '12em') main_table.add_cell(self._get_target_span(), 'valign_top') self.add(main_table) # register command here if self.item_sobj and self.container_sobj: marshaller = WebContainer.register_cmd( "pyasm.widget.SObjectGroupCmd") marshaller.set_option("grouping_search_type", self.grouping_cls) marshaller.set_option("item_foreign_key", self.item_sobj.get_foreign_key()) marshaller.set_option("container_foreign_key", self.container_sobj.get_foreign_key())