def get_display(my): from pyasm.biz import Project security = Environment.get_security() if not security.check_access("builtin", "side_bar_schema", "allow", default="deny"): return DivWdg() section_div = LabeledHidableWdg(label="Schema Views") section_div.set_attr('spt_class_name', Common.get_full_class_name(my) ) palette = Palette.get() color = palette.color("background3") project_div = RoundedCornerDivWdg(hex_color_code=color,corner_size="10") project_div.set_dimensions( width_str='175px', content_height_str='100px' ) project = Project.get() project_code = project.get_code() project_type = project.get_type() div = DivWdg() section_div.add(project_div) project_div.add(div) # get project type schema schema = Schema.get_by_code(project_code) if schema: div.add( my.get_schema_wdg(schema) ) #if not project_type: # raise SetupException("Project type not found for this [%s]" %project_code) if project_type: schema = Schema.get_predefined_schema(project_type) if schema: div.add( my.get_schema_wdg(schema) ) schema = Schema.get_predefined_schema('config') div.add( my.get_schema_wdg(schema) ) schema = Schema.get_admin_schema() div.add( my.get_schema_wdg(schema) ) return section_div # create a fake schema project = Project.get() db_name = project.get_database() sql = DbContainer.get(db_name) tables = sql.get_tables() tables.sort() tables_str = "\n".join( ['<search_type name="%s"/>'%x for x in tables] ) # look at all of the search objects for mapped tables search = Search("sthpw/search_object") #search.add_where('''"namespace" = 'MMS' or namespace = '{project}' ''') search.add_filter("namespace", 'MMS') search.add_filter("namespace", '{project}') search.add_where("or") search_types = search.get_sobjects() #for search_type in search_types: # print "hhhh: ", search_type schema_xml = ''' <schema> %s </schema> ''' % tables_str schema = SearchType.create("sthpw/schema") schema.set_value("code", "table") schema.set_value("schema", schema_xml) #div.add( my.get_schema_wdg(schema) ) return section_div
def get_display(self): from pyasm.biz import Project security = Environment.get_security() if not security.check_access("builtin", "side_bar_schema", "allow", default="deny"): return DivWdg() section_div = LabeledHidableWdg(label="Schema Views") section_div.set_attr('spt_class_name', Common.get_full_class_name(self) ) palette = Palette.get() color = palette.color("background3") project_div = RoundedCornerDivWdg(hex_color_code=color,corner_size="10") project_div.set_dimensions( width_str='175px', content_height_str='100px' ) project = Project.get() project_code = project.get_code() project_type = project.get_type() div = DivWdg() section_div.add(project_div) project_div.add(div) # get project type schema schema = Schema.get_by_code(project_code) if schema: div.add( self.get_schema_wdg(schema) ) #if not project_type: # raise SetupException("Project type not found for this [%s]" %project_code) if project_type: schema = Schema.get_predefined_schema(project_type) if schema: div.add( self.get_schema_wdg(schema) ) schema = Schema.get_predefined_schema('config') div.add( self.get_schema_wdg(schema) ) schema = Schema.get_admin_schema() div.add( self.get_schema_wdg(schema) ) return section_div # create a fake schema project = Project.get() db_name = project.get_database() sql = DbContainer.get(db_name) tables = sql.get_tables() tables.sort() tables_str = "\n".join( ['<search_type name="%s"/>'%x for x in tables] ) # look at all of the search objects for mapped tables search = Search("sthpw/search_object") #search.add_where('''"namespace" = 'MMS' or namespace = '{project}' ''') search.add_filter("namespace", 'MMS') search.add_filter("namespace", '{project}') search.add_where("or") search_types = search.get_sobjects() schema_xml = ''' <schema> %s </schema> ''' % tables_str schema = SearchType.create("sthpw/schema") schema.set_value("code", "table") schema.set_value("schema", schema_xml) #div.add( self.get_schema_wdg(schema) ) return section_div
def get_display(self): self.config_search_type = self.kwargs.get("config_search_type") if not self.config_search_type: self.config_search_type = "SideBarWdg" title = self.kwargs.get('title') config = self.kwargs.get('config') view = self.kwargs.get('view') width = self.kwargs.get('width') #sortable = self.kwargs.get('sortable') if not width: width = "175" self.prefix = self.kwargs.get("prefix") if not self.prefix: self.prefix = "side_bar" self.mode = self.kwargs.get("mode") if not self.mode: self.mode = 'view' self.default = self.kwargs.get('default') == 'True' div = DivWdg() div.add_class("spt_section_top") div.set_attr("SPT_ACCEPT_DROP", "manageSideBar") # create the top widgets label = SpanWdg() label.add(title) label.add_style("font-size: 1.1em") section_div = LabeledHidableWdg(label=label) div.add(section_div) section_div.set_attr('spt_class_name', Common.get_full_class_name(self)) for name, value in self.kwargs.items(): if name == "config": continue section_div.set_attr("spt_%s" % name, value) bgcolor = label.get_color("background3") project_div = RoundedCornerDivWdg(hex_color_code=bgcolor, corner_size="10") project_div.set_dimensions(width_str='%spx' % width, content_height_str='100px') content_div = project_div.get_content_wdg() #project_div = DivWdg() #content_div = project_div section_div.add(project_div) content_div.add_class("spt_side_bar_content") content_div.add_attr("spt_view", view) if type(view) in types.StringTypes: view = [view] view_margin_top = '4px' web = WebContainer.get_web() for viewx in view: config = self.get_config(self.config_search_type, viewx, default=self.default) if not config: continue # make up a title title = DivWdg() title.add_gradient("background", "side_bar_title", 0, -15, default="background") title.add_color("color", "side_bar_title_color", default="color") title.add_styles( "margin-top: %s; margin-bottom: 3px; vertical-align: middle" % view_margin_top) if not web.is_IE(): title.add_styles("margin-left: -5px; margin-right: -5px;") title.add_looks("navmenu_header") title.add_style("height: 18px") title.add_style("padding-top: 2px") """ title = DivWdg() title.add_styles( "margin-top: %s; margin-bottom: 3px; vertical-align: middle" % view_margin_top ) if not web.is_IE(): title.add_styles( "margin-left: -10px; margin-right: -10px;") title.add_looks( "navmenu_header" ) """ # FIXME: not sure if this logic should be here. It basically # makes special titles for certain view names view_attrs = config.get_view_attributes() title_str = view_attrs.get("title") if not title_str: if viewx.startswith("self_view_"): title_str = "My Views" else: title_str = viewx title_str = Common.get_display_title(title_str) title_label = SpanWdg() title_label.add_styles("margin-left: 6px; padding-bottom: 2px;") title_label.add_looks("fnt_title_5 fnt_bold") title_label.add(title_str) title.add(title_label) content_div.add(title) info = {'counter': 10, 'view': viewx} self.generate_section(config, content_div, info) error_list = Container.get_seq(self.ERR_MSG) if error_list: span = SpanWdg() span.add_style('background', 'red') span.add('<br/>'.join(error_list)) content_div.add(span) Container.clear_seq(self.ERR_MSG) self.add_dummy(config, content_div) return div
def get_display(my): my.config_search_type = my.kwargs.get("config_search_type") if not my.config_search_type: my.config_search_type = "SideBarWdg" title = my.kwargs.get('title') config = my.kwargs.get('config') view = my.kwargs.get('view') width = my.kwargs.get('width') #sortable = my.kwargs.get('sortable') if not width: width = "175" my.prefix = my.kwargs.get("prefix") if not my.prefix: my.prefix = "side_bar" my.mode = my.kwargs.get("mode") if not my.mode: my.mode = 'view' my.default = my.kwargs.get('default') == 'True' div = DivWdg() div.add_class("spt_section_top") div.set_attr("SPT_ACCEPT_DROP", "manageSideBar") # create the top widgets label = SpanWdg() label.add(title) label.add_style("font-size: 1.1em") section_div = LabeledHidableWdg(label=label) div.add(section_div) section_div.set_attr('spt_class_name', Common.get_full_class_name(my)) for name, value in my.kwargs.items(): if name == "config": continue section_div.set_attr("spt_%s" % name, value) bgcolor = label.get_color("background3") project_div = RoundedCornerDivWdg(hex_color_code=bgcolor,corner_size="10") project_div.set_dimensions( width_str='%spx' % width, content_height_str='100px' ) content_div = project_div.get_content_wdg() #project_div = DivWdg() #content_div = project_div section_div.add( project_div ) content_div.add_class("spt_side_bar_content") content_div.add_attr("spt_view", view) if type(view) in types.StringTypes: view = [view] view_margin_top = '4px' web = WebContainer.get_web() for viewx in view: config = my.get_config(my.config_search_type, viewx, default=my.default) if not config: continue # make up a title title = DivWdg() title.add_gradient( "background", "side_bar_title", 0, -15, default="background" ) title.add_color( "color", "side_bar_title_color", default="color" ) title.add_styles( "margin-top: %s; margin-bottom: 3px; vertical-align: middle" % view_margin_top ) if not web.is_IE(): title.add_styles( "margin-left: -5px; margin-right: -5px;") title.add_looks( "navmenu_header" ) title.add_style( "height: 18px" ) title.add_style( "padding-top: 2px" ) """ title = DivWdg() title.add_styles( "margin-top: %s; margin-bottom: 3px; vertical-align: middle" % view_margin_top ) if not web.is_IE(): title.add_styles( "margin-left: -10px; margin-right: -10px;") title.add_looks( "navmenu_header" ) """ # FIXME: not sure if this logic should be here. It basically # makes special titles for certain view names view_attrs = config.get_view_attributes() title_str = view_attrs.get("title") if not title_str: if viewx.startswith("my_view_"): title_str = "My Views" else: title_str = viewx title_str = Common.get_display_title(title_str) title_label = SpanWdg() title_label.add_styles( "margin-left: 6px; padding-bottom: 2px;" ) title_label.add_looks( "fnt_title_5 fnt_bold" ) title_label.add( title_str ) title.add( title_label ) content_div.add( title ) info = { 'counter' : 10, 'view': viewx } my.generate_section( config, content_div, info ) error_list = Container.get_seq(my.ERR_MSG) if error_list: span = SpanWdg() span.add_style('background', 'red') span.add('<br/>'.join(error_list)) content_div.add(span) Container.clear_seq(my.ERR_MSG) my.add_dummy(config, content_div) return div