def get_files_list(self): outer_div = DivWdg() file_in_package_sobjects = get_file_in_package_sobjects_by_package_code(self.package_sobject.get_code()) file_sobjects = get_file_sobjects_from_file_in_package_sobjects(file_in_package_sobjects) files_unordered_html_list = HtmlElement.ul() for file_sobject, file_in_package_sobject in zip(file_sobjects, file_in_package_sobjects): task_sobject = file_in_package_sobject.get_all_children('sthpw/task')[0] file_li = HtmlElement.li() file_li.add(file_sobject.get('file_path') + ' - ' + task_sobject.get('status')) change_status_button = ButtonNewWdg(title='Change Status', icon='EDIT') change_status_button.add_behavior( obu.get_load_popup_widget_with_reload_behavior( 'Change Status', 'widgets.ChangeStatusWdg', task_sobject.get_search_key(), 'Package', 'widgets.PackageInspectWdg', self.package_sobject.get_search_key() ) ) change_status_button.add_style('display', 'inline-block') file_li.add(change_status_button) files_unordered_html_list.add(file_li) outer_div.add(files_unordered_html_list) return outer_div
def get_display(self): outer_div = DivWdg() outer_div.set_id('edit_instructions_{0}'.format(self.instructions_sobject.get_code())) # Get a list of the components the instructions are attached to attached_components = get_components_attached_to_instructions(self.instructions_sobject) component_div = DivWdg() title_span = SpanWdg() if attached_components: title_span.add('The following Components are attached to this Instructions Document:') component_div.add(title_span) component_list = HtmlElement.ul() for component in attached_components: li = HtmlElement.li() li.add('{0} ({1})'.format(component.get('name'), component.get_code())) component_list.add(li) component_div.add(component_list) else: title_span.add('Instructions are not currently attached to any Components') component_div.add(title_span) outer_div.add(component_div) outer_div.add(get_instructions_textarea_wdg(self.instructions_sobject)) submit_button = SubmitWdg('Submit Changes') submit_button.add_behavior(self.submit_button_behavior()) submit_button.add_style('display', 'block') outer_div.add(submit_button) return outer_div
def get_display(my): dd_activator = DivWdg() if my.style: dd_activator.add_styles( my.style ) dd_activator.add_style( "width: %spx" % my.width ) dd_activator.add_class("SPT_DTS"); if my.nudge_menu_horiz != 0: dd_activator.set_attr("spt_nudge_menu_horiz", my.nudge_menu_horiz) if my.nudge_menu_vert != 0: dd_activator.set_attr("spt_nudge_menu_vert", my.nudge_menu_vert) # Generate button ... # table = Table() table.add_row() table.add_styles("width: 100%; padding: 0px; margin: 0px;") td = table.add_cell() td.add_looks("menu border curs_default") td.add_styles( "padding: 0px; width: 100%; overflow: hidden; height: 12px; max-height: 12px;" ) title_div = DivWdg() title_div.add_styles( "padding: 0px; margin-left: 4px; margin-top: 1px;" ) if my.icon_path: img = HtmlElement.img() img.set_attr("src", my.icon_path) img.set_attr("title", my.title) img.add_styles("padding: 0px; padding-bottom: 1px; margin: 0px; text-decoration: none;") title_div.add(img) title_div.add_looks("menu") else: title_div.add(my.title) title_div.add_looks("menu fnt_text") td.add( title_div ) td = table.add_cell() # -- Example of setting only some of the borders with dotted style ... # td.add_looks( "menu_btn_icon clear_borders border_bottom border_right dotted" ) td.add_looks( "menu_btn_icon border curs_default" ) td.add_styles( "padding: 0px; text-align: center; overflow: hidden; " \ "width: 15px; min-width: 15px;" \ "height: 12px; max-height: 12px;" ) arrow_img = HtmlElement.img("/context/icons/silk/_spt_bullet_arrow_down_dark_8x8.png") arrow_img.add_styles( "border: 0px; margin-left: 1px; margin-top: 0px;" ) td.add( arrow_img ) dd_activator.add(table) dd_activator.add( my.kwargs.get("smart_menu_set") ) dd_activator.add_class("SPT_SMENU_ACTIVATOR") dd_activator.add_behavior( { 'type': 'click_up', 'activator_type' : 'smart_menu', 'cbjs_action': 'spt.smenu.show_on_dropdown_click_cbk( evt, bvr )' } ) return dd_activator
def get_license_info_wdg(self): div = DivWdg() license = Environment.get_security().get_license() if self.first_error: return div #if not license.is_licensed(): # return div msg = DivWdg() div.add(msg) msg.add("The following describes the details of the installed license:<br/><br/>") info_wdg = DivWdg() div.add(info_wdg) info_wdg.add_style("margin: 10px 30px") info_wdg.add_style("font-size: 12px") version = license.get_data("tactic_version") if version: info_wdg.add("TACTIC Version: ") if version == "ALL": version = "ALL (Open Source)" info_wdg.add(version) info_wdg.add(HtmlElement.br(2)) company = license.get_data("company") info_wdg.add("Licensed To: ") if company.find("Southpaw EPL") != -1: company = SpanWdg("<a name='license'>Eclipse Public License v1.0</a> ") icon = IconWdg("EPL v1.0", IconWdg.ZOOM) company.add(icon) company.add_class("hand") company.add_behavior( { 'type': 'click_up', 'cbjs_action': ''' spt.help.load_alias("license") ''' } ) info_wdg.add(company) info_wdg.add(HtmlElement.br(2)) info_wdg.add("Max Users: ") info_wdg.add(license.get_data("max_users") ) info_wdg.add(HtmlElement.br(2)) info_wdg.add("Current Users: ") info_wdg.add(license.get_current_users() ) info_wdg.add(HtmlElement.br(2)) info_wdg.add("Expiry Date: ") expiry_date = license.get_data("expiry_date") if not expiry_date: expiry_date = "Permanent" info_wdg.add(expiry_date) info_wdg.add(HtmlElement.br(2)) return div
def get_display(self): # Set up the outer <div> to hold all the form elements outer_div = DivWdg() outer_div.add_class('new-order-entry-form') outer_div.set_id('new-order-entry-form') # Set up the <input> widget for 'name' outer_div.add(HtmlElement.label('Name')) name_input = TextInputWdg(name='name') outer_div.add(name_input) # Set up the <input> widget for 'po_number' outer_div.add(HtmlElement.label('PO Number')) po_number_input = TextInputWdg() po_number_input.set_name('po_number') outer_div.add(po_number_input) # Set up the <select> widget and it's options for 'client' outer_div.add(HtmlElement.label('Client')) client_select_wdg = get_select_widget_from_search_type( 'twog/client', 'client', 'name', 'code') outer_div.add(client_select_wdg) # Set up the Save button save_button = SubmitWdg('Save') save_button.add_behavior(self.save_button_behavior()) outer_div.add(save_button) # Set up the Save and Add button save_and_add_button = SubmitWdg('Save and Add') save_and_add_button.add_behavior(self.save_and_add_button_behavior()) outer_div.add(save_and_add_button) return outer_div
def _get_sobject_history_wdg(self): ''' this method is called thru ajax ''' args = WebContainer.get_web().get_form_args() # get the args in the URL search_type = args['search_type'] search_id = args['search_id'] #sobject = Search.get_by_id(search_type, search_id) div = Widget() search = Search("sthpw/sobject_log") search.add_filter("search_type", search_type) search.add_filter("search_id", search_id) sobjects = search.get_sobjects() search = Search("sthpw/transaction_log") search.add_filters( "id", [x.get_value("transaction_log_id") for x in sobjects]) sobjects = search.get_sobjects() table = TableWdg("sthpw/transaction_log", "table", css='table') table.set_show_property(False) table.set_sobjects(sobjects) div.add(table) div.add(HtmlElement.br(2)) return div div.add(assigned_shot_wdg) div.add(HtmlElement.br(2)) return div
def _get_sobject_history_wdg(my): ''' this method is called thru ajax ''' args = WebContainer.get_web().get_form_args() # get the args in the URL search_type = args['search_type'] search_id = args['search_id'] #sobject = Search.get_by_id(search_type, search_id) div = Widget() search = Search("sthpw/sobject_log") search.add_filter("search_type", search_type) search.add_filter("search_id", search_id) sobjects = search.get_sobjects() search = Search("sthpw/transaction_log") search.add_filters("id", [x.get_value("transaction_log_id") for x in sobjects] ) sobjects = search.get_sobjects() table = TableWdg("sthpw/transaction_log", "table", css='table') table.set_show_property(False) table.set_sobjects(sobjects) div.add(table) div.add(HtmlElement.br(2)) return div div.add(assigned_shot_wdg) div.add(HtmlElement.br(2)) return div
def get_display(self): # Set up the outer <div> to hold all the form elements outer_div = DivWdg() outer_div.add_class('new-order-entry-form') outer_div.set_id('new-order-entry-form') # Set up the <input> widget for 'name' outer_div.add(HtmlElement.label('Name')) name_input = TextInputWdg(name='name') outer_div.add(name_input) # Set up the <input> widget for 'po_number' outer_div.add(HtmlElement.label('PO Number')) po_number_input = TextInputWdg() po_number_input.set_name('po_number') outer_div.add(po_number_input) # Set up the <select> widget and it's options for 'client' outer_div.add(HtmlElement.label('Client')) client_select_wdg = get_select_widget_from_search_type('twog/client', 'client', 'name', 'code') outer_div.add(client_select_wdg) # Set up the Save button save_button = SubmitWdg('Save') save_button.add_behavior(self.save_button_behavior()) outer_div.add(save_button) # Set up the Save and Add button save_and_add_button = SubmitWdg('Save and Add') save_and_add_button.add_behavior(self.save_and_add_button_behavior()) outer_div.add(save_and_add_button) return outer_div
def get_folder_wdg(my, element_name, config, options, base_path, current_path, info, personal, use_same_config): li = HtmlElement.li() li.add_class("spt_side_bar_link") li.add_class("main_li") title = my._get_title(config, element_name) title_wdg = DivWdg() title_wdg.add_class("menu_header") li.add(title_wdg) title_wdg.add(title) ul = HtmlElement.ul() li.add(ul) ul.add_class("spt_side_bar_section") ul.add_class("sub_ul") # then get view name from options in order to read a new # config and recurse ... options_view_name = options.get('view') if options_view_name: if use_same_config: xml = config.get_xml() sub_config = WidgetConfig.get(xml=xml) sub_config.set_view(options_view_name) else: sub_config = my.get_config( my.config_search_type, options_view_name, default=my.default, personal=personal) info['level'] += 1 my.generate_section( sub_config, ul, info, base_path=current_path, personal=personal, use_same_config=use_same_config ) info['level'] -= 1 return li
def draw_widgets(my, widget, delete_widget, item_span): '''actually drawing the widgets''' widget.add(item_span) widget.add(HtmlElement.br(2)) widget.add(SpanWdg(my.select, css='med')) widget.add(delete_widget) widget.add(HtmlElement.br(2))
def get_display(self): dd_activator = DivWdg() if self.style: dd_activator.add_styles( self.style ) dd_activator.add_style( "width: %spx" % self.width ) dd_activator.add_class("SPT_DTS"); if self.nudge_menu_horiz != 0: dd_activator.set_attr("spt_nudge_menu_horiz", self.nudge_menu_horiz) if self.nudge_menu_vert != 0: dd_activator.set_attr("spt_nudge_menu_vert", self.nudge_menu_vert) # Generate button ... # table = Table() table.add_row() table.add_styles("width: 100%; padding: 0px; margin: 0px;") td = table.add_cell() td.add_looks("menu border curs_default") td.add_styles( "padding: 0px; width: 100%; overflow: hidden; height: 12px; max-height: 12px;" ) title_div = DivWdg() title_div.add_styles( "padding: 0px; margin-left: 4px; margin-top: 1px;" ) if self.icon_path: img = HtmlElement.img() img.set_attr("src", self.icon_path) img.set_attr("title", self.title) img.add_styles("padding: 0px; padding-bottom: 1px; margin: 0px; text-decoration: none;") title_div.add(img) title_div.add_looks("menu") else: title_div.add(self.title) title_div.add_looks("menu fnt_text") td.add( title_div ) td = table.add_cell() # -- Example of setting only some of the borders with dotted style ... # td.add_looks( "menu_btn_icon clear_borders border_bottom border_right dotted" ) td.add_looks( "menu_btn_icon border curs_default" ) td.add_styles( "padding: 0px; text-align: center; overflow: hidden; " \ "width: 15px; min-width: 15px;" \ "height: 12px; max-height: 12px;" ) arrow_img = HtmlElement.img("/context/icons/silk/_spt_bullet_arrow_down_dark_8x8.png") arrow_img.add_styles( "border: 0px; margin-left: 1px; margin-top: 0px;" ) td.add( arrow_img ) dd_activator.add(table) dd_activator.add( self.kwargs.get("smart_menu_set") ) dd_activator.add_class("SPT_SMENU_ACTIVATOR") dd_activator.add_behavior( { 'type': 'click_up', 'activator_type' : 'smart_menu', 'cbjs_action': 'spt.smenu.show_on_dropdown_click_cbk( evt, bvr )' } ) return dd_activator
def get_out_files_list(task_data_code, task_sobject_search_key): out_files_list = get_task_data_out_files(task_data_code) div_wdg = DivWdg() if out_files_list: out_files_unordered_html_list = HtmlElement.ul() for out_file in out_files_list: file_li = HtmlElement.li() file_li.add('{0} ({1})'.format( out_file.get('file_path'), out_file.get('classification').title())) file_edit_button = ButtonNewWdg(title='Edit File', icon='EDIT') file_edit_button.add_behavior( obu.get_load_popup_widget_with_reload_behavior( 'Edit File', 'widgets.EditFileWdg', out_file.get_search_key(), 'Task', 'widgets.TaskInspectWdg', task_sobject_search_key)) file_edit_button.add_style('display', 'inline-block') file_li.add(file_edit_button) out_files_unordered_html_list.add(file_li) div_wdg.add(out_files_unordered_html_list) else: div_wdg.add('No output files exist for this task') return div_wdg
def get_div_for_department_instructions(self, department_instructions_sobject): department_instructions_div = DivWdg() department_instructions_div.add(HtmlElement.h4(department_instructions_sobject.get('name'))) department_instructions_div.add(HtmlElement.p(department_instructions_sobject.get('instructions_text'))) return department_instructions_div
def init(self): list_item_table = '' self.full_item_list = [] if self.kwargs.has_key( 'list_item_table' ): list_item_table = self.kwargs.get( 'list_item_table' ) expr = '@SOBJECT(MMS/%s)' % list_item_table parser = ExpressionParser() self.full_item_list = parser.eval(expr) self.el_name = '' if self.kwargs.has_key( 'element_name' ): self.el_name = self.kwargs.get( 'element_name' ) self.input_el_name = '' if self.kwargs.has_key( 'input_element_to_find' ): self.input_el_name = self.kwargs.get( 'input_element_to_find' ) self.col_to_match = '' if self.kwargs.has_key( 'column_to_match_value' ): self.col_to_match = self.kwargs.get( 'column_to_match_value' ) self.col_for_label = '' if self.kwargs.has_key( 'column_for_label' ): self.col_for_label = self.kwargs.get( 'column_for_label' ) self.select_element = HtmlElement('select')
def draw_widgets(self, widget, delete_widget, item_span): '''actually drawing the widgets''' widget.add(item_span) widget.add(HtmlElement.br(2)) widget.add(SpanWdg(self.select, css='med')) widget.add(delete_widget) widget.add(HtmlElement.br(2))
def get_out_files_list(task_data_code, task_sobject_search_key): out_files_list = get_task_data_out_files(task_data_code) div_wdg = DivWdg() if out_files_list: out_files_unordered_html_list = HtmlElement.ul() for out_file in out_files_list: file_li = HtmlElement.li() file_li.add('{0} ({1})'.format(out_file.get('file_path'), out_file.get('classification').title())) file_edit_button = ButtonNewWdg(title='Edit File', icon='EDIT') file_edit_button.add_behavior( obu.get_load_popup_widget_with_reload_behavior( 'Edit File', 'widgets.EditFileWdg', out_file.get_search_key(), 'Task', 'widgets.TaskInspectWdg', task_sobject_search_key ) ) file_edit_button.add_style('display', 'inline-block') file_li.add(file_edit_button) out_files_unordered_html_list.add(file_li) div_wdg.add(out_files_unordered_html_list) else: div_wdg.add('No output files exist for this task') return div_wdg
def get_license_info_wdg(my): div = DivWdg() license = Environment.get_security().get_license() if my.first_error: return div #if not license.is_licensed(): # return div msg = DivWdg() div.add(msg) msg.add("The following describes the details of the installed license:<br/><br/>") info_wdg = DivWdg() div.add(info_wdg) info_wdg.add_style("margin: 10px 30px") info_wdg.add_style("font-size: 12px") version = license.get_data("tactic_version") if version: info_wdg.add("TACTIC Version: ") if version == "ALL": version = "ALL (Open Source)" info_wdg.add(version) info_wdg.add(HtmlElement.br(2)) company = license.get_data("company") info_wdg.add("Licensed To: ") if company.find("Southpaw EPL") != -1: company = SpanWdg("<a name='license'>Eclipse Public License v1.0</a> ") icon = IconWdg("EPL v1.0", IconWdg.ZOOM) company.add(icon) company.add_class("hand") company.add_behavior( { 'type': 'click_up', 'cbjs_action': ''' spt.help.load_alias("license") ''' } ) info_wdg.add(company) info_wdg.add(HtmlElement.br(2)) info_wdg.add("Max Users: ") info_wdg.add(license.get_data("max_users") ) info_wdg.add(HtmlElement.br(2)) info_wdg.add("Current Users: ") info_wdg.add(license.get_current_users() ) info_wdg.add(HtmlElement.br(2)) info_wdg.add("Expiry Date: ") expiry_date = license.get_data("expiry_date") if not expiry_date: expiry_date = "Permanent" info_wdg.add(expiry_date) info_wdg.add(HtmlElement.br(2)) 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_display(my): div = DivWdg() div.add_class("spt_view_manager_top") my.set_as_panel(div) if not my.search_type or not my.view: return div div.add(my.get_action_wdg()) div.add(HtmlElement.br(2)) tool_bar = my.get_tool_bar() div.add(tool_bar) div.add(HtmlElement.br()) # add the template view containing the possible items to be added # ie: New Folder, New Entry, New Separator menu_div = DivWdg() menu_div.set_id("menu_item_template") menu_div.add_style("display: none") menu_div.add(my.get_section_wdg("_template", editable=False)) div.add(menu_div) table = Table() table.add_row() # add the section td = table.add_cell() project_view = DivWdg() project_view.set_id("menu_item_list") project_view.add(my.get_section_wdg(my.view)) td.add(project_view) td.add_style("vertical-align: top") #td.add_attr("rowspan", "2") tool_bar = my.get_tool_bar() td.add(tool_bar) td.add("<br/>") # add detail information td = table.add_cell(my.get_detail_wdg()) # FIXME: get rid of hard coded classes # set the panel information td.set_id("manage_side_bar_detail") td.add_class("spt_view_manager_detail") td.add_style("display", "table-cell") td.add_attr("spt_class_name", "tactic.ui.panel.ManageSideBarDetailWdg") td.add_attr("spt_search_type", my.search_type) td.add_style("padding: 0 20px 20px 20px") td.add_style("vertical-align: top") div.add(table) return div
def get_no_icon_wdg(my, missing=False): sobject = my.get_current_sobject() if not sobject: return '' div = my.top div.add_style("position: relative") div.add_style("margin: 3px") div.add_class("spt_thumb_top") div.set_id( "thumb_%s" % sobject.get_search_key() ) icon_size = my.get_icon_size() if icon_size: div.add_style("%s: %s" % (my.aspect, icon_size) ) if missing: img = HtmlElement.img(ThumbWdg.get_missing_image()) elif sobject.get_value("_is_collection", no_exception=True): img = HtmlElement.img("/context/icons/mime-types/folder2.jpg") else: img = HtmlElement.img(ThumbWdg.get_no_image()) img.add_class("spt_image") #from tactic.ui.table import SObjectDetailElementWdg #detail = SObjectDetailElementWdg() #detail.set_widget(img) #detail.set_sobject(sobject) #div.add(detail) div.add(img) div.add_class("hand") if my.SQL_ERROR: warning_div = DivWdg('<i>-- preprocess error --</i>') warning_div.add_styles('position: absolute; z-index: 100; float: left; top: 0; left: 0; font-size: smaller;') div.add_style('position: relative') div.add(warning_div) search_key = SearchKey.get_by_sobject(sobject) code = sobject.get_code() detail = my.get_option("detail") if detail != 'false': my.add_icon_behavior(div, sobject) unit = None if isinstance(icon_size, basestring): icon_size, unit = my.split_icon_size(icon_size) img.add_style("%s: 100%%" % my.aspect ) else: img.add_style("%s: %s" % (my.aspect, my.get_icon_size()) ) img.add_style("min-%s: 15px" % my.aspect) return div
def get_display(my): width = my.kwargs.get("width") if not width: width = "100%" height = my.kwargs.get("height") 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: 10px 15%") img.add_style("width: 70%") elif path: img.add_style("width: %s" % width) if height: img.add_style("height: %s" % height) img.add_style('margin-left','auto') img.add_style('margin-right','auto') if not path: img = DivWdg() img.add_class("spt_image") div.add(img) if height or my.show_name_hover in ["True","true",True]: div.add_style("height: 100%") if my.show_name_hover in ["True","true",True]: name_hover = DivWdg() name_hover.add_class("spt_name_hover") name_hover.add(sobject.get('name')) name_hover.add_attr('onmouseenter',"this.setStyle('opacity',1)") name_hover.add_attr('onmouseleave',"this.setStyle('opacity',0)") name_hover.add_styles('opacity: 0; font-size: 16px; color: rgb(217, 217, 217); top: 0px; \ transition: opacity 0s ease-out; -webkit-transition: opacity 0s ease-out; \ height: 100%; width: 100%; position: absolute; padding-top: 20px; \ text-align: center; background-color: rgba(0, 0, 0, 0.6);') div.add(name_hover) return div
def init(self): if self.icon_path.startswith("BS") or self.icon_path.startswith("FA"): icon_path = self.icon_path elif not self.icon_path.startswith("/"): # icon_path = "/context/icons/oo/%s" % self.icon_path icon_path = "/context/icons/silk/%s" % self.icon_path else: icon_path = self.icon_path if icon_path.startswith("BS_"): icon = HtmlElement.span() icon.add_class("glyphicon") part = icon_path.replace("BS_", "") part = part.lower() part = part.replace("_","-") if part == "save": part = "floppy-disk" icon.add_class("glyphicon-%s" % part) if not self.size: self.size = "16px" icon.add_style("font-size: %s" % self.size) if not self.opacity: self.opacity = 0.6 elif icon_path.startswith("FA"): icon = HtmlElement.i() icon.add_class("fa") part = icon_path.replace("FA_", "") part = part.lower() part = part.replace("_","-") icon.add_class("fa-%s" % part) if not self.size: self.size = "16px" icon.add_style("font-size: %s" % self.size) if not self.opacity: self.opacity = 0.6 else: icon = HtmlElement.img(icon_path) if self.opacity: icon.add_style("opacity: %s" % self.opacity) if self.text and self.text != "": icon.set_attr("title", self.text) if self.right_margin: icon.add_style("margin-right: %s" % self.right_margin) self.icon = icon inline = self.kwargs.get("inline") if inline in [False, 'false']: self.add_style("float: left") else: self.add_style("display: inline")
def get_display(my): web = WebContainer.get_web() if not my.view: view = web.get_form_value("filter|view") # create popup create_popup = PopupWdg("create_action") create_popup.set_auto_hide(False) create_popup.add("Enter name of view: ") create_popup.add(TextWdg("create_view_name")) # create_popup.add( HtmlElement.br(2) ) # create_popup.add( "Copy from template: " ) # template_select = SelectWdg("copy_from_template") # template_select.add_empty_option("-- None --") # template_select.set_option("values", "list|summary|task") # create_popup.add( template_select ) create_popup.add(HtmlElement.br(2, clear="all")) from pyasm.prod.web import ProdIconButtonWdg, ProdIconSubmitWdg create_icon = ProdIconButtonWdg("Create") ajax = AjaxCmd() ajax.register_cmd("pyasm.widget.CustomCreateViewCbk") ajax.add_element_name("create_view_name") ajax.add_element_name("auto_create_edit") ajax.set_option("search_type", my.search_type) ajax.set_option("project", Project.get_project_code()) if my.view: ajax.set_option("template_view", my.view) create_icon.add_event( "onclick", "%s;%s" % (ajax.get_on_script(), "toggle_display('create_action');setTimeout('document.form.submit()',1000)"), ) cancel_icon = ProdIconButtonWdg("Cancel") cancel_icon.add_event("onclick", "toggle_display('create_action')") span = SpanWdg() span.add(create_icon) span.add(cancel_icon) create_popup.add(span) create_popup.add(HtmlElement.br()) # add the create button create = IconButtonWdg("Create View", IconWdg.SAVE, True) create.add_event("onclick", "%s" % create_popup.get_on_script()) # lay it all out widget = Widget() widget.add(create_popup) # Browser does not have create # widget.add(create) return widget
def get_display(my): # just refresh the whole thing widget = DivWdg() outer_widget = DivWdg(css='spt_view_panel') search_div = DivWdg() search_bvr = { 'type': 'click_up', 'cbjs_action': 'spt.dg_table.search_cbk(evt, bvr)', 'override_class_name': 'tactic.ui.cgapp.AppShotPanelWdg', 'override_target': 'bvr.src_el.getParent(".spt_app_shot_panel")', 'extra_args': {'instance_search_type': my.instance_search_type, 'asset_search_type': my.asset_search_type} #'panel_id': 'main_body_search' } # WARNING: this is made just for main search box and won't be compatible with the simple search wdg search_wdg = SearchWdg(search_type=my.search_type, custom_search_view='search_shot_loader', parent_key='', filter=''\ , display='block', custom_filter_view='', state=None, run_search_bvr=search_bvr) #from tactic.ui.app.simple_search_wdg import SimpleSearchWdg #search_wdg = SimpleSearchWdg(search_type=my.search_type, search_view=my.simple_search_view, state=None, run_search_bvr=search_bvr) search_div.add( HtmlElement.spacer_div(1,10) ) search_div.add(search_wdg) # if there is result, it could only be one shot search = search_wdg.get_search() shots = search.get_sobjects() # avoid getting a shot when no shot is selected if not my.shot_code and len(shots) == 1: my.shot_code = shots[0].get_code() outer_widget.add(search_div) my.set_as_panel(outer_widget, class_name='spt_panel spt_view_panel spt_app_shot_panel') #show_shot_panel = False #if show_shot_panel: panel = ViewPanelWdg( search_type=my.search_type, \ inline_search=True, show_search='false', show_refresh='false', view=my.view, \ run_search_bvr=search_bvr, simple_search_view=my.simple_search_view) panel.set_sobjects(shots) widget.add(panel) show_instances_in_shot = ProdSetting.get_value_by_key("show_instances_in_shot_panel") if show_instances_in_shot != "false": widget.add(HtmlElement.h3("Asset Instances in Shot [%s]" %my.shot_code)) widget.add(HtmlElement.br(2)) asset_inst_panel = AppAssetInstancePanelWdg(search_type=my.search_type, instance_search_type=my.instance_search_type, asset_search_type=my.asset_search_type, shot_code=my.shot_code, show_search='false') widget.add(asset_inst_panel) outer_widget.add(widget) return outer_widget
def init(self): self.layer = LayerWdg(self.xpos, self.ypos, self.display) if not self.width: self.shadowbox = ShadowBoxWdg(self.shad_name) else: self.shadowbox = ShadowBoxWdg(self.shad_name, self.width) # do not enable it for the Login page web = WebContainer.get_web() if self.shad_name and not web.is_IE(): BaseAppServer.add_onload_script("Move.drag('%s','%s')" \ %(self.shadowbox.get_name(), self.iframe_name)) div = DivWdg() from pyasm.widget import IconButtonWdg move_button = IconWdg(name='move me', icon=IconWdg.NAV) move_button.set_id("%s_handle" % (self.shad_name)) move_button.add_class('move') move_button.add_style('float: left') move_button.add_style('padding: 2px 0 0 6px') if not web.is_IE(): div.add(move_button) mbutton = IconButtonWdg(name='close window', icon=IconWdg.KILL) mbutton.set_class("moduleKillBtn") mbutton.add_event("onclick", self.layer.get_off_script()) div.add(mbutton) if self.nav_links: back_link = HtmlElement.href("<<", "javascript:history.back()") back_link.add_style("font-size", "1.4em") for_link = HtmlElement.href(">>", "javascript:history.forward()") for_link.add_style("font-size", "1.4em") div.add(SpanWdg(back_link, css='med')) div.add(SpanWdg(for_link, css='med')) self.shadowbox.set_header(div) # add button and title_wdg to shadow box if self.title_wdg: title_wdg = DivWdg() title_wdg.set_class("moduleTitle") title_wdg.add(self.title_wdg) self.shadowbox.set_title_wdg(title_wdg) self.layer.add(self.shadowbox) self._add_widget(self.layer)
def init(my): my.layer = LayerWdg(my.xpos, my.ypos, my.display) if not my.width: my.shadowbox = ShadowBoxWdg(my.shad_name) else: my.shadowbox = ShadowBoxWdg(my.shad_name, my.width) # do not enable it for the Login page web = WebContainer.get_web() if my.shad_name and not web.is_IE(): BaseAppServer.add_onload_script("Move.drag('%s','%s')" \ %(my.shadowbox.get_name(), my.iframe_name)) div = DivWdg() from pyasm.widget import IconButtonWdg move_button = IconWdg(name='move me', icon=IconWdg.NAV) move_button.set_id("%s_handle" % (my.shad_name)) move_button.add_class('move') move_button.add_style('float: left') move_button.add_style('padding: 2px 0 0 6px') if not web.is_IE(): div.add(move_button) mbutton = IconButtonWdg(name='close window', icon=IconWdg.KILL) mbutton.set_class("moduleKillBtn") mbutton.add_event("onclick", my.layer.get_off_script() ) div.add(mbutton) if my.nav_links: back_link = HtmlElement.href("<<", "javascript:history.back()") back_link.add_style("font-size", "1.4em") for_link = HtmlElement.href(">>", "javascript:history.forward()") for_link.add_style("font-size", "1.4em") div.add(SpanWdg(back_link, css='med')) div.add(SpanWdg(for_link, css='med')) my.shadowbox.set_header(div) # add button and title_wdg to shadow box if my.title_wdg: title_wdg = DivWdg() title_wdg.set_class("moduleTitle") title_wdg.add(my.title_wdg) my.shadowbox.set_title_wdg(title_wdg) my.layer.add(my.shadowbox) my._add_widget(my.layer)
def get_display(my): web = WebContainer.get_web() if not my.view: view = web.get_form_value("filter|view") # create popup create_popup = PopupWdg("create_action") create_popup.set_auto_hide(False) create_popup.add("Enter name of view: ") create_popup.add(TextWdg("create_view_name")) #create_popup.add( HtmlElement.br(2) ) #create_popup.add( "Copy from template: " ) #template_select = SelectWdg("copy_from_template") #template_select.add_empty_option("-- None --") #template_select.set_option("values", "list|summary|task") #create_popup.add( template_select ) create_popup.add(HtmlElement.br(2, clear="all")) from pyasm.prod.web import ProdIconButtonWdg, ProdIconSubmitWdg create_icon = ProdIconButtonWdg('Create') ajax = AjaxCmd() ajax.register_cmd("pyasm.widget.CustomCreateViewCbk") ajax.add_element_name("create_view_name") ajax.add_element_name("auto_create_edit") ajax.set_option("search_type", my.search_type) ajax.set_option("project", Project.get_project_code()) if my.view: ajax.set_option("template_view", my.view) create_icon.add_event( "onclick", "%s;%s" % (ajax.get_on_script(), "toggle_display('create_action');setTimeout('document.form.submit()',1000)" )) cancel_icon = ProdIconButtonWdg('Cancel') cancel_icon.add_event("onclick", "toggle_display('create_action')") span = SpanWdg() span.add(create_icon) span.add(cancel_icon) create_popup.add(span) create_popup.add(HtmlElement.br()) # add the create button create = IconButtonWdg("Create View", IconWdg.SAVE, True) create.add_event("onclick", "%s" % create_popup.get_on_script()) # lay it all out widget = Widget() widget.add(create_popup) # Browser does not have create #widget.add(create) return widget
def init(self): if self.icon_path.startswith("BS") or self.icon_path.startswith("FA"): icon_path = self.icon_path elif not self.icon_path.startswith("/"): # icon_path = "/context/icons/oo/%s" % self.icon_path icon_path = "/context/icons/silk/%s" % self.icon_path else: icon_path = self.icon_path if icon_path.startswith("BS_"): icon = HtmlElement.span() icon.add_class("glyphicon") part = icon_path.replace("BS_", "") part = part.lower() part = part.replace("_", "-") if part == "save": part = "floppy-disk" icon.add_class("glyphicon-%s" % part) if not self.size: self.size = "16px" icon.add_style("font-size: %s" % self.size) if not self.opacity: self.opacity = 0.6 elif icon_path.startswith("FA"): icon = HtmlElement.i() icon.add_class("fa") part = icon_path.replace("FA_", "") part = part.lower() part = part.replace("_", "-") icon.add_class("fa-%s" % part) if not self.size: self.size = "16px" icon.add_style("font-size: %s" % self.size) if not self.opacity: self.opacity = 0.6 else: icon = HtmlElement.img(icon_path) if self.opacity: icon.add_style("opacity: %s" % self.opacity) if self.text and self.text != "": icon.set_attr("title", self.text) if self.right_margin: icon.add_style("margin-right: %s" % self.right_margin) self.icon = icon inline = self.kwargs.get("inline") if inline in [False, 'false']: self.add_style("float: left") else: self.add_style("display: inline")
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 init(self): div_main = DivWdg(css='module') if self.width != None: widthstr = "width: %sem" % (self.width) div_main.add_style(widthstr) # reset self.name, create the content widget if not self.shad_name: self.shad_name = "ShadowBox%s" % (self.generate_unique_id()) div_main.set_id(self.shad_name) div_main.center() div_head = DivWdg(css='boxhead') # HACK to compensate for IE weird handling of CSS if WebContainer.get_web().is_IE() and 'password' in self.shad_name: div_head.add_style('left', '-242px') div_head.add_style('padding-bottom: 2px') empty_header = Widget(name=self.HEADER) div_head.add(empty_header, empty_header.get_name()) div_head.add(self.title_wdg, self.title_wdg.get_name()) div_control = DivWdg(css='control') empty_control = Widget(name=self.CONTROL) div_control.add(empty_header, empty_control.get_name()) div_container = DivWdg(css='container') ie_rect = HtmlElement('v:roundrect') ie_rect.set_attr("arcsize", "1966f") ie_rect.set_attr("fillcolor", "white") ie_rect.set_attr("strokecolor", "#555") ie_rect.set_attr("strokeweight", "2pt") div_body = DivWdg(css='content') div_body.set_id("%s_cont" % self.shad_name) div_body.center() div_body.add(div_head) div_body.add(div_control) self.content = div_main self.head = div_head self.control = div_control self.body = div_body div_container.add(ie_rect) ie_rect.add(div_body) #div_main.add(div_head) div_main.add(div_container)
def init(my): assert my.task super(TaskExtraInfoWdg, my).init() # create the visible element icon = IconWdg('Time Card', icon=IconWdg.TIME) my.add(icon) my.add(HtmlElement.b(my.task.get_process())) my.time_card = TimecardWdg() my.time_card.set_task(my.task) from pyasm.security import Login # create the content content = DivWdg() content.add_style('width', '46em') # customize the extra info widget my.set_class('timecard_main') my.set_content(content) my.set_mouseout_flag(False) my.login = Login.get_by_login(my.task.get_assigned()) title = FloatDivWdg() login_name = 'unassigned' my.is_other = False if my.login: login_name = my.login.get_full_name() if my.login.get_login() == Environment.get_login().get_login(): icon = IconWdg(icon=IconWdg.REFRESH) icon.add_class('hand') icon.add_event('onclick', my.time_card.get_refresh_script()) title.add(icon) else: my.is_other = True title.add("Time card - %s" % login_name) content.add(title) content.add(CloseWdg(my.get_off_script())) content.add(HtmlElement.br(2)) content.add(my.time_card, 'time') if not my.login: div = DivWdg( HtmlElement.b( 'Time card cannot be entered for unassigned task.')) content.set_widget(div, 'time') my.height = 60 elif my.is_other: div = DivWdg(HtmlElement.b('Time card cannot be entered for other users [%s].'\ %login_name)) content.set_widget(div, 'time') my.height = 60
def get_no_icon_wdg(my, missing=False): sobject = my.get_current_sobject() if not sobject: return '' div = my.top div.add_style("position: relative") div.add_style("margin: 3px") div.add_class("spt_thumb_top") div.set_id( "thumb_%s" % sobject.get_search_key() ) icon_size = my.get_icon_size() if icon_size: div.add_style("%s: %s" % (my.aspect, icon_size) ) if missing: img = HtmlElement.img(ThumbWdg.get_missing_image()) else: img = HtmlElement.img(ThumbWdg.get_no_image()) img.add_class("spt_image") #from tactic.ui.table import SObjectDetailElementWdg #detail = SObjectDetailElementWdg() #detail.set_widget(img) #detail.set_sobject(sobject) #div.add(detail) div.add(img) div.add_class("hand") if my.SQL_ERROR: warning_div = DivWdg('<i>-- preprocess error --</i>') warning_div.add_styles('position: absolute; z-index: 100; float: left; top: 0; left: 0; font-size: smaller;') div.add_style('position: relative') div.add(warning_div) search_key = SearchKey.get_by_sobject(sobject) code = sobject.get_code() detail = my.get_option("detail") if detail != 'false': my.add_icon_behavior(div, sobject) if type(icon_size) == types.StringType and icon_size.endswith("%"): img.add_style("%s: 100%%" % my.aspect ) else: img.add_style("%s: %spx" % (my.aspect, my.get_icon_size()) ) img.add_style("min-%s: 15px" % my.aspect) return div
def init(my): assert my.task super(TaskExtraInfoWdg, my).init() # create the visible element icon = IconWdg('Time Card', icon=IconWdg.TIME) my.add(icon) my.add(HtmlElement.b(my.task.get_process())) my.time_card = TimecardWdg() my.time_card.set_task(my.task) from pyasm.security import Login # create the content content = DivWdg() content.add_style('width','46em') # customize the extra info widget my.set_class('timecard_main') my.set_content(content) my.set_mouseout_flag(False) my.login = Login.get_by_login(my.task.get_assigned()) title = FloatDivWdg() login_name = 'unassigned' my.is_other = False if my.login: login_name = my.login.get_full_name() if my.login.get_login() == Environment.get_login().get_login(): icon = IconWdg(icon=IconWdg.REFRESH) icon.add_class('hand') icon.add_event('onclick', my.time_card.get_refresh_script()) title.add(icon) else: my.is_other = True title.add("Time card - %s" % login_name) content.add(title) content.add(CloseWdg(my.get_off_script())) content.add(HtmlElement.br(2)) content.add(my.time_card, 'time') if not my.login: div = DivWdg(HtmlElement.b('Time card cannot be entered for unassigned task.')) content.set_widget(div, 'time') my.height = 60 elif my.is_other: div = DivWdg(HtmlElement.b('Time card cannot be entered for other users [%s].'\ %login_name)) content.set_widget(div, 'time') my.height = 60
def get_no_icon_wdg(my, missing=False): sobject = my.get_current_sobject() if not sobject: return '' div = my.top div.add_style("position: relative") div.add_style("margin: 3px") div.set_id( "thumb_%s" % sobject.get_search_key() ) icon_size = my.get_icon_size() if icon_size: div.add_style("%s: %s" % (my.aspect, icon_size) ) if missing: img = HtmlElement.img(ThumbWdg.get_missing_image()) else: img = HtmlElement.img(ThumbWdg.get_no_image()) img.add_class("spt_image") #from tactic.ui.table import SObjectDetailElementWdg #detail = SObjectDetailElementWdg() #detail.set_widget(img) #detail.set_sobject(sobject) #div.add(detail) div.add(img) div.add_class("hand") if my.SQL_ERROR: warning_div = DivWdg('<i>-- preprocess error --</i>') warning_div.add_styles('position: absolute; z-index: 100; float: left; top: 0; left: 0; font-size: smaller;') div.add_style('position: relative') div.add(warning_div) search_key = SearchKey.get_by_sobject(sobject) code = sobject.get_code() detail = my.get_option("detail") if detail != 'false': my.add_icon_behavior(div, sobject) if type(icon_size) == types.StringType and icon_size.endswith("%"): img.add_style("%s: 100%%" % my.aspect ) else: img.add_style("%s: %spx" % (my.aspect, my.get_icon_size()) ) img.add_style("min-%s: 15px" % my.aspect) return div
def get_create_view_wdg(my, search_type): # create popup create_popup = PopupWdg("create_action") create_popup.set_auto_hide(False) create_popup.add("Enter name of view: ") create_popup.add(TextWdg("create_view_name")) #create_popup.add( HtmlElement.br(2) ) #create_popup.add( "Copy from template: " ) #template_select = SelectWdg("copy_from_template") #template_select.add_empty_option("-- None --") #template_select.set_option("values", "list|summary|task") #create_popup.add( template_select ) create_popup.add(HtmlElement.br(2)) create_popup.add( CheckboxWdg('auto_create_edit', label='Auto Create Edit View')) create_popup.add(HtmlElement.br(2, clear="all")) from pyasm.prod.web import ProdIconButtonWdg, ProdIconSubmitWdg create_icon = ProdIconButtonWdg('Create') ajax = AjaxCmd() ajax.register_cmd("pyasm.widget.CustomCreateViewCbk") ajax.add_element_name("create_view_name") ajax.add_element_name("auto_create_edit") ajax.set_option("search_type", search_type) ajax.set_option("project", Project.get_project_code()) div = ajax.generate_div() div.set_post_ajax_script('document.form.submit()') create_icon.add_event( "onclick", "%s;%s" % (ajax.get_on_script(), "toggle_display('create_action')")) cancel_icon = ProdIconButtonWdg('Cancel') cancel_icon.add_event("onclick", "toggle_display('create_action')") span = SpanWdg() span.add(create_icon) span.add(cancel_icon) create_popup.add(span) create_popup.add(HtmlElement.br()) # add the create button create = IconButtonWdg("Create View", IconWdg.SAVE, True) create.add_event("onclick", "%s" % create_popup.get_on_script()) # lay it all out widget = Widget() widget.add(create_popup) widget.add(create) widget.add(div) return widget
def get_selected_department_instructions_section(self): department_instructions_list = HtmlElement.ul() department_instructions_list.add_style('list-style-type', 'none') department_instructions_sobjects = get_department_instructions_sobjects_for_instructions_template_code( self.instructions_template_sobject.get_code()) for department_instructions_sobject in department_instructions_sobjects: li = HtmlElement.li() li.add(self.get_div_for_department_instructions(department_instructions_sobject)) department_instructions_list.add(li) return department_instructions_list
def add_no_option(my, sel_el): option = HtmlElement('option') option.set_attr( "value", "" ) option.add( "-- No Options Found --" ) sel_el.add( option ) option = HtmlElement('option') option.set_attr( "value", "" ) no_value_label = "-- No Filter Value Found --" if my.kwargs.get('no_value_found_label'): no_value_label = my.kwargs.get('no_value_found_label') option.add( no_value_label ) sel_el.add( option )
def get_example_display(self): div = DivWdg() int_edit_div = DivWdg() int_edit_div.add_styles( "width: auto; height: auto;" ) int_edit_div.add_class( "SPT_INPUT_WRAPPER" ) int_edit = HtmlElement.input() int_edit.set_attr("type", "text") int_edit.set_attr("value", "856") int_edit.set_attr("name", "int_edit") int_edit.add_behavior( { 'type': 'keyboard', 'kbd_handler_name': 'IntegerTextEdit', 'validation_warning': 'You must enter a number greater than 50', 'cbjs_validation': ''' log.debug( "Check the value: " + value ); if( parseInt( value ) <= 50 ) { return false; } return true; ''' } ) int_edit_div.add( int_edit ) int_edit_div.add( "<img class='SPT_INPUT_VALIDATION_WARNING' src='/context/icons/silk/exclamation.png' " \ "title='' style='display: none;' />" ) int_edit_div.add( " Enter a value of 50 or less to fail validation, anything over 50 to succeed" \ " -- Integer edit example (uses 'kbd_handler_name' of 'IntegerTextEdit')" ) div.add( int_edit_div ) div.add( "<br/><br/>" ) float_edit = HtmlElement.input() float_edit.set_attr("type", "text") float_edit.set_attr("value", "12.45") float_edit.set_attr("name", "int_edit") float_edit.add_behavior( { 'type': 'keyboard', 'kbd_handler_name': 'FloatTextEdit' } ) div.add( float_edit ) div.add( " Float edit example (uses 'kbd_handler_name' of 'FloatTextEdit')" ) div.add( "<br/><br/>" ) textarea = HtmlElement.textarea( 10, 40, "This is a multi-line example." ) textarea.add_behavior( { 'type': 'keyboard', 'kbd_handler_name': 'MultiLineTextEdit' } ) div.add( textarea ) div.add( " Multi-line edit example (uses 'kbd_handler_name' of 'MultiLineTextEdit')" ) div.add( "<br/><br/>" ) return div
def get_example_display(my): div = DivWdg() int_edit_div = DivWdg() int_edit_div.add_styles( "width: auto; height: auto;" ) int_edit_div.add_class( "SPT_INPUT_WRAPPER" ) int_edit = HtmlElement.input() int_edit.set_attr("type", "text") int_edit.set_attr("value", "856") int_edit.set_attr("name", "int_edit") int_edit.add_behavior( { 'type': 'keyboard', 'kbd_handler_name': 'IntegerTextEdit', 'validation_warning': 'You must enter a number greater than 50', 'cbjs_validation': ''' log.debug( "Check the value: " + value ); if( parseInt( value ) <= 50 ) { return false; } return true; ''' } ) int_edit_div.add( int_edit ) int_edit_div.add( "<img class='SPT_INPUT_VALIDATION_WARNING' src='/context/icons/silk/exclamation.png' " \ "title='' style='display: none;' />" ) int_edit_div.add( " Enter a value of 50 or less to fail validation, anything over 50 to succeed" \ " -- Integer edit example (uses 'kbd_handler_name' of 'IntegerTextEdit')" ) div.add( int_edit_div ) div.add( "<br/><br/>" ) float_edit = HtmlElement.input() float_edit.set_attr("type", "text") float_edit.set_attr("value", "12.45") float_edit.set_attr("name", "int_edit") float_edit.add_behavior( { 'type': 'keyboard', 'kbd_handler_name': 'FloatTextEdit' } ) div.add( float_edit ) div.add( " Float edit example (uses 'kbd_handler_name' of 'FloatTextEdit')" ) div.add( "<br/><br/>" ) textarea = HtmlElement.textarea( 10, 40, "This is a multi-line example." ) textarea.add_behavior( { 'type': 'keyboard', 'kbd_handler_name': 'MultiLineTextEdit' } ) div.add( textarea ) div.add( " Multi-line edit example (uses 'kbd_handler_name' of 'MultiLineTextEdit')" ) div.add( "<br/><br/>" ) return div
def init(my): div_main = DivWdg(css='module') if my.width != None: widthstr="width: %sem" % (my.width) div_main.add_style(widthstr) # reset my.name, create the content widget if not my.shad_name: my.shad_name = "ShadowBox%s" % (my.generate_unique_id()) div_main.set_id(my.shad_name) div_main.center() div_head = DivWdg(css='boxhead') # HACK to compensate for IE weird handling of CSS if WebContainer.get_web().is_IE() and 'password' in my.shad_name: div_head.add_style('left','-242px') div_head.add_style('padding-bottom: 2px') empty_header = Widget(name=my.HEADER) div_head.add(empty_header, empty_header.get_name()) div_head.add(my.title_wdg, my.title_wdg.get_name()) div_control = DivWdg(css='control') empty_control = Widget(name=my.CONTROL) div_control.add(empty_header, empty_control.get_name()) div_container = DivWdg(css='container') ie_rect = HtmlElement('v:roundrect') ie_rect.set_attr("arcsize", "1966f") ie_rect.set_attr("fillcolor", "white") ie_rect.set_attr("strokecolor", "#555") ie_rect.set_attr("strokeweight", "2pt") div_body = DivWdg(css='content') div_body.set_id("%s_cont" % my.shad_name) div_body.center() div_body.add(div_head) div_body.add(div_control) my.content = div_main my.head = div_head my.control = div_control my.body = div_body div_container.add(ie_rect) ie_rect.add(div_body) #div_main.add(div_head) div_main.add(div_container)
def get_create_view_wdg(my, search_type): # create popup create_popup = PopupWdg("create_action") create_popup.set_auto_hide(False) create_popup.add("Enter name of view: ") create_popup.add(TextWdg("create_view_name")) # create_popup.add( HtmlElement.br(2) ) # create_popup.add( "Copy from template: " ) # template_select = SelectWdg("copy_from_template") # template_select.add_empty_option("-- None --") # template_select.set_option("values", "list|summary|task") # create_popup.add( template_select ) create_popup.add(HtmlElement.br(2)) create_popup.add(CheckboxWdg("auto_create_edit", label="Auto Create Edit View")) create_popup.add(HtmlElement.br(2, clear="all")) from pyasm.prod.web import ProdIconButtonWdg, ProdIconSubmitWdg create_icon = ProdIconButtonWdg("Create") ajax = AjaxCmd() ajax.register_cmd("pyasm.widget.CustomCreateViewCbk") ajax.add_element_name("create_view_name") ajax.add_element_name("auto_create_edit") ajax.set_option("search_type", search_type) ajax.set_option("project", Project.get_project_code()) div = ajax.generate_div() div.set_post_ajax_script("document.form.submit()") create_icon.add_event("onclick", "%s;%s" % (ajax.get_on_script(), "toggle_display('create_action')")) cancel_icon = ProdIconButtonWdg("Cancel") cancel_icon.add_event("onclick", "toggle_display('create_action')") span = SpanWdg() span.add(create_icon) span.add(cancel_icon) create_popup.add(span) create_popup.add(HtmlElement.br()) # add the create button create = IconButtonWdg("Create View", IconWdg.SAVE, True) create.add_event("onclick", "%s" % create_popup.get_on_script()) # lay it all out widget = Widget() widget.add(create_popup) widget.add(create) widget.add(div) return widget
def setup_html_list_for_file_flows_in_order(self, width=600): file_flows_list = HtmlElement.ul() file_flows_list.add_style('list-style-type', 'none') file_flows_list.add_style('margin-left', '10px') file_flows_list.add_style('padding-left', '0px') component_sobjects = get_component_sobjects_from_order_code(self.order_sobject.get_code())\ # Only do the searching and rendering if components exist for the Order if component_sobjects: component_sobjects_string = ','.join([ "'{0}'".format(component.get_code()) for component in component_sobjects ]) file_flow_search = Search('twog/file_flow') file_flow_search.add_where('\"component_code\" in ({0})'.format( component_sobjects_string)) file_flows = file_flow_search.get_sobjects() for file_flow in file_flows: file_flow_div = DivWdg() file_flow_div.add_style('background-color', '#d9edf7') file_flow_div.add_style('padding', '10px') file_flow_div.add_style('border-radius', '10px') file_flow_div.add(file_flow.get('name')) file_flow_div.add_style('display', 'block') change_component_button = ButtonNewWdg( title='Change Component', icon='PIPELINE') change_component_button.add_behavior( obu.get_load_popup_widget_with_reload_behavior( 'Change Component', 'widgets.ChangeComponentForFileFlowWdg', file_flow.get_search_key(), 'Order Builder', 'order_builder.OrderBuilderWdg', self.order_sobject.get_search_key())) change_component_button.add_style('display', 'inline-block') file_flow_div.add(change_component_button) li = HtmlElement.li() li.add(file_flow_div) file_flows_list.add(li) return file_flows_list
def get_display(self): top = self.top height = self.kwargs.get("height") if not height: height = "100%" width = self.kwargs.get("width") if not width: width = "100%" border = self.kwargs.get("border") src = self.kwargs.get("src") img = HtmlElement.img(src) img.add_style("width: %s" % width) img.add_style("height: %s" % height) top.add(img) top.add_style("width: %s" % width) top.add_style("height: %s" % height) top.add_style("min-width: 20px") top.add_style("min-height: 20px") top.add_border() return top
def _add_icon(my): # icon is optional if not my.icon_path: return if not my.icon_path.startswith("/"): # icon_path = "/context/icons/oo/%s" % my.icon_path icon_path = "/context/icons/silk/%s" % my.icon_path else: icon_path = my.icon_path icon = HtmlElement.img(icon_path) icon.set_attr("title", my.name) icon.add_styles(my.icon_styles) if my.long: img_id = my.generate_unique_id(my.name) icon.add_class("icon_out") my.add_event("onmouseover","wdg_opacity('%s','over');" % (img_id)) my.add_event("onmouseout","wdg_opacity('%s','out');" % (img_id)) icon.set_id(img_id) else: icon.add_class("simple_button") if WebContainer.get_web().is_IE(): icon.add_style("vertical-align: top") else: icon.add_style("vertical-align: middle") my.add(icon)
def get_display(my): search_key = my.kwargs.get('parent_key') div = DivWdg() if not search_key: div.add("Search Key for SObjectHeaderHdg is empty") return div sobject = Search.get_by_search_key( search_key ) if not sobject: div.add("SObject with Search Key [%s] does not exist" % search_key) return div search_type_obj = sobject.get_search_type_obj() title = search_type_obj.get_title() title_wdg = DivWdg() title_wdg.add_style("font-size: 1.8em") name = sobject.get_display_value() title_wdg.add("%s: %s" % (title, name )) div.add(title_wdg) div.add(HtmlElement.hr()) return div
def get_next_tasks_div(task_sobject): div_wdg = DivWdg() div_wdg.add(HtmlElement.h4('Next Tasks')) pipeline_code = task_sobject.get_parent().get('pipeline_code') pipeline_xml = get_pipeline_xml(pipeline_code) next_task_processes = get_next_tasks_processes_from_xml( pipeline_xml, task_sobject.get('process')) if next_task_processes: for process in next_task_processes: div_wdg.add(process) next_task_sobject = get_task_sobject_from_xml_and_process( pipeline_xml, process, task_sobject.get('search_code')) if next_task_sobject: task_load_button = ButtonNewWdg(title='Load Order', icon='WORK') task_load_button.add_behavior( obu.get_load_new_tab_behavior( 'task_{0}'.format(next_task_sobject.get_code()), process, 'widgets.TaskInspectWdg', next_task_sobject.get_search_key())) task_load_button.add_style('display', 'inline-block') div_wdg.add(task_load_button) else: div_wdg.add('None') return div_wdg
def get_menu_item(my, element_name, display_handler): content = DivWdg() content.add_attr("spt_element_name", element_name) content.add_class("hand") # add the drag/drop behavior behavior = { "type": "drag", "mouse_btn": "LMB", "modkeys": "", "src_el": "@", "cbfn_setup": "spt.side_bar.pp_setup", "cbfn_motion": "spt.side_bar.pp_motion", "cbfn_action": "spt.side_bar.pp_action", } content.add_behavior(behavior) content.set_id("manage_%s" % element_name) content.add_style("position: relative") content.add_style("margin: 3px") content.add_style("left: 0") content.add_style("top: 0") content.add_style("z-index: 100") if display_handler == "SeparatorWdg": content.add(HtmlElement.hr()) else: content.add(element_name) return content
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_menu_item(my, element_name, display_handler): content = DivWdg() content.add_attr("spt_element_name", element_name) content.add_class("hand") # add the drag/drop behavior behavior = { "type": 'drag', "mouse_btn": 'LMB', "modkeys": '', "src_el": '@', "cbfn_setup": 'spt.side_bar.pp_setup', "cbfn_motion": 'spt.side_bar.pp_motion', "cbfn_action": 'spt.side_bar.pp_action', } content.add_behavior(behavior) content.set_id("manage_%s" % element_name) content.add_style("position: relative") content.add_style("margin: 3px") content.add_style("left: 0") content.add_style("top: 0") content.add_style("z-index: 100") if display_handler == "SeparatorWdg": content.add(HtmlElement.hr()) else: content.add(element_name) return content
def get_display(self): search_type = self.search_type related_search_type = self.related_search_type_wdg.get_value() if related_search_type: search_type = related_search_type hier_sel = self.get_hier_sel(search_type) selected_related_search_type = hier_sel.get_value() process_wdg = self.get_process_wdg(search_type) context_wdg = self.get_context_wdg(search_type) widget = self.main_div if self.is_from_ajax(True): widget = Widget() else: self.set_ajax_top(widget) hidden = HiddenWdg("search_type" ,search_type) widget.add(hidden) hier_sel.add_event('onchange', self.get_refresh_script(show_progress=False)) widget.add(hier_sel) #Tooltip doesn't work too well #hint = HintWdg('Related search type you can optionally select to drive the process') widget.add(HtmlElement.br(2)) widget.add(process_wdg) widget.add(context_wdg) return widget
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_display(my): top = my.top content_div = top top.add_class("web_menu_wdg") ul = HtmlElement.ul() top.add(ul) ul.add_class("main_ul") # add in a context smart menu for all links show_context_menu = my.kwargs.get("show_context_menu") if show_context_menu in ['true', True]: my.add_link_context_menu(content_div) for view_item in my.view: is_personal = False if view_item.startswith('my_view_'): is_personal = True info = { 'counter' : 10, 'view': view_item, 'level': 1 } config = my.get_config(my.config_search_type, view_item, default=my.default, personal=is_personal) if not config: continue ret_val = my.generate_section( config, ul, info, personal=is_personal) if ret_val == 'empty': pass return top
def get_file_type_wdg(my): '''drop down which selects which file type to export to''' # add a filter div = DivWdg() filter_div = FloatDivWdg(HtmlElement.b("File Type:"), width="15em") div.add(filter_div) select = SelectWdg() select.set_name("file_type") select.set_id("file_type") app = WebContainer.get_web().get_selected_app() if app == 'Maya': select.set_option("values", "mayaAscii|mayaBinary|obj|collada") select.set_option("labels", "Maya Ascii (.ma)|Maya Binary (.mb)|Wavefront .obj|Collada (.dae)") elif app == 'Houdini': select.set_option("values", "otl") select.set_option("labels", "Houdini Digital Asset(.otl)") elif app == 'XSI': select.set_option("values", "emdl|dotXSI|obj") select.set_option("labels", "3D Model (.emdl)|SoftImage dotXSI (.xsi)|Wavefront .obj") else: select.set_option("values", "mayaAscii|mayaBinary|obj|collada") select.set_option("labels", "Maya Ascii (.ma)|Maya Binary (.mb)|Wavefront .obj|Collada (.dae)") select.add_style("font-size: 0.8em") select.add_style("margin-top: 5px") select.add_style("margin-right: 10px") select.set_persistence() div.add(select) return div