def get_advanced_definition_wdg(self): # add the advanced entry advanced = DivWdg() advanced.add_style("margin-top: 10px") advanced.add_style("padding: 10px") advanced.add_border() title = DivWdg() title.add_style("color: black") title.add("Advanced - XML Column Definition") title.add_style("margin-top: -23") advanced.add(title) advanced.add("<br/>") input = TextAreaWdg("config_xml") input.set_id("config_xml") input.set_option("rows", "10") input.set_option("cols", "70") input.set_value(self.config_string) advanced.add(input) advanced.add(HtmlElement.br(2)) button_div = DivWdg() button_div.add_style("text-align: center") button = ActionButtonWdg(title="Save Definition") #button = ProdIconButtonWdg("Save Definition") button.add_event("onclick", "spt.custom_project.save_definition_cbk()") button_div.add(button) button_div.add_style("margin-left: 130px") advanced.add(button_div) return advanced
def get_header_wdg(self): outer = DivWdg() div = DivWdg() outer.add(div) div.add_color("background", "background", -3) div.add_style("padding: 5px") div.add_border() table = Table() table.add_style("margin-left: auto") table.add_style("margin-right: auto") table.add_color("color", "color") table.add_style("font-size: 1.5em") table.add_style("font-weight: bold") table.add_row() # add the month navigators date_str = "%s, %s" % (self.MONTHS[self.month - 1], self.year) month_wdg = DivWdg() month_wdg.add_style("width: 150px") month_wdg.add(date_str) prev_month_wdg = self.get_prev_month_wdg() next_month_wdg = self.get_next_month_wdg() table.add_cell(prev_month_wdg) td = table.add_cell(month_wdg) td.add_style("text-align: center") table.add_cell(next_month_wdg) div.add(table) return outer
def get_local_wdg(my): div = DivWdg() server = Config.get_value("install", "server") if not server: msg_div = DivWdg() msg_div.add(IconWdg("No local prefix set", IconWdg.WARNING)) msg_div.add( "WARNING: No local server prefix set. This will allow transactions to be merged properly with remote servers. Without a local prefix, it is highly likely that transactions will conflict" ) msg_div.add("<br/>" * 2) text = TextWdg("local_prefix") change_div = DivWdg() msg_div.add(change_div) change_div.add("Set Local Prefix: ") change_div.add(text) else: msg_div = DivWdg() msg_div.add(IconWdg("No local prefix set", IconWdg.CREATE)) msg_div.add("Local server set to [%s]" % server) msg_div.add_style("padding: 30px") msg_div.add_style("width: 80%") msg_div.add_color("background", "background3") msg_div.add_border() msg_div.add_style("text-align: center") div.add(msg_div) return div
def get_content_wdg(my): div = DivWdg() div.add_class("spt_tool_top") table = Table() div.add(table) table.add_row() td = table.add_cell() from table_layout_wdg import FastTableLayoutWdg kwargs = my.kwargs.copy() td.add_style("width: 1%") td.add_style("vertical-align: top") layout_div = DivWdg() layout_div.add_style("min-height: 500px") td.add(layout_div) element_names = my.kwargs.get("element_names") if not element_names: kwargs['element_names'] = [ 'name', 'description', 'detail', 'file_list', 'general_checkin' ] #kwargs['element_names'] = ['preview','name','detail', 'task_summary'] kwargs['show_shelf'] = False kwargs['show_search_limit'] = False layout = FastTableLayoutWdg(**kwargs) layout_div.add(layout) #from tactic.ui.panel import TileLayoutWdg #layout = TileLayoutWdg(**my.kwargs) #layout_div.add(layout) td = table.add_cell() td.add_border(color="#EEE") td.add_style("vertical-align: top") content = DivWdg() td.add(content) content.add_class("spt_tool_content") #content.add_style("margin: -1px") no_content_wdg = DivWdg() content.add(no_content_wdg) no_content_wdg.add("<br/>" * 3) no_content_wdg.add("<i>-- No Content --</i>") #no_content_wdg.add_style("opacity: 0.5") no_content_wdg.add_style("margin: 30px auto") no_content_wdg.add_color("color", "color3") no_content_wdg.add_color("background", "background3") no_content_wdg.add_style("text-align", "center") no_content_wdg.add_style("padding-top: 20px") no_content_wdg.add_style("padding-bottom: 20px") no_content_wdg.add_style("width: 350px") no_content_wdg.add_style("height: 110px") no_content_wdg.add_border() return div
def get_section_wdg(my, title, description, image, behavior): section_wdg = DivWdg() section_wdg.set_round_corners() section_wdg.add_border() section_wdg.add_class("spt_report_top") section_wdg.add_style("width: 200px") section_wdg.add_style("height: 100px") section_wdg.add_style("overflow: hidden") section_wdg.add_style("margin: 10px") section_wdg.set_box_shadow("0px 0px 10px") title_wdg = DivWdg() section_wdg.add(title_wdg) title_wdg.add(title) title_wdg.add_style("height: 20px") title_wdg.add_style("padding: 3px") title_wdg.add_style("margin-top: 3px") title_wdg.add_style("font-weight: bold") title_wdg.add_gradient("background", "background") button = IconButtonWdg(title="Options", icon=IconWdg.ARROWHEAD_DARK_DOWN) title_wdg.add(button) button.add_style("float: right") # set up menus menu = my.get_menu() SmartMenu.add_smart_menu_set( button, { 'MENU_ITEM': menu } ) SmartMenu.assign_as_local_activator( button, "MENU_ITEM", True ) section_wdg.add_color("background", "background") #section_wdg.add_gradient("background", "background", 0, -3) section_wdg.add_behavior( { 'type': 'hover', 'add_color_modifier': -5, 'cb_set_prefix': 'spt.mouse.table_layout_hover', } ) desc_div = DivWdg() desc_div.add(description) desc_div.add_style("padding: 5px 10px 10px 5px") div = DivWdg() section_wdg.add(div) div.add_style("padding: 3px") div.add_style("margin: 5px") div.add_style("width: 65px") div.add_style("height: 50px") div.add_style("float: left") div.add(image) section_wdg.add(desc_div) div.add_style("overflow: hidden") section_wdg.add_behavior( behavior ) section_wdg.add_class("hand") return section_wdg
def get_advanced_definition_wdg(my): # add the advanced entry advanced = DivWdg() advanced.add_style("margin-top: 10px") advanced.add_style("padding: 10px") advanced.add_border() title = DivWdg() title.add_style("color: black") title.add("Advanced - XML Column Definition") title.add_style("margin-top: -23") advanced.add(title) advanced.add("<br/>") input = TextAreaWdg("config_xml") input.set_id("config_xml") input.set_option("rows", "10") input.set_option("cols", "70") input.set_value(my.config_string) advanced.add(input) advanced.add(HtmlElement.br(2)) button_div = DivWdg() button_div.add_style("text-align: center") button = ActionButtonWdg(title="Save Definition") #button = ProdIconButtonWdg("Save Definition") button.add_event("onclick", "spt.custom_project.save_definition_cbk()") button_div.add(button) button_div.add_style("margin-left: 130px") advanced.add(button_div) return advanced
def get_header_wdg(my): outer = DivWdg() div = DivWdg() outer.add(div) div.add_color("background", "background3") div.add_style("padding: 5px") div.add_border() table = Table() table.add_style("margin-left: auto") table.add_style("margin-right: auto") table.add_color("color", "color") table.add_style("font-size: 1.5em") table.add_style("font-weight: bold") table.add_row() # add the month navigators date_str = "%s, %s" % (my.MONTHS[my.month - 1], my.year) month_wdg = DivWdg() month_wdg.add_style("width: 150px") month_wdg.add(date_str) prev_month_wdg = my.get_prev_month_wdg() next_month_wdg = my.get_next_month_wdg() table.add_cell(prev_month_wdg) td = table.add_cell(month_wdg) td.add_style("text-align: center") table.add_cell(next_month_wdg) div.add(table) return outer
def get_display(self): top = self.top top.add_class("spt_ingestion_top") self.set_as_panel(top) inner = DivWdg() top.add(inner) inner.add_color("background", "background") inner.add_border() inner.add_style("padding: 10px") self.session_code = self.get_value("session_code") if self.session_code: self.session = Search.get_by_code("config/ingest_session", self.session_code) else: self.session_code = "session101" self.session = SearchType.create("config/ingest_session") self.session.set_value("code", self.session_code) base_dir = self.get_value("base_dir") if base_dir: self.session.set_value("base_dir", base_dir) location = self.get_value("location") if location: self.session.set_value("location", location) else: self.session.set_value("location", "local") self.session.commit() self.paths = self.get_value("paths") nav_div = DivWdg() inner.add(nav_div) nav_div.add(self.get_nav_wdg()) inner.add("<hr/>") table = ResizableTableWdg() inner.add(table) table.add_color("color", "color") left = table.add_cell() left_div = DivWdg() left.add(left_div) left_div.add(self.get_session_wdg()) left_div.add_style("padding: 10px") left_div.add_style("height: 100%") left_div.add_style("min-height: 500px") left_div.add_border() left_div.set_round_corners(corners=["TL", "TR"]) left_div.add_class("SPT_RESIZABLE") right = table.add_cell() right.add(self.get_content_wdg()) return top
def get_error_wdg(my): div = DivWdg() error_div = DivWdg() error_div.add("Error %s" % my.status) div.add(error_div) error_div.add_style("font-size: 18px") error_div.add_style("font-weight: bold") error_div.add_style("padding: 10px") error_div.add_style("width: auto") error_div.add_gradient("background", "background") error_div.add_border() error_div.add_style("margin-left: 5px") error_div.add_style("margin-right: 5px") error_div.add_style("margin-top: -10px") div.add("<br/>") span = DivWdg() #span.add_color("color", "color") span.add_style("color", "#FFF") if my.status == 404: span.add( HtmlElement.b( "You have tried to access a url that is not recognized.")) else: span.add(HtmlElement.b(my.message)) span.add(HtmlElement.br(2)) web = WebContainer.get_web() root = web.get_site_root() if my.message.startswith('No project ['): label = 'You may need to correct the default_project setting in the TACTIC config.' else: label = "Go to the Main page for a list of valid projects" span.add(label) div.add(span) div.add(HtmlElement.br()) from tactic.ui.widget import ActionButtonWdg button_div = DivWdg() button_div.add_style("width: 90px") button_div.add_style("margin: 0px auto") div.add(button_div) button = ActionButtonWdg(title="Go to Main", tip='Click to go to main page') button_div.add(button) button.add_behavior({ 'type': 'click_up', 'cbjs_action': ''' document.location = '/'; ''' }) button.add_event("onmouseup", "document.location='/'") return div
def get_tile_wdg(my, sobject): div = DivWdg() div.add_class("spt_tile_top") div.add_class("spt_table_row") top_view = my.kwargs.get("top_view") if top_view: title_wdg = my.get_view_wdg(sobject, top_view) else: title_wdg = my.get_title(sobject) div.add( title_wdg ) div.add_attr("spt_search_key", sobject.get_search_key()) div.add_attr("spt_name", sobject.get_name()) div.add_attr("spt_search_code", sobject.get_code()) SmartMenu.assign_as_local_activator( div, 'DG_DROW_SMENU_CTX' ) div.add_border() div.set_box_shadow() div.add_color("background", "background", -3) div.add_style("margin: 10px") div.add_style("overflow: hidden") div.add_style("float: left") thumb_div = DivWdg() thumb_div.add_class("spt_tile_content") #thumb_div.add_class("spt_tile_detail") div.add(thumb_div) width = 240 height = 160 thumb_div.add_style("width: %s" % width) thumb_div.add_style("height: %s" % height) thumb_div.add_style("overflow: hidden") thumb = ThumbWdg2() thumb.set_sobject(sobject) thumb_div.add(thumb) bottom_view = my.kwargs.get("bottom_view") if bottom_view: div.add( my.get_view_wdg(sobject, bottom_view) ) div.add_attr("ondragenter", "return false") div.add_attr("ondragover", "return false") div.add_attr("ondrop", "spt.thumb.noop(event, this)") return div
def get_content_wdg(my): div = DivWdg() div.add_class("spt_tool_top") table = Table() div.add(table) table.add_row() td = table.add_cell() from table_layout_wdg import FastTableLayoutWdg kwargs = my.kwargs.copy() td.add_style("width: 1%") td.add_style("vertical-align: top") layout_div = DivWdg() layout_div.add_style("min-height: 500px") td.add(layout_div) my.kwargs['element_names'] = ['name','description','detail', 'file_list','general_checkin'] my.kwargs['show_shelf'] = False layout = FastTableLayoutWdg(**my.kwargs) layout_div.add(layout) #from tactic.ui.panel import TileLayoutWdg #layout = TileLayoutWdg(**my.kwargs) #layout_div.add(layout) td = table.add_cell() td.add_border(color="#EEE") td.add_style("vertical-align: top") content = DivWdg() td.add(content) content.add_class("spt_tool_content") #content.add_style("margin: -1px") no_content_wdg = DivWdg() content.add(no_content_wdg) no_content_wdg.add("<br/>"*3) no_content_wdg.add("<i>-- No Content --</i>") #no_content_wdg.add_style("opacity: 0.5") no_content_wdg.add_style("margin: 30px auto") no_content_wdg.add_color("color", "color3") no_content_wdg.add_color("background", "background3") no_content_wdg.add_style("text-align", "center") no_content_wdg.add_style("padding-top: 20px") no_content_wdg.add_style("padding-bottom: 20px") no_content_wdg.add_style("width: 350px") no_content_wdg.add_style("height: 110px") no_content_wdg.add_border() return div
def get_info_wdg(my, sobject): div = DivWdg() div.add_style("margin: 10px 20px 20px 20px") div.add_style("padding: 20px") div.add_color("background", "background", -3) div.add_border() div.add_color("color", "color3") div.set_round_corners(5) div.add_style("height", "100%") div.add_style("position: relative") element_names = my.kwargs.get("element_names") if not element_names: element_names = [ "code", "name", "description", ] else: element_names = element_names.split(",") view = "table" from pyasm.widget import WidgetConfigView search_type = sobject.get_search_type() config = WidgetConfigView.get_by_search_type(search_type, view) table = Table() table.add_style("height", "100%") div.add(table) for element_name in element_names: table.add_row() title = Common.get_display_title(element_name) td = table.add_cell("%s: " % title) td.add_style("width: 200px") td.add_style("padding: 5px") element = config.get_display_widget(element_name) element.set_sobject(sobject) element.preprocess() td = table.add_cell(element) td.add_style("padding: 5px") #value = sobject.get_value(element_name, no_exception=True) or "N/A" #table.add_cell(value) div.add("<br/>") from tactic.ui.widget import DiscussionWdg search_key = sobject.get_search_key() notes_wdg = DiscussionWdg(search_key=search_key) notes_wdg.set_sobject(sobject) div.add(notes_wdg) return div
def get_error_wdg(my): div = DivWdg() error_div = DivWdg() error_div.add("Error %s" % my.status) div.add(error_div) error_div.add_style("font-size: 18px") error_div.add_style("font-weight: bold") error_div.add_style("padding: 10px") error_div.add_style("width: auto") error_div.add_gradient("background", "background") error_div.add_border() error_div.add_style("margin-left: 5px") error_div.add_style("margin-right: 5px") error_div.add_style("margin-top: -10px") div.add("<br/>") span = DivWdg() #span.add_color("color", "color") span.add_style("color", "#FFF") if my.status == 404: span.add(HtmlElement.b("You have tried to access a url that is not recognized.")) else: span.add(HtmlElement.b(my.message)) span.add(HtmlElement.br(2)) web = WebContainer.get_web() root = web.get_site_root() if my.message.startswith('No project ['): label = 'You may need to correct the default_project setting in the TACTIC config.' else: label = "Go to the Main page for a list of valid projects" span.add(label) div.add(span) div.add(HtmlElement.br()) from tactic.ui.widget import ActionButtonWdg button_div = DivWdg() button_div.add_style("width: 90px") button_div.add_style("margin: 0px auto") div.add(button_div) button = ActionButtonWdg(title="Go to Main", tip='Click to go to main page') button_div.add(button) button.add_behavior( { 'type': 'click_up', 'cbjs_action': ''' document.location = '/'; ''' } ) button.add_event("onmouseup", "document.location='/'") return div
def get_info_wdg(my, sobject): div = DivWdg() div.add_style("margin: 10px 20px 20px 20px") div.add_style("padding: 20px") div.add_color("background", "background", -3) div.add_border() div.add_color("color", "color3") div.set_round_corners(5) div.add_style("height", "100%") div.add_style("position: relative") element_names = my.kwargs.get("element_names") if not element_names: element_names = ["code","name","description",] else: element_names = element_names.split(",") view = "table" from pyasm.widget import WidgetConfigView search_type = sobject.get_search_type() config = WidgetConfigView.get_by_search_type(search_type, view) table = Table() table.add_style("height", "100%") div.add(table) for element_name in element_names: table.add_row() title = Common.get_display_title(element_name) td = table.add_cell("%s: " % title) td.add_style("width: 200px") td.add_style("padding: 5px") element = config.get_display_widget(element_name) element.set_sobject(sobject) element.preprocess() td = table.add_cell(element) td.add_style("padding: 5px") #value = sobject.get_value(element_name, no_exception=True) or "N/A" #table.add_cell(value) div.add("<br/>") from tactic.ui.widget import DiscussionWdg search_key = sobject.get_search_key() notes_wdg = DiscussionWdg(search_key=search_key) notes_wdg.set_sobject(sobject) div.add(notes_wdg) return div
def get_section_wdg(self, title, description, image, behavior): section_wdg = DivWdg() section_wdg.set_round_corners() section_wdg.add_border() section_wdg.add_style("width: 200px") section_wdg.add_style("height: 100px") section_wdg.add_style("overflow: hidden") section_wdg.add_style("margin: 5px") section_wdg.set_box_shadow("1px 1px 1px 1px") title_wdg = DivWdg() section_wdg.add(title_wdg) title_wdg.add(title) title_wdg.add_style("height: 20px") title_wdg.add_style("padding: 3px") title_wdg.add_style("margin-top: 3px") title_wdg.add_style("font-weight: bold") title_wdg.add_gradient("background", "background") section_wdg.add_color("background", "background") #section_wdg.add_gradient("background", "background", 0, -3) section_wdg.add_behavior({ 'type': 'hover', 'add_color_modifier': -5, 'cb_set_prefix': 'spt.mouse.table_layout_hover', }) desc_div = DivWdg() desc_div.add(description) desc_div.add_style("padding: 0px 10px 10px 5px") div = DivWdg() section_wdg.add(div) div.add_style("padding: 3px") div.add_style("margin: 5px") #div.add_style("width: 210px") #div.add_style("height: 170px") #div.add_style("width: 80px") div.add_style("height: 50px") div.add_style("float: left") div.add(image) section_wdg.add(desc_div) div.add_style("overflow: hidden") section_wdg.add_behavior(behavior) section_wdg.add_class("hand") return section_wdg
def get_section_wdg2(self, title, description, image, behavior): section_wdg = DivWdg() section_wdg.set_round_corners() section_wdg.add_border() section_wdg.add_style("width: 200px") section_wdg.add_style("height: 175px") section_wdg.add_style("overflow: hidden") section_wdg.add_style("margin: 10px") section_wdg.set_box_shadow("1px 1px 1px 1px") title_wdg = DivWdg() section_wdg.add(title_wdg) title_wdg.add(title) title_wdg.add_style("height: 20px") title_wdg.add_style("padding: 3px") title_wdg.add_style("margin-top: 3px") title_wdg.add_style("font-weight: bold") title_wdg.add_gradient("background", "background") section_wdg.add_color("background", "background") section_wdg.add_behavior( { 'type': 'hover', 'add_color_modifier': -5, 'cb_set_prefix': 'spt.mouse.table_layout_hover', } ) desc_div = DivWdg() desc_div.add(description) desc_div.add_style("padding: 0px 10px 10px 5px") div = DivWdg() section_wdg.add(div) div.add_style("padding: 3px") div.add_style("margin: 5px") #div.add_style("width: 210px") #div.add_style("height: 170px") div.add_style("width: 105px") div.add_style("height: 85px") div.add(image) section_wdg.add(desc_div) div.add_style("overflow: hidden") section_wdg.add_behavior( behavior ) section_wdg.add_class("hand") return section_wdg
def get_row_wdgXX(my, buttons, show_title=False): top = DivWdg() #top.add_style("-moz-transform: scale(1.0)") top.add_style("float: left") top.add_style("margin-left: 3px") top.add_style("margin-right: 3px") if show_title: top.add_style("height: 29px") else: top.add_style("height: 23px") top.add_style("height: 33px") left = DivWdg() left.set_round_corners(20) #left.add_style("-moz-border-radius-topleft: 20px") #left.add_style("-moz-border-radius-bottomleft: 20px") left.add_border() left.add_gradient("background", "background", 20, -35) #left.add_style("background: black") left.add_style("float: left") left.add_style("height: 100%") left.add_style("width: 5px") left.add_style("z-index: 0") left.add_style("margin-right: -1") top.add(left) for button in buttons: button.add_style("float: left") top.add(button) right = DivWdg() right.add_style("-moz-border-radius-topright: 20px") right.add_style("-moz-border-radius-bottomright: 20px") right.add_gradient("background", "background", 20, -35) #right.add_style("background: black") right.add_style("float: left") right.add_style("height: 100%") right.add_style("width: 5px") #right.add_style("margin-left: -1px") right.add_style("z-index: 0") right.add_style("border-style: solid") right.add_style("border-color: %s" % right.get_color("border") ) right.add_style("border-width: 1 1 1 0") top.add(right) return top
def get_attr_wdg(my): div = DivWdg() div.add_border() # div.add_style("padding: 10px") div.add_color("color", "color") div.add_color("background", "background") div.add_style("height: 100%") div.add_style("min-height: 500px") div.add_style("min-width: 500px") div.add(" ") div.add_class("spt_freeform_attr_top") return div
def get_attr_wdg(self): div = DivWdg() div.add_border() #div.add_style("padding: 10px") div.add_color("color", "color") div.add_color("background", "background") div.add_style("height: 100%") div.add_style("min-height: 500px") div.add_style("min-width: 500px") div.add(" ") div.add_class("spt_freeform_attr_top") return div
def get_display(self): top = self.top self.set_as_panel(top) top.add_class("spt_subscription_top") interval = self.kwargs.get("interval") if not interval: interval = 30 * 1000 else: interval = int(interval) * 1000 inner = DivWdg() top.add(inner) self.set_refresh(inner,interval) inner.add_style("min-width: %spx"%SubscriptionBarWdg.WIDTH) inner.add_style("min-height: 300px") #mode = "all" mode = "new" categories = ['chat','sobject','script','progress'] categories = [None] has_entries = False for category in categories: category_wdg = self.get_category_wdg(category, mode) if category_wdg: inner.add(category_wdg) has_entries = True if not has_entries: no_entries = DivWdg() inner.add(no_entries) no_entries.add_style("padding: 50px") no_entries.add_style("width: %spx"%(SubscriptionBarWdg.WIDTH-50)) no_entries.add_style("height: 100px") no_entries.add_style("margin: 100px auto") no_entries.add_style("text-align: center") no_entries.add_border() no_entries.add_color("background", "background3") no_entries.add("No messages") if self.kwargs.get("is_refresh") == 'true': return inner else: return top
def get_display(my): top = my.top my.set_as_panel(top) top.add_class("spt_subscription_top") interval = my.kwargs.get("interval") if not interval: interval = 30 * 1000 else: interval = int(interval) * 1000 inner = DivWdg() top.add(inner) my.set_refresh(inner,interval) inner.add_style("min-width: %spx"%SubscriptionBarWdg.WIDTH) inner.add_style("min-height: 300px") #mode = "all" mode = "new" categories = ['chat','sobject','script','progress'] categories = [None] has_entries = False for category in categories: category_wdg = my.get_category_wdg(category, mode) if category_wdg: inner.add(category_wdg) has_entries = True if not has_entries: no_entries = DivWdg() inner.add(no_entries) no_entries.add_style("padding: 50px") no_entries.add_style("width: %spx"%(SubscriptionBarWdg.WIDTH-50)) no_entries.add_style("height: 100px") no_entries.add_style("margin: 100px auto") no_entries.add_style("text-align: center") no_entries.add_border() no_entries.add_color("background", "background3") no_entries.add("No messages") if my.kwargs.get("is_refresh") == 'true': return inner else: return top
def get_small_section_wdg(my, title, description, image, behavior): section_wdg = DivWdg() section_wdg.set_round_corners() section_wdg.add_border() section_wdg.add_style("width: 225px") section_wdg.add_style("height: 100px") section_wdg.add_style("overflow: hidden") section_wdg.add_style("margin: 10px") section_wdg.set_box_shadow("0px 0px 5px") title_wdg = DivWdg() section_wdg.add(title_wdg) title_wdg.add(title) title_wdg.add_style("height: 20px") title_wdg.add_style("padding: 3px") title_wdg.add_style("margin-top: 3px") title_wdg.add_style("font-weight: bold") title_wdg.add_gradient("background", "background") section_wdg.add_color("background", "background") #section_wdg.add_gradient("background", "background", 0, -3) section_wdg.add_behavior( { 'type': 'hover', 'add_color_modifier': -5, 'cb_set_prefix': 'spt.mouse.table_layout_hover', } ) desc_div = DivWdg() desc_div.add(description) desc_div.add_style("padding: 5px 10px 10px 5px") div = DivWdg() section_wdg.add(div) div.add_style("padding: 5px") div.add_style("margin: 5px") div.add_style("width: 65px") div.add_style("height: 50px") div.add_style("float: left") div.add_style("text-align: center") div.add(image) section_wdg.add(desc_div) div.add_style("overflow: hidden") section_wdg.add_behavior( behavior ) section_wdg.add_class("hand") return section_wdg
def get_panel_wdg(my, td, panel): title = panel.get("title") widget = panel.get("widget") width = panel.get("width") #height = panel.get("height") #if not height: # height = "250px" #td.add_style("height: %s" % height) if width: td.add_style("width: %s" % width) td.add_border() div = DivWdg() div.add_style("padding: 5px") #div.add_style("padding: 10px") title_wdg = DivWdg() div.add(title_wdg) title_wdg.add_style("padding: 5px") #title_wdg.add_style("margin: -12px -12px 10px -12px") title_wdg.add_style("margin: -6px -7px 5px -7px") title_wdg.add_style("font-weight: bold") title_wdg.add_style("font-size: 14px") if title: title_wdg.add_color("background", "background", -5) title_wdg.add_color("color", "color", -10) title_wdg.add_border() title_wdg.add(title) from tactic.ui.app import HelpButtonWdg help_wdg = HelpButtonWdg(alias=my.get_help_alias()) help_wdg.add_style("float: right") help_wdg.add_style("margin-top: -5px") title_wdg.add(help_wdg) else: title_wdg.add_style("height: 10px") if widget: div.add(widget) return div
def get_title_wdg(my): if my.parent: code = my.parent.get_value("code", no_exception=True) name = my.parent.get_value("name", no_exception=True) search_type_obj = my.parent.get_search_type_obj() else: code = my.sobject.get_value("code", no_exception=True) name = my.sobject.get_value("name", no_exception=True) search_type_obj = my.sobject.get_search_type_obj() title = DivWdg() search = Search("sthpw/snapshot") search.add_filter("search_type", "sthpw/search_type") search.add_filter("search_code", search_type_obj.get_value("code")) if search.get_sobject(): thumb = ThumbWdg() title.add(thumb) thumb.set_icon_size(30) thumb.set_sobject(search_type_obj) thumb.add_style("float: left") title.add_color("background", "background3") title.add_style("height: 20px") title.add_style("padding: 6px") title.add_style("font-weight: bold") title.add_style("font-size: 1.4em") title.add_border() stype_title = search_type_obj.get_value("title") if stype_title: title.add("%s: " % stype_title) if name: title.add("%s" % name) if code: title.add(" <i style='font-size: 0.8; opacity: 0.7'>(%s)</i>" % code) elif code: title.add("%s" % code) else: title.add("(No name)") return title
def get_row_wdgXX(my, buttons, show_title=False): top = DivWdg() #top.add_style("-moz-transform: scale(1.0)") top.add_style("float: left") top.add_style("margin-left: 3px") top.add_style("margin-right: 3px") if show_title: top.add_style("height: 29px") else: top.add_style("height: 23px") top.add_style("height: 33px") left = DivWdg() left.set_round_corners(20) #left.add_style("-moz-border-radius-topleft: 20px") #left.add_style("-moz-border-radius-bottomleft: 20px") left.add_border() left.add_gradient("background", "background", 20, -35) #left.add_style("background: black") left.add_style("float: left") left.add_style("height: 100%") left.add_style("width: 5px") left.add_style("z-index: 0") left.add_style("margin-right: -1") top.add(left) for button in buttons: button.add_style("float: left") top.add(button) right = DivWdg() right.add_style("-moz-border-radius-topright: 20px") right.add_style("-moz-border-radius-bottomright: 20px") right.add_gradient("background", "background", 20, -35) #right.add_style("background: black") right.add_style("float: left") right.add_style("height: 100%") right.add_style("width: 5px") #right.add_style("margin-left: -1px") right.add_style("z-index: 0") right.add_style("border-style: solid") right.add_style("border-color: %s" % right.get_color("border")) right.add_style("border-width: 1 1 1 0") top.add(right) return top
def get_item_wdg(my, sobject): div = DivWdg() div.add_class("spt_item_top") div.add_style("padding: 10px") SmartMenu.assign_as_local_activator( div, 'DG_DROW_SMENU_CTX' ) div.add_class("spt_table_row") div.add_attr("spt_search_key", sobject.get_search_key(use_id=True)) div.add_attr("spt_search_code", sobject.get_code()) name = sobject.get_value("name", no_exception=True) if not name: name = sobject.get_code() div.add_attr("spt_name", name) table = Table() div.add(table) table.set_max_width() tr = table.add_row() width = my.kwargs.get("preview_width") if not width: width = "240px" td = table.add_cell() td.add_style("width: %s" % width); td.add_style("vertical-align: top") from tile_layout_wdg import ThumbWdg2 thumb_div = DivWdg() td.add(thumb_div) thumb_div.add_border() thumb_div.set_box_shadow("0px 0px 5px") thumb_div.add_color("background", "background", -5) thumb_div.add_class("spt_item_content") thumb_div.add_style("min-height: 120px") thumb = ThumbWdg2() thumb_div.add(thumb) thumb.set_sobject(sobject) info_div = my.get_info_wdg(sobject) td = table.add_cell(info_div) td.add_style("vertical-align: top") return div
def get_content_wdg(my): my.search_type = my.kwargs.get("search_type") my.collection_key = my.kwargs.get("collection_key") top = DivWdg() top.add_class("spt_collection_top") if not SearchType.column_exists(my.search_type, "_is_collection"): msg_div = DivWdg() top.add(msg_div) msg_div.add("Search Type [%s] does not support collections" % my.search_type) msg_div.add_style("padding: 40px") msg_div.add_style("width: 300px") msg_div.add_style("margin: 100px auto") msg_div.add_border() return top top.add_style("margin: 5px 20px") table = Table() top.add(table) table.add_row() table.add_style("width: 100%") #tr, header = table.add_row_cell() #header.add_style("height: 40px") table.add_row() left = table.add_cell() left.add_style("vertical-align: top") left.add_style("width: 300px") left.add_style("max-width: 300px") left.add_style("height: auto") right = table.add_cell() right.add_style("vertical-align: top") right.add_style("width: auto") right.add_style("height: auto") left.add(my.get_collection_wdg()) right.add(my.get_right_content_wdg()) return top
def get_add_chat_wdg(my): div = DivWdg() div.add_border() div.add_style("padding: 20px") div.add_class("spt_add_chat_top") table = Table() table.add_style("width: auto") div.add(table) table.add_row() text = TextInputWdg(title="user", icon="USER_ADD") table.add_cell(text) text.add_class("spt_add_chat_user") add_button = ActionButtonWdg(title="Start Chat") table.add_cell(add_button) add_button.add_behavior({ 'type': 'click_up', 'cbjs_action': ''' var top = bvr.src_el.getParent(".spt_add_chat_top"); var el = top.getElement(".spt_add_chat_user"); var user = el.value; if (!user) { alert("Specify a valid user to chat with"); return; } // new chat var server = TacticServerStub.get(); var category = "chat"; var class_name = 'tactic.ui.app.ChatCmd'; var kwargs = { users: [user] } server.execute_cmd(class_name, kwargs); spt.panel.refresh(bvr.src_el); ''' }) return div
def get_display(my): alias = my.kwargs.get("alias") div = DivWdg() div.add_style("padding: 15px") div.add_style("margin: 10px") div.add_border() div.add_color("background", "background", -5) div.add_style("text-align: center") div.add_style("font-weight: bold") icon = IconWdg("WARNING", IconWdg.HELP_MISSING) div.add(icon) div.add("Add custom documentation page by clicking the Create button") from tactic.ui.widget import ActionButtonWdg button = ActionButtonWdg(title="Create", tip="Create docs for this view") div.add(button) button.add_style("margin-right: auto") button.add_style("margin-left: auto") button.add_style("margin-top: 15px") button.add_style("margin-bottom: 15px") # FIXME: copied code from above button.add_behavior({ 'type': 'click_up', 'cbjs_action': ''' spt.tab.set_main_body_tab(); var class_name = 'tactic.ui.app.HelpEditWdg'; var element_name = spt.help.get_view(); if (!element_name) { element_name = "default"; } var kwargs = { view: element_name } spt.tab.add_new("help_edit", "Help Edit", class_name, kwargs); ''' }) return div
def get_display(my): alias = my.kwargs.get("alias") div = DivWdg() div.add_style("padding: 15px") div.add_style("margin: 10px") div.add_border() div.add_color("background", "background", -5) div.add_style("text-align: center") div.add_style("font-weight: bold") icon = IconWdg("WARNING", IconWdg.HELP_MISSING) div.add(icon) div.add("Add custom documentation page by clicking the Create button") from tactic.ui.widget import ActionButtonWdg button = ActionButtonWdg(title="Create", tip="Create docs for this view") div.add(button) button.add_style("margin-right: auto") button.add_style("margin-left: auto") button.add_style("margin-top: 15px") button.add_style("margin-bottom: 15px") # FIXME: copied code from above button.add_behavior( { "type": "click_up", "cbjs_action": """ spt.tab.set_main_body_tab(); var class_name = 'tactic.ui.app.HelpEditWdg'; var element_name = spt.help.get_view(); if (!element_name) { element_name = "default"; } var kwargs = { view: element_name } spt.tab.add_new("help_edit", "Help Edit", class_name, kwargs); """, } ) return div
def get_add_chat_wdg(my): div = DivWdg() div.add_border() div.add_style("padding: 20px") div.add_class("spt_add_chat_top") table = Table() table.add_style("width: auto") div.add(table) table.add_row() text = TextInputWdg(title="user", icon="USER_ADD") table.add_cell(text) text.add_class("spt_add_chat_user") add_button = ActionButtonWdg(title="Start Chat") table.add_cell(add_button) add_button.add_behavior( { 'type': 'click_up', 'cbjs_action': ''' var top = bvr.src_el.getParent(".spt_add_chat_top"); var el = top.getElement(".spt_add_chat_user"); var user = el.value; if (!user) { alert("Specify a valid user to chat with"); return; } // new chat var server = TacticServerStub.get(); var category = "chat"; var class_name = 'tactic.ui.app.ChatCmd'; var kwargs = { users: [user] } server.execute_cmd(class_name, kwargs); spt.panel.refresh(bvr.src_el); ''' } ) return div
def get_display(self): top = self.top top.add_style("padding: 20px") top.add_color("background", "background") start_date = 'xxx' end_date = 'xxx' days = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'] start_time = '06:00' end_time = '21:00' table = Table() top.add(table) table.add_row() table.add_header() for day in days: td = table.add_header(day) for hour in xrange(6, 21): tr = table.add_row() td = table.add_cell() td.add("%0.2d:00" % hour) td.add_color("background", "background3") for day in days: td = table.add_cell() day_div = DivWdg() td.add(day_div) day_div.add_style("width: 100px") day_div.add_style("height: 50px") day_div.add_border() day_div = DivWdg() return top
def get_display(self): width = self.kwargs.get("width") if not width: width = 300 height = self.kwargs.get("height") if not height: height = 100 top = self.top top.add_class("spt_uploader_top") inner = DivWdg() top.add(inner) inner.add_style("scroll: auto") inner.add_style("padding: 3px") inner.add_behavior({ 'type': 'load', 'cbjs_action': self.get_onload_js() }) drop_wdg = DivWdg() inner.add(drop_wdg) drop_wdg.add_class("spt_uploader_drop") drop_wdg.add_border() drop_wdg.add_style("width: %s" % width) drop_wdg.add_style("height: %s" % height) drop_wdg.add_behavior({ 'type': 'load', 'cbjs_action': ''' var drop_area = bvr.src_el; spt.uploader.init_drop_area(drop_area); ''' }) button_div = DivWdg() top.add(button_div) #top.add('''<input id="files-upload" type="file" multiple=""/>''') return top
def get_title_wdg(my): if my.parent: code = my.parent.get_value("code", no_exception=True) name = my.parent.get_value("name", no_exception=True) search_type_obj = my.parent.get_search_type_obj() else: code = my.sobject.get_value("code", no_exception=True) name = my.sobject.get_value("name", no_exception=True) search_type_obj = my.sobject.get_search_type_obj() title = DivWdg() search = Search("sthpw/snapshot") search.add_filter("search_type", "sthpw/search_type") search.add_filter("search_code", search_type_obj.get_value("code")) if search.get_sobject(): thumb = ThumbWdg() title.add(thumb) thumb.set_icon_size(30) thumb.set_sobject(search_type_obj) thumb.add_style("float: left") title.add_color("background", "background", -5) title.add_style("height: 23px") title.add_style("padding: 10px") title.add_style("font-weight: bold") title.add_style("font-size: 1.4em") title.add_border() stype_title = search_type_obj.get_value("title") if stype_title: title.add("%s: " % stype_title) if name: title.add("%s" % name) if code: title.add(" <i style='font-size: 0.8; opacity: 0.7'>(%s)</i>" % code) elif code: title.add("%s" % code) else: title.add("(No name)") return title
def get_display(my): top = my.top top.add_style("padding: 20px") top.add_color("background", "background") start_date = 'xxx' end_date = 'xxx' days = [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ] start_time = '06:00' end_time = '21:00' table = Table() top.add(table) table.add_row() table.add_header() for day in days: td = table.add_header(day) for hour in xrange(6, 21): tr = table.add_row() td = table.add_cell() td.add("%0.2d:00" % hour) td.add_color("background", "background3") for day in days: td = table.add_cell() day_div = DivWdg() td.add(day_div) day_div.add_style("width: 100px") day_div.add_style("height: 50px") day_div.add_border() day_div = DivWdg() return top
def get_display(my): width = my.kwargs.get("width") if not width: width = 300 height = my.kwargs.get("height") if not height: height = 100 top = my.top top.add_class("spt_uploader_top") inner = DivWdg() top.add(inner) inner.add_style("scroll: auto") inner.add_style("padding: 3px") inner.add_behavior( { 'type': 'load', 'cbjs_action': my.get_onload_js() } ) drop_wdg = DivWdg() inner.add(drop_wdg) drop_wdg.add_class("spt_uploader_drop") drop_wdg.add_border() drop_wdg.add_style("width: %s" % width) drop_wdg.add_style("height: %s" % height) drop_wdg.add_behavior( { 'type': 'load', 'cbjs_action': ''' var drop_area = bvr.src_el; spt.uploader.init_drop_area(drop_area); ''' } ) button_div = DivWdg() top.add(button_div) #top.add('''<input id="files-upload" type="file" multiple=""/>''') return top
def get_title_wdg(my): title = DivWdg() title.add_color("background", "background3") title.add_style("height: 20px") title.add_style("padding: 6px") title.add_style("font-weight: bold") title.add_style("font-size: 1.4em") title.add_border() code = my.parent.get_value("code", no_exception=True) name = my.parent.get_value("name", no_exception=True) process = my.sobject.get("process") task_code = my.sobject.get("code") bgcolor = title.get_color("background") title.add("<span style='font-size: 1.2em; padding: 4px; margin: 0px 20px 0px 0px; background-color: %s'>%s</span> Task <i style='font-size: 0.8em'>(%s)</i> for %s <i style='font-size: 0.8em'>(%s)</i>" % (bgcolor, process, task_code, name, code)) return title
def get_display(my): top = my.top my.set_as_panel(top) title_wdg = DivWdg() top.add(title_wdg) title_wdg.add("Local") title_wdg.add_style("padding: 10px") title_wdg.add_color("background", "background", -10) title_wdg.add_border() title_wdg.add_style("margin: -6px -6px 10px -6px") title_wdg.add_style("font-weight: bold") from tactic.ui.container import TabWdg tab = TabWdg(selected="Info", show_add=False) top.add(tab) tab.add(my.get_info_wdg()) return top
def get_display(my): title = DivWdg() title.add(my.name_of_title) title.add_style("padding: 5px") title.add_style("margin: -10px -10px 10px -10px") title.add_style("font-weight: bold") title.add_style("font-size: 14px") title.add_gradient("background", "background", -10) title.add_color("color", "color", -10) title.add_border() from tactic.ui.app import HelpButtonWdg help_wdg = HelpButtonWdg(alias=my.help_alias) help_wdg.add_style("float: right") help_wdg.add_style("margin-top: -5px") title.add(help_wdg) return title
def get_display(my): top = my.top my.set_as_panel(top) top.add_class("spt_share_item") my.server_code = my.kwargs.get("server_code") if not my.server_code: top.add("No server selected") return top my.server = Search.get_by_code("sthpw/sync_server", my.server_code) my.base_dir = my.server.get_value("base_dir") title_wdg = DivWdg() top.add( title_wdg ) title_wdg.add( my.server_code ) title_wdg.add_style("padding: 10px") title_wdg.add_color("background", "background", -10) title_wdg.add_border() title_wdg.add_style("margin: -6px -6px 10px -6px") title_wdg.add_style("font-weight: bold") description = my.server.get_value("description") title_wdg.add(" <i style='font-size: 9px; opacity: 0.5'>( %s )</i>" % description ) from tactic.ui.container import TabWdg tab = TabWdg(selected="Info", show_add=False) top.add(tab) tab.add(my.get_info_wdg()) tab.add(my.get_files_wdg()) tab.add( my.get_tools_wdg() ) return top
def get_display(self): top = self.top self.set_as_panel(top) top.add_class("spt_share_item") self.server_code = self.kwargs.get("server_code") if not self.server_code: top.add("No server selected") return top self.server = Search.get_by_code("sthpw/sync_server", self.server_code) self.base_dir = self.server.get_value("base_dir") title_wdg = DivWdg() top.add( title_wdg ) title_wdg.add( self.server_code ) title_wdg.add_style("padding: 10px") title_wdg.add_color("background", "background", -10) title_wdg.add_border() title_wdg.add_style("margin: -6px -6px 10px -6px") title_wdg.add_style("font-weight: bold") description = self.server.get_value("description") title_wdg.add(" <i style='font-size: 9px; opacity: 0.5'>( %s )</i>" % description ) from tactic.ui.container import TabWdg tab = TabWdg(selected="Info", show_add=False) top.add(tab) tab.add(self.get_info_wdg()) tab.add(self.get_files_wdg()) tab.add( self.get_tools_wdg() ) return top
def get_title_wdg(my): title = DivWdg() title.add_color("background", "background3") title.add_style("height: 20px") title.add_style("padding: 6px") title.add_style("font-weight: bold") title.add_style("font-size: 1.4em") title.add_border() code = my.parent.get_value("code", no_exception=True) name = my.parent.get_value("name", no_exception=True) process = my.sobject.get("process") task_code = my.sobject.get("code") bgcolor = title.get_color("background") title.add( "<span style='font-size: 1.2em; padding: 4px; margin: 0px 20px 0px 0px; background-color: %s'>%s</span> Task <i style='font-size: 0.8em'>(%s)</i> for %s <i style='font-size: 0.8em'>(%s)</i>" % (bgcolor, process, task_code, name, code)) return title
def get_local_wdg(self): div = DivWdg() server = Config.get_value("install", "server") if not server: msg_div = DivWdg() msg_div.add( IconWdg("No local prefix set", IconWdg.WARNING) ) msg_div.add("WARNING: No local server prefix set. This will allow transactions to be merged properly with remote servers. Without a local prefix, it is highly likely that transactions will conflict") msg_div.add("<br/>"*2) text = TextWdg("local_prefix") change_div = DivWdg() msg_div.add(change_div) change_div.add("Set Local Prefix: ") change_div.add(text) else: msg_div = DivWdg() msg_div.add( IconWdg("No local prefix set", IconWdg.CREATE) ) msg_div.add("Local server set to [%s]" % server) msg_div.add_style("padding: 30px") msg_div.add_style("width: 80%") msg_div.add_color("background", "background3") msg_div.add_border() msg_div.add_style("text-align: center") div.add(msg_div) return div
def get_display(my): width = "100%" sobject = my.get_current_sobject() div = DivWdg() div.add_class("spt_thumb_top") path = my.path if path: img = HtmlElement.img(src=path) else: search_type = sobject.get_search_type_obj() path = my.get_path_from_sobject(search_type) if path: img = DivWdg() img.add_style("opacity: 0.2") img_inner = HtmlElement.img(src=path) img.add(img_inner) img_inner.add_style("width: %s" % width) if path and path.startswith("/context"): img.add_style("padding: 20px 0px") img.add_border() img.add_style("width: 100%") if not path: img = DivWdg() img.add_class("spt_image") div.add(img) img.add_style("width: %s" % width) div.add_style("height: 100%") return div
def get_legend_wdg(my): #my.search_type = my.kwargs.get("search_type") #if not my.search_type == "sthpw/task": # return None div = DivWdg() div.add_style("margin: 20px 10px 20px 10px") div.add_style("font-size: 0.8em") table = Table() div.add(table) table.add_row() pipeline_code = 'task' pipeline = Pipeline.get_by_code(pipeline_code) process_names = pipeline.get_process_names() for process_name in process_names: color = pipeline.get_process(process_name).get_color() color_div = DivWdg() td = table.add_cell(color_div) color_div.add(" ") color_div.add_style("width: 10px") color_div.add_style("height: 10px") color_div.add_style("float: left") color_div.add_style("background: %s" % color) color_div.add_style("margin: 2px 5px 0px 15px") color_div.add_border() #color_div.set_box_shadow("0px 0px 5px") td.add(process_name) #td.add(color) return div
def get_display(self): top = DivWdg() top.add_style("width: 200px") top.add_style("height: 200px") top.add_color("background", "background") top.add_color("padding", "10px") top.add_border() template = self.get_option("template") template = "prod/sequence" select = SelectWdg("foo") top.add(select) select.set_option("values", "XG|FF|WOW") text = TextWdg("foo") top.add(text) top.add("!!!!!") return top
def get_main_section_wdg(self, title, description, image, behavior, img_height="64px"): section_wdg = DivWdg() #section_wdg.set_round_corners() section_wdg.add_border() section_wdg.add_style("width: 225px") section_wdg.add_style("height: 225px") section_wdg.add_style("overflow: hidden") section_wdg.add_style("margin: -5px 5px 10px 5px") #section_wdg.add_style("margin: 10px") #section_wdg.set_box_shadow() title_wdg = DivWdg() section_wdg.add(title_wdg) title_wdg.add(title) title_wdg.add_style("height: 20px") title_wdg.add_style("padding: 3px") title_wdg.add_style("margin-top: 3px") title_wdg.add_style("font-weight: bold") title_wdg.add_style("text-align: center") title_wdg.add_color("background", "background", -5) section_wdg.add_color("background", "background") section_wdg.add_behavior({ 'type': 'hover', 'add_color_modifier': -3, 'cb_set_prefix': 'spt.mouse.table_layout_hover', }) shadow = section_wdg.get_color("shadow") section_wdg.add_behavior({ 'type': 'click', 'shadow': shadow, 'cbjs_action': ''' bvr.src_el.setStyle("box-shadow", "0px 0px 5px " + bvr.shadow); ''' }) section_wdg.add_behavior({ 'type': 'mouseenter', 'shadow': shadow, 'cbjs_action': ''' bvr.src_el.setStyle("box-shadow", "0px 0px 5px " + bvr.shadow); ''', }) section_wdg.add_behavior({ 'type': 'mouseleave', 'shadow': shadow, 'cbjs_action': ''' bvr.src_el.setStyle("box-shadow", "0px 0px 0px " + bvr.shadow); ''', }) desc_div = DivWdg() desc_div.add(description) desc_div.add_style("padding: 5px 10px 10px 10px") #desc_div.add_style("font-size: 1.5em") #desc_div.add_style("font-weight: bold") div = DivWdg() section_wdg.add(div) div.add_style("padding: 3px") div.add_style("margin: 10px") div.add_style("width: 209px") div.add_style("height: %s" % img_height) div.add_style("text-align: center") div.add(image) #div.set_box_shadow("1px 1px 1px 1px") section_wdg.add(desc_div) div.add_style("overflow: hidden") section_wdg.add_behavior(behavior) section_wdg.add_class("hand") return section_wdg
def get_display(self): top = DivWdg() top.add_border() top.add_style("padding: 10px") top.add_color("color", "color") top.add_gradient("background", "background", 0, -5) #top.add_style("height: 550px") top.add_behavior({ 'type': 'load', 'cbjs_action': ''' spt.named_events.fire_event("side_bar|hide_now", {} ); ''' }) project = Project.get() title = DivWdg() title.add("Project Startup and Configuration") title.add_style("font-size: 18px") title.add_style("font-weight: bold") title.add_style("text-align: center") title.add_style("padding: 10px") title.add_style("margin: -10px -10px 10px -10px") top.add(title) title.add_gradient("background", "background3", 5, -10) shelf = DivWdg() top.add(shelf) shelf.add_style("margin-left: -8px") shelf.add_style("width: 130px") button_div = DivWdg() shelf.add(button_div) button_div.add_style("float: left") button_div.add_style("margin-top: -3px") security = Environment.get_security() view_side_bar = security.check_access("builtin", "view_side_bar", "allow", default='allow') if view_side_bar: button = IconButtonWdg(title="Side Bar", icon=IconWdg.ARROW_LEFT) button_div.add(button) shelf.add("Toggle Side Bar") shelf.add_attr("title", "Toggle Side Bar (or press '1')") button.add_behavior({ 'type': 'click_up', 'cbjs_action': ''' spt.named_events.fire_event("side_bar|toggle"); ''' }) shelf.add_behavior({ 'type': 'click_up', 'cbjs_action': ''' spt.named_events.fire_event("side_bar|toggle"); ''' }) shelf.add_class("hand") else: shelf.add(" ") search_wdg = Table() top.add(search_wdg) search_wdg.add_row() search_wdg.add_class("spt_main_top") search_wdg.add_style("padding: 10px") search_wdg.add_style("margin: 20px auto") search_wdg.add_style("width: 430px") td = search_wdg.add_cell("Search: ") td.add_style("vertical-align: top") td.add_style("padding-top: 8px") custom_cbk = {} custom_cbk['enter'] = ''' var top = bvr.src_el.getParent(".spt_main_top"); var search_el = top.getElement(".spt_main_search"); var keywords = search_el.value; if (keywords != '') { var class_name = 'tactic.ui.panel.ViewPanelWdg'; var kwargs = { 'search_type': 'sthpw/sobject_list', 'view': 'result_list', 'keywords': keywords, 'simple_search_view': 'simple_filter', //'show_shelf': false, } spt.tab.set_main_body_tab(); spt.tab.add_new("Search Results", "Search Results", class_name, kwargs); } ''' from tactic.ui.input import TextInputWdg, LookAheadTextInputWdg #text = TextInputWdg(name="search") text = LookAheadTextInputWdg(name="search", custom_cbk=custom_cbk, width='280', height='42px') #text = TextWdg("search") text.add_class("spt_main_search") text.add_style("width: 290px") search_wdg.add_cell(text) search_wdg.add_style("font-weight: bold") search_wdg.add_style("font-size: 16px") icon_div = DivWdg() td = search_wdg.add_cell(icon_div) td.add_style("vertical-align: top") icon_div.add_style("width: 38px") icon_div.add_style("height: 27px") icon_div.add_style("padding-top: 7px") icon_div.add_style("padding-left: 4px") icon_div.add_style("text-align: center") #icon_div.add_gradient("background", "background3", 15, -10) icon_div.add_color("background", "background3", 10) over_color = icon_div.get_color("background3", 0) out_color = icon_div.get_color("background3", 10) icon_div.set_round_corners(5) icon_div.set_box_shadow("1px 1px 1px 1px") icon = IconWdg("Search", IconWdg.SEARCH_32, width=24) icon_div.add(icon) button = icon_div icon_div.add_class("hand") icon_div.add_behavior({ 'type': 'mouseover', 'color': over_color, 'cbjs_action': ''' bvr.src_el.setStyle("background", bvr.color); ''' }) icon_div.add_behavior({ 'type': 'mouseout', 'color': out_color, 'cbjs_action': ''' bvr.src_el.setStyle("background", bvr.color); bvr.src_el.setStyle("box-shadow", "1px 1px 1px 1px #999"); bvr.src_el.setStyle("margin-top", "-5"); bvr.src_el.setStyle("margin-right", "0"); ''' }) icon_div.add_behavior({ 'type': 'click', 'color': out_color, 'cbjs_action': ''' bvr.src_el.setStyle("box-shadow", "0px 0px 1px 1px #999"); bvr.src_el.setStyle("margin-top", "-3"); bvr.src_el.setStyle("margin-right", "-2"); ''' }) icon_div.add_behavior({ 'type': 'click_up', 'color': out_color, 'cbjs_action': ''' bvr.src_el.setStyle("box-shadow", "1px 1px 1px 1px #999"); bvr.src_el.setStyle("margin-top", "-5"); bvr.src_el.setStyle("margin-right", "0"); ''' }) button.add_behavior({ 'type': 'click_up', 'cbjs_action': ''' var top = bvr.src_el.getParent(".spt_main_top"); var search_el = top.getElement(".spt_main_search"); var keywords = search_el.value; if (keywords == '') { return; } var class_name = 'tactic.ui.panel.ViewPanelWdg'; var kwargs = { 'search_type': 'sthpw/sobject_list', 'view': 'result_list', 'keywords': keywords, 'simple_search_view': 'simple_filter', //'show_shelf': false, } spt.tab.set_main_body_tab(); spt.tab.add_new("Search Results", "Search Results", class_name, kwargs); ''' }) #desc = DivWdg() #top.add(desc) #desc.add("Dashboard") #desc.add_style("width: 600px") # create a bunch of panels table = Table() table.add_color("color", "color") table.add_style("margin-bottom: 20px") table.center() top.add(table) table.add_row() #security = Environment.get_security() #if not security.check_access("builtin", "view_site_admin", "allow"): td = table.add_cell() td.add_style("padding: 3px") td.add_style("vertical-align: top") title = "Configuration" #description = '''All TACTIC projects can be uniquely designed and managed using our configuration tools.''' description = '''Configure a Project from start to finish.''' image = "<img src='/context/icons/64x64/configuration_64.png'/>" behavior = { 'type': 'click_up', 'cbjs_action': ''' spt.tab.set_main_body_tab(); var class_name = 'tactic.ui.startup.ProjectConfigWdg'; var kwargs = { help_alias: 'project-startup-configuration' }; spt.tab.add_new("project_configuration", "Configuration", class_name, kwargs); ''' } config_wdg = self.get_main_section_wdg(title, description, image, behavior) td.add(config_wdg) # Manage Users td = table.add_cell() td.add_style("vertical-align: top") td.add_style("padding: 3px") title = "Manage Users and Security" image = "<img src='/context/icons/64x64/dashboard_64.png'/>" image = DivWdg() image_link = "<div style='margin-bottom: -64px'><img src='/context/icons/64x64/lock_64.png'/></div>" image.add(image_link) image1 = IconWdg("Manage Users", IconWdg.USER_32) image2 = IconWdg("Manage Users", IconWdg.USER_32) image3 = IconWdg("Manage Users", IconWdg.USER_32) image4 = IconWdg("Manage Users", IconWdg.USER_32) image.add(image1) image.add(image2) image.add("<br/>") image.add(image3) image.add(image4) description = '''Manage users that can access the system''' behavior = { 'type': 'click_up', 'cbjs_action': ''' spt.tab.set_main_body_tab(); var class_name = 'tactic.ui.startup.UserConfigWdg'; var kwargs = { help_alias: 'project-startup-manage-users' }; spt.tab.add_new("manage_user", "Manage Users", class_name, kwargs); ''' } manage_users_wdg = self.get_main_section_wdg(title, description, image, behavior) td.add(manage_users_wdg) # custom layout editor td = table.add_cell() td.add_style("padding: 3px") td.add_style("vertical-align: top") title = "Custom Layouts" description = '''Create interfaces using the Custom Layout Editor.''' image = "<img src='/context/icons/64x64/layout_64.png'/>" behavior = { 'type': 'click_up', 'cbjs_action': ''' spt.tab.set_main_body_tab(); var class_name = 'tactic.ui.tools.CustomLayoutEditWdg'; var kwargs = { help_alias: 'project-startup-configuration' }; spt.tab.add_new("custom_layout_editor", "Custom Layout Editor", class_name, kwargs); ''' } config_wdg = self.get_main_section_wdg(title, description, image, behavior) td.add(config_wdg) tr = table.add_row() # Plugins td = table.add_cell() td.add_style("vertical-align: top") td.add_style("padding: 3px") title = "Manage Plugins" image = IconWdg("Manage Plugins", IconWdg.PLUGIN_32) #image = "<img src='/context/icons/64x64/dashboard_64.png'/>" description = '''Upload, install, remove and create TACTIC plugins.''' behavior = { 'type': 'click_up', 'cbjs_action': ''' var class_name = 'tactic.ui.app.PluginWdg'; spt.tab.set_main_body_tab(); spt.tab.add_new("plugins", "Manage Plugin", class_name, kwargs); ''' } plugin_wdg = self.get_small_section_wdg(title, description, image, behavior) td.add(plugin_wdg) # Examples td = table.add_cell() td.add_style("vertical-align: top") td.add_style("padding: 3px") title = "Tools" image = IconWdg("Tools", IconWdg.SHARE_32) #image = "<img src='/context/icons/64x64/dashboard_64.png'/>" description = '''A collection of example views.''' behavior = { 'type': 'click_up', 'cbjs_action': ''' var class_name = 'tactic.ui.startup.ToolsWdg'; spt.tab.set_main_body_tab(); spt.tab.add_new("tools", "Tools", class_name, kwargs); ''' } share_wdg = self.get_small_section_wdg(title, description, image, behavior) td.add(share_wdg) # Share """ td = table.add_cell() td.add_style("vertical-align: top") td.add_style("padding: 3px") title = "Shares" image = IconWdg("Shares", IconWdg.SHARE_32) #image = "<img src='/context/icons/64x64/dashboard_64.png'/>" description = '''Share project with other TACTIC installs.''' behavior = { 'type': 'click_up', 'cbjs_action': ''' var class_name = 'tactic.ui.startup.ShareWdg'; spt.tab.set_main_body_tab(); spt.tab.add_new("shares", "Shares", class_name, kwargs); ''' } share_wdg = self.get_small_section_wdg(title, description, image, behavior) td.add(share_wdg) """ # Advanced td = table.add_cell() td.add_style("vertical-align: top") td.add_style("padding: 3px") title = "Advanced Setup" image = IconWdg("Advanced", IconWdg.ADVANCED_32) #image = "<img src='/context/icons/64x64/dashboard_64.png'/>" description = '''A set of advanced configuration tools.''' behavior = { 'type': 'click_up', 'cbjs_action': ''' var class_name = 'tactic.ui.app.ProjectStartWdg'; spt.tab.set_main_body_tab() spt.tab.add_new("project_setup", "Project Setup", class_name) ''' } share_wdg = self.get_small_section_wdg(title, description, image, behavior) td.add(share_wdg) """ td = table.add_cell() td.add_style("vertical-align: top") td.add_style("padding: 3px") title = "Documentation" description = '''TACTIC Documentation. * Project Setup Documentation<br/> <br/> * End User Documentation<br/> <br/> * Developer Documentation<br/> <br/> * System Administrator Documentation<br/> <br/> ''' image = "<img src='/context/images/getting_started_pipeline.png'/>" behavior = { 'type': 'click_up', 'cbjs_action': ''' spt.help.load_alias("main") ''' } doc_wdg = self.get_section_wdg(title, description, image, behavior) td.add(doc_wdg) """ tr, td = table.add_row_cell() td.add_style("font-size: 14px") td.add("<br/>") from misc_wdg import QuickLinksWdg quick_links_wdg = QuickLinksWdg() td.add(quick_links_wdg) #td = table.add_cell() #totals_wdg = self.get_totals_wdg() #td.add(totals_wdg) return top
def get_display(my): web = WebContainer.get_web() widget = Widget() html = HtmlElement("html") is_xhtml = False if is_xhtml: web.set_content_type("application/xhtml+xml") widget.add('''<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> ''') html.add_attr("xmlns", "http://www.w3.org/1999/xhtml") #html.add_attr("xmlns:svg", "http://www.w3.org/2000/svg") # add the copyright widget.add(my.get_copyright_wdg()) widget.add(html) # create the header head = HtmlElement("head") html.add(head) head.add( '<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>\n' ) head.add('<meta http-equiv="X-UA-Compatible" content="IE=edge"/>\n') # Add the tactic favicon head.add( '<link rel="shortcut icon" href="/context/favicon.ico" type="image/x-icon"/>' ) # add the css styling head.add(my.get_css_wdg()) # add the title in the header project = Project.get() project_code = project.get_code() project_title = project.get_value("title") if web.is_admin_page(): is_admin = " - Admin" else: is_admin = "" if project_code == 'admin': head.add("<title>TACTIC Site Admin</title>\n") else: head.add("<title>%s%s</title>\n" % (project_title, is_admin)) # add the javascript libraries head.add(JavascriptImportWdg()) # add the body body = my.body html.add(body) body.add_event('onload', 'spt.onload_startup(this)') top = my.top # Add a NOSCRIPT tag block here to provide a warning message on browsers where 'Enable JavaScript' # is not checked ... TODO: clean up and re-style to make look nicer top.add(""" <NOSCRIPT> <div style="border: 2px solid black; background-color: #FFFF99; color: black; width: 600px; height: 70px; padding: 20px;"> <img src="%s" style="border: none;" /> <b>Javascript is not enabled on your browser!</b> <p>This TACTIC powered, web-based application requires JavaScript to be enabled in order to function. In your browser's options/preferences, please make sure that the 'Enable JavaScript' option is checked on, click OK to accept the settings change, and then refresh this web page.</p> </div> </NOSCRIPT> """ % (IconWdg.get_icon_path("ERROR"))) # add the content content_div = DivWdg() top.add(content_div) Container.put("TopWdg::content", content_div) # add a dummy button for global behaviors from tactic.ui.widget import ButtonNewWdg, IconButtonWdg ButtonNewWdg(title="DUMMY", icon=IconWdg.FILM) IconButtonWdg(title="DUMMY", icon=IconWdg.FILM) # NOTE: it does not need to be in the DOM. Just needs to be # instantiated #content_div.add(button) if my.widgets: content_wdg = my.get_widget('content') else: content_wdg = Widget() my.add(content_wdg) content_div.add(content_wdg) # add a calendar wdg from tactic.ui.widget import CalendarWdg cal_wdg = CalendarWdg(css_class='spt_calendar_template_top') cal_wdg.top.add_style('display: none') content_div.add(cal_wdg) if web.is_admin_page(): from tactic_branding_wdg import TacticCopyrightNoticeWdg branding = TacticCopyrightNoticeWdg(show_license_info=True) top.add(branding) # add the admin bar security = Environment.get_security() if not web.is_admin_page() and security.check_access( "builtin", "view_site_admin", "allow"): div = DivWdg() top.add(div) top.add_style("padding-top: 21px") div.add_class("spt_admin_bar") div.add_style("height: 15px") div.add_style("padding: 3px 0px 3px 15px") #div.add_style("margin-bottom: -5px") div.add_style("position: fixed") div.add_style("top: 0px") div.add_style("left: 0px") div.add_style("opacity: 0.7") div.add_style("width: 100%") #div.add_gradient("background", "background2", 20, 10) div.add_style("background-color", "#000") div.add_style("color", "#FFF") div.add_style("z-index", "1000") div.add_class("hand") div.set_box_shadow("0px 5px 5px") # remove icon_div = DivWdg() div.add(icon_div) icon_div.add_style("float: right") icon_div.add_style("margin-right: 10px") icon_div.add_style("margin-top: -3px") icon_button = IconButtonWdg(title="Remove Admin Bar", icon=IconWdg.G_CLOSE) icon_div.add(icon_button) icon_button.add_behavior({ 'type': 'click_up', 'cbjs_action': ''' var parent = bvr.src_el.getParent(".spt_admin_bar"); bvr.src_el.getParent(".spt_top").setStyle("padding-top", "0px"); spt.behavior.destroy_element(parent); ''' }) div.add("<b>ADMIN >></b>") div.add_behavior({ 'type': 'listen', 'event_name': 'close_admin_bar', 'cbjs_action': ''' bvr.src_el.getParent(".spt_top").setStyle("padding-top", "0px"); spt.behavior.destroy_element(bvr.src_el); ''' }) div.add_behavior({ 'type': 'mouseover', 'cbjs_action': ''' bvr.src_el.setStyle("opacity", 0.85) //new Fx.Tween(bvr.src_el).start('height', "30px"); ''' }) div.add_behavior({ 'type': 'mouseout', 'cbjs_action': ''' bvr.src_el.setStyle("opacity", 0.7) //new Fx.Tween(bvr.src_el).start('height', "15px"); ''' }) project_code = Project.get_project_code() div.add_behavior({ 'type': 'click_up', 'cbjs_action': ''' var url = "/tactic/%s/admin/link/_startup"; window.open(url); ''' % project_code }) # Add the script editor listener load_div = DivWdg() top.add(load_div) load_div.add_behavior({ 'type': 'listen', 'event_name': 'show_script_editor', 'cbjs_action': ''' var js_popup_id = "TACTIC Script Editor"; var js_popup = $(js_popup_id); if( js_popup ) { spt.popup.toggle_display( js_popup_id, false ); } else { spt.panel.load_popup(js_popup_id, "tactic.ui.app.ShelfEditWdg", {}, {"load_once": true} ); } ''' }) # deal with the palette defined in /index which can override the palette if my.kwargs.get("hash") == (): key = "index" search = Search("config/url") search.add_filter("url", "/%s/%%" % key, "like") search.add_filter("url", "/%s" % key) search.add_where("or") url = search.get_sobject() if url: xml = url.get_xml_value("widget") palette_key = xml.get_value("element/@palette") # look up palette the expression for index from pyasm.web import Palette palette = Palette.get() palette.set_palette(palette_key) colors = palette.get_colors() colors = jsondumps(colors) script = HtmlElement.script(''' var env = spt.Environment.get(); env.set_colors(%s); env.set_palette('%s'); ''' % (colors, palette_key)) top.add(script) env = Environment.get() client_handoff_dir = env.get_client_handoff_dir(include_ticket=False, no_exception=True) client_asset_dir = env.get_client_repo_dir() login = Environment.get_login() user_name = login.get_value("login") user_id = login.get_id() login_groups = Environment.get_group_names() # add environment information script = HtmlElement.script(''' var env = spt.Environment.get(); env.set_project('%s'); env.set_user('%s'); env.set_user_id('%s'); var login_groups = '%s'.split('|'); env.set_login_groups(login_groups); env.set_client_handoff_dir('%s'); env.set_client_repo_dir('%s'); ''' % (Project.get_project_code(), user_name, user_id, '|'.join(login_groups), client_handoff_dir, client_asset_dir)) top.add(script) # add a global container for commonly used widgets div = DivWdg() top.add(div) div.set_id("global_container") # add in the app busy widget # find out if there is an override for this search = Search("config/url") search.add_filter("url", "/app_busy") url = search.get_sobject() if url: busy_div = DivWdg() div.add(busy_div) busy_div.add_class("SPT_PUW") busy_div.add_styles( "display: none; position: absolute; z-index: 1000") busy_div.add_class("app_busy_msg_block") busy_div.add_style("width: 300px") busy_div.add_style("height: 100px") busy_div.add_style("padding: 20px") busy_div.add_color("background", "background3") busy_div.add_border() busy_div.set_box_shadow() busy_div.set_round_corners(20) busy_div.set_attr("id", "app_busy_msg_block") # put the custom url here title_wdg = DivWdg() busy_div.add(title_wdg) title_wdg.add_style("font-size: 20px") title_wdg.add_class("spt_app_busy_title") busy_div.add("<hr/>") msg_div = DivWdg() busy_div.add(msg_div) msg_div.add_class("spt_app_busy_msg") else: from page_header_wdg import AppBusyWdg div.add(AppBusyWdg()) # popup parent popup = DivWdg() popup.set_id("popup") div.add(popup) # create another general popup popup_div = DivWdg() popup_div.set_id("popup_container") popup_div.add_class("spt_panel") popup = PopupWdg(id="popup_template", destroy_on_close=True) popup_div.add(popup) div.add(popup_div) inner_html_div = DivWdg() inner_html_div.set_id("inner_html") div.add(inner_html_div) # add in a global color from tactic.ui.input import ColorWdg color = ColorWdg() div.add(color) # add in a global notify wdg from notify_wdg import NotifyWdg widget.add(NotifyWdg()) return widget
def get_content_wdg(self): div = DivWdg() div.add_class("spt_tool_top") #table = Table() from tactic.ui.container import ResizableTableWdg from table_layout_wdg import FastTableLayoutWdg #table = ResizableTableWdg() table = Table() table.add_style("table-layout", "fixed") table.add_style("width: 100%") div.add(table) table.add_row() td = table.add_cell() #td.add_style("width: 30%") kwargs = self.kwargs.copy() td.add_style("vertical-align: top") layout_div = DivWdg() layout_div.add_style("min-height: 500px") layout_div.add_style("height: auto") td.add(layout_div) #td.add_style("overflow: hidden") kwargs['height'] = 500 kwargs['show_shelf'] = False kwargs['show_search_limit'] = False kwargs['expand_on_load'] = True layout = FastTableLayoutWdg(**kwargs) layout_div.add(layout) layout.set_sobjects(self.sobjects) #from tactic.ui.panel import TileLayoutWdg #layout = TileLayoutWdg(**self.kwargs) #layout_div.add(layout) td = table.add_cell() td.add_border(color="#EEE") td.add_style("vertical-align: top") content = DivWdg() td.add(content) content.add_class("spt_tool_content") content.add_border(color="#EEE") content.add_style("margin: -1px") content.add_style("height: auto") #content.add_style("padding: 0px 20px") no_content_wdg = DivWdg() content.add(no_content_wdg) no_content_wdg.add("<br/>"*3) ''' The no content message displays tool icons and a message in format: <tools> <msg> ''' tool_icons = self.kwargs.get('tool_icon') if isinstance(tool_icons, basestring): tool_icon_lst = tool_icons.split("|") else: tool_icon_lst = None if tool_icon_lst: for icon in tool_icon_lst: icon = IconWdg(icon=icon) icon.add_style("padding", "5px") no_content_wdg.add(icon) no_content_wdg.add("</br></br>") tool_msg = self.kwargs.get('tool_msg') if tool_msg: no_content_wdg.add("<p>%s<p>" % tool_msg) else: no_content_wdg.add("Click the tool(s) to modify settings.") #no_content_wdg.add_style("opacity: 0.5") no_content_wdg.add_style("margin: 30px auto") no_content_wdg.add_color("color", "color3") no_content_wdg.add_color("background", "background3") no_content_wdg.add_style("text-align", "center") no_content_wdg.add_style("padding-top: 20px") no_content_wdg.add_style("padding-bottom: 20px") no_content_wdg.add_style("width: 350px") no_content_wdg.add_style("height: 110px") no_content_wdg.add_style("margin: 30px auto") no_content_wdg.add_border() return div
def get_display(my): search_key = my.kwargs.get("search_key") snapshot = my.kwargs.get("snapshot") if snapshot: my.snapshot = snapshot else: my.snapshot = SearchKey.get_by_search_key(search_key) assert my.snapshot metadata = my.snapshot.get_metadata() top = my.top top.add_color("background", "background") table = Table() table.set_max_width() top.add(table) table.set_unique_id() table.add_border() table.add_smart_styles("spt_cell", { 'padding': '3px' } ) tr = table.add_row() tr.add_gradient("background", "background3") th = table.add_header("Property") th.add_style("min-width: 200px") th.add_style("padding: 5px") th = table.add_header("Value") th.add_style("min-width: 400px") th.add_style("padding: 5px") keys = metadata.get("__keys__") if not keys: keys = metadata.keys() empty = False if not keys: empty = True keys = ['','','','','','',''] table.add_smart_styles("spt_cell", { 'height': '20px' } ) for i, key in enumerate(keys): value = metadata.get(key) title = Common.get_display_title(key) tr = table.add_row() if i % 2: tr.add_color("background", "background") tr.add_color("color", "color") else: tr.add_color("background", "background", -8) tr.add_color("color", "color") td = table.add_cell() td.add_class("spt_cell") td.add(title) td = table.add_cell() td.add_class("spt_cell") td.add(value) if empty: div = DivWdg() top.add(div) div.add_style("height: 30px") div.add_style("width: 150px") div.add_style("margin-top: -110px") div.center() div.add("<b>No Metadata</b>") div.add_border() div.add_color("background", "background3") div.add_color("color", "color3") div.add_style("padding: 20px") div.add_style("text-align: center") top.add_style("min-height: 200px") return top
def get_display(self): top = self.top login = self.kwargs.get("login") if not login or login == "$LOGIN": login = Environment.get_user_name() login_sobj = Login.get_by_code(login) #top.add_style("margin-top: -2px") #top.add_style("margin-left: -2px") thumb_div = DivWdg() thumb_div.add_style("float: left") thumb_div.add_style("margin-right: 5px") thumb_div.add_style("margin-bottom: 5px") thumb_div.add_style("padding-top: 1px") thumb = ThumbWdg() thumb.set_sobject(login_sobj) thumb_div.add(thumb) thumb.set_icon_size(90) thumb.set_aspect("height") full_name = login_sobj.get_full_name() info_wdg = DivWdg() top.add(info_wdg) name_wdg = DivWdg() info_wdg.add(thumb_div) info_wdg.add(name_wdg) name_wdg.add(" " * 3) name_wdg.add(full_name) name_wdg.add_style("font-size: 1.5em") name_wdg.add_style("font-weight: bold") name_wdg.add_style("padding: 5px") #name_wdg.add_style("margin-left: -10px") name_wdg.add_color("background", "background3") name_wdg.add_style("height: 20px") name_wdg.add_style("margin-bottom: 0px") name_wdg.add_border() info_wdg.add("<br/>") from tactic.ui.container import TabWdg # return if the supplied tab view has a config xml if self.tab_view: search = Search("config/widget_config") search.add_filter("category", "TabWdg") search.add_filter("view", self.tab_view) config_sobj = search.get_sobject() if config_sobj: config_xml = config_sobj.get_value('config') # replace the variable $login with the login clicked if login: config_xml = config_xml.replace('$login', login) tab = TabWdg(config_xml=config_xml, view=self.tab_view, show_add=False, show_remove=False) top.add(tab) return top config_xml = [] config_xml.append('<config>') config_xml.append('<tab>') config_xml.append(''' <element name='schedule'> <display class='tactic.ui.widget.TaskCalendarWdg'> <assigned>%s</assigned> <sobject_display_expr>%s</sobject_display_expr> <show_header>true</show_header> <show_border>false</show_border> </display> </element> ''' % (login, self.sobject_display_expr)) config_xml.append(''' <element name='activity'> <display class='tactic.ui.widget.ActivityCalendarWdg'> <login>%s</login> <cell_width>100px</cell_width> <cell_height>50px</cell_height> <show_header>true</show_header> <show_border>false</show_border> </display> </element> ''' % login) config_xml.append(''' <element name='tasks'> <display class='tactic.ui.panel.FastTableLayoutWdg'> <search_type>sthpw/task</search_type> <view>table</view> <expression>@SOBJECT(sthpw/task['assigned','%s']['@ORDER_BY', 'bid_start_date desc'])</expression> <mode>simple</mode> </display> </element> ''' % login) config_xml.append(''' <element name='work_hours'> <display class='tactic.ui.widget.SObjectCalendarWdg'> <login>%s</login> <!-- <cell_width>100px</cell_width> --> <cell_height>50px</cell_height> <show_header>true</show_header> <show_border>false</show_border> <search_type>sthpw/work_hour</search_type> <handler>tactic.ui.widget.WorkHourCalendarDayWdg</handler> <start_date_col>day</start_date_col> <end_date_col>day</end_date_col> </display> </element> ''' % login) config_xml.append(''' <element name='recent transactions'> <display class='tactic.ui.panel.FastTableLayoutWdg'> <search_type>sthpw/transaction_log</search_type> <view>table</view> <expression>@SOBJECT(sthpw/transaction_log['login','%s']['@ORDER_BY','timestamp desc']['@LIMIT','30'])</expression> <element_names>code,timestamp,namespace,description,transaction_log_hidden</element_names> <show_shelf>false</show_shelf> <show_select>false</show_select> </display> </element> ''' % login) config_xml.append('</tab>') config_xml.append('</config>') config_xml = "".join(config_xml) tab = TabWdg(config_xml=config_xml, view='tab', show_add=False, show_remove=False) top.add(tab) tab.add_style("margin-left: -2px") tab.add_style("margin-right: -2px") return top