def get_display(my): widget = DivWdg() table = Table() table.add_attr('class','scraper') table.add_row() tb = TextWdg('title_box') tb.add_attr('id','title_box') multiple_titles = None print "MY.TITLE_OF_SHOW = %s" % my.title_of_show if my.title_of_show not in [None,'']: tb.set_value(my.title_of_show) #poster_url_text = my.get_poster_url(my.title_of_show) #poster_url = poster_url_text.split('=')[1] multiple_titles = my.get_multiple_title_info(my.title_of_show) print "MULTIPLE_TITLES = %s" % multiple_titles tb.add_behavior(my.get_search()) table.add_cell(tb) if multiple_titles not in [None,''] and len(multiple_titles) > 0: for m in multiple_titles: table.add_row() table.add_cell('<img src="%s"/>' % m['TopLevel']['poster']) mkeys = m.keys() for k in mkeys: table.add_row() table.add_cell('<b><u>%s</u></b>' % k) dudes = m[k] dkeys = dudes.keys() for d in dkeys: table.add_row() table.add_cell('%s: %s' % (d, dudes[d])) widget.add(table) return widget
def get_display(my): #--print "IN OBLW" code = '' if 'search_key' in my.kwargs.keys(): search_key = str(my.kwargs.get('search_key')) code = search_key.split('code=')[1] search_type = search_key.split('?')[0] sob_platform = my.server.eval("@GET(%s['code','%s'].platform)" % (search_type, code)) else: sobject = my.get_current_sobject() code = sobject.get_code() sob_platform = sobject.get_value('platform') platform_sk = '' if sob_platform not in [None,'']: platform_sk = my.server.eval("@GET(twog/platform['name','%s'].__search_key__)" % sob_platform) if len(platform_sk) > 0: platform_sk = platform_sk[0] else: platform_sk = '' widget = DivWdg() table = Table() if platform_sk not in [None,'']: table.add_attr('width', '50px') table.add_row() cell1 = table.add_cell('<img border="0" style="vertical-align: middle" title="" src="/context/icons/silk/email.png">') launch_behavior = my.get_launch_behavior(platform_sk) cell1.add_style('cursor: pointer;') cell1.add_behavior(launch_behavior) widget.add(table) return widget
def get_display(my): name = '' if 'code' in my.kwargs.keys(): code = my.kwargs.get('code') else: sobject = my.get_current_sobject() code = sobject.get_code() name = sobject.get_value('name') if 'name' in my.kwargs.keys(): name = my.kwargs.get('name') search_on_load = 'false' if 'search_on_load' in my.kwargs.keys(): search_on_load = my.kwargs.get('search_on_load') widget = DivWdg() table = Table() table.add_attr('width', '50px') table.add_row() cell1 = table.add_cell('<img border="0" style="vertical-align: middle" title="" src="/context/icons/custom/imdb.png">') cell1.add_attr('code', code) cell1.add_attr('name', name) cell1.add_attr('search_on_load', search_on_load) launch_behavior = my.get_launch_behavior() cell1.add_style('cursor: pointer;') cell1.add_behavior(launch_behavior) widget.add(table) return widget
def get_display(my): sobject = None if 'order_code' in my.kwargs.keys(): my.order_code = my.kwargs.get('order_code') else: sobject = my.get_current_sobject() my.order_code = sobject.get_code() sobject = my.server.eval("@SOBJECT(twog/order['code','%s'])" % my.order_code)[0] my.order_name = sobject.get('name') widget = DivWdg() table = Table() table.add_attr('width', '50px') login = Environment.get_login() user_name = login.get_login() table.add_row() cell1 = table.add_cell('<b><u>Calculate Costs</u></b>') cell1.add_attr('order_code', my.order_code) cell1.add_attr('user', user_name) cell1.add_attr('order_name', my.order_name) cell1.add_attr('nowrap','nowrap') launch_behavior = my.get_launch_behavior() cell1.add_style('cursor: pointer;') cell1.add_behavior(launch_behavior) widget.add(table) return widget
def get_display(my): widget = DivWdg() table = Table() table.add_attr('class','my_preferences_wdg') prefs = my.login_obj.get('twog_preferences').split(',') for pref in prefs: if pref not in [None,'']: kv = pref.split('=') key = kv[0] val = kv[1] table.add_row() desc = table.add_cell(my.key_dict[key]) desc.add_attr('nowrap','nowrap') this_sel = SelectWdg(key) this_sel.add_attr('id',key) this_sel.add_style('width: 100px;') this_sel.append_option('True','true') this_sel.append_option('False','false') this_sel.set_value(val) table.add_cell(this_sel) table.add_row() t2 = Table() t2.add_row() t2.add_cell() tc = t2.add_cell('<input type="button" name="Save My Preferences" value="Save My Preferences"/>') tc.add_attr('width', '50px') tc.add_behavior(my.get_save_preferences()) t2.add_cell() table.add_cell(t2) widget.add(table) return widget
def get_display(my): from tactic.ui.widget import SObjectCheckinHistoryWdg my.sob_code = str(my.kwargs.get('sob_code')) my.st = str(my.kwargs.get('st')) my.open_type = str(my.kwargs.get('open_type')) my.name = str(my.kwargs.get('name')) sk = my.server.build_search_key(my.st, my.sob_code) obs = InspectScripts() edit_wdg = EditWdg(element_name='general', mode=my.open_type, search_type=my.st, code=my.sob_code, title=my.name, view='edit', widget_key='edit_layout') table = Table() table.add_attr('class','sob_edit_top') table.add_row() edit_sob_cell = table.add_cell(edit_wdg) edit_sob_cell.add_attr('valign','top') table.add_row() history = SObjectCheckinHistoryWdg(search_key=sk) history_cell = table.add_cell(history) history_cell.add_attr('class','history_sob_cell') table.add_row() checkin = TwogEasyCheckinWdg2(sk=sk,code=my.sob_code) checkin_cell = table.add_cell(checkin) checkin_cell.add_attr('class','checkin_sob_cell') checkin_cell.add_attr('width','100%s' % '%') checkin_cell.add_attr('align','center') return table
def get_display(my): from tactic_client_lib import TacticServerStub sobject = None code = "" if "source_code" in my.kwargs.keys(): code = str(my.kwargs.get("source_code")) else: sobject = my.get_current_sobject() code = sobject.get_code() widget = DivWdg() table = Table() table.add_attr("width", "50px") login = Environment.get_login() user_name = login.get_login() table.add_row() cell1 = table.add_cell( '<img border="0" style="vertical-align: middle" title="Clone Source" name="Clone Source" src="/context/icons/silk/star.png">' ) cell1.add_attr("user", user_name) launch_behavior = my.get_launch_behavior(code, user_name) cell1.add_style("cursor: pointer;") cell1.add_behavior(launch_behavior) widget.add(table) return widget
def get_display(my): sob_sk = '' name = '' height = 20 if 'sk' in my.kwargs.keys(): sob_sk = str(my.kwargs.get('sk')) else: sobject = my.get_current_sobject() sob_sk = sobject.get_search_key() if 'name' in my.kwargs.keys(): name = my.kwargs.get('name') if 'height' in my.kwargs.keys(): height = my.kwargs.get('height') processes = '' if 'processes' in my.kwargs.keys(): processes = my.kwargs.get('processes') widget = DivWdg() table = Table() table.add_attr('width', '50px') table.add_row() cell1 = None if name == '': cell1 = table.add_cell('<img border="0" style="vertical-align: middle" title="" src="/context/icons/silk/_spt_upload.png">') else: cell1 = table.add_cell('<input type="button" value="%s" style="height: %spx"/>' % (name, height)) cell1.add_attr('sk', sob_sk) cell1.add_attr('processes', processes) launch_behavior = my.get_launch_behavior() cell1.add_style('cursor: pointer;') cell1.add_behavior(launch_behavior) widget.add(table) return widget
def get_display(my): sobject = my.get_current_sobject() code = sobject.get_code() sk = my.server.build_search_key("twog/movement", code) shipping_class = sobject.get_value("shipping_class") title = sobject.get_value("name") waybill = sobject.get_value("waybill") sending_company_code = sobject.get_value("sending_company_code") receiving_company_code = sobject.get_value("receiving_company_code") shipper_code = sobject.get_value("shipper_code") description = sobject.get_value("description") timestamp = sobject.get_value("timestamp") widget = DivWdg() table = Table() table.add_attr("width", "50px") table.add_row() cell1 = table.add_cell( '<img border="0" style="vertical-align: middle" title="" src="/context/icons/silk/printer.png">' ) launch_behavior = my.get_launch_behavior() cell1.add_attr("sk", sk) cell1.add_attr("shipping_class", shipping_class) cell1.add_attr("to_comp", receiving_company_code) cell1.add_attr("from_comp", sending_company_code) cell1.add_attr("waybill", waybill) cell1.add_attr("title", title) cell1.add_attr("shipper", shipper_code) cell1.add_attr("description", description) cell1.add_attr("timestamp", timestamp) cell1.add_style("cursor: pointer;") cell1.add_behavior(launch_behavior) widget.add(table) return widget
def get_display(my): import re from client.tactic_client_lib import TacticServerStub from tactic.ui.panel import FastTableLayoutWdg server = TacticServerStub.get() sk = str(my.kwargs.get('sk')) splits = sk.split('code=') search_type = splits[0].split('?')[0]; code = splits[1]; search_id = re.findall(r'\d+', code) search_id = int(search_id[0]) widget = DivWdg() table = Table() table.add_attr('class','snapshot_viewer_wdg') table.add_attr('sk',sk) #ftl = FastTableLayoutWdg(search_type='sthpw/snapshot', view='table', element_names='preview,process,description,web_path,timestamp,login', show_row_select=True, search_key=sk, show_gear=False, show_shelf=False, show_select=True, width='100%s' % '%', show_column_manager=False, expression="@UNION(@SOBJECT(sthpw/snapshot),@SOBJECT(sthpw/note.sthpw/snapshot))", temp=True) if search_type == 'sthpw/note': expression = "@SOBJECT(sthpw/snapshot)" else: expression="@UNION(@SOBJECT(sthpw/snapshot),@SOBJECT(sthpw/note.sthpw/snapshot))" ftl = FastTableLayoutWdg(search_type='sthpw/snapshot', view='snapshot_by_process', show_row_select=True, search_key=sk, show_gear=False, show_shelf=False, show_select=True, height='300px', width='100%s' % '%', show_column_manager=False, expression=expression, temp=True) table.add_row() table.add_cell(ftl) widget.add(table) return widget
def get_display(my): do_button = False if 'work_order_code' not in my.kwargs.keys(): sobject = my.get_current_sobject() code = sobject.get_code() else: code = my.kwargs.get('work_order_code') do_button = True widget = DivWdg() table = Table() table.add_attr('width', '50px') table.add_row() launch_behavior = my.get_launch_behavior(code) what_goes_in = '<img border="0" style="vertical-align: middle" title="" src="/context/icons/silk/printer.png">' if do_button: what_goes_in = ButtonSmallNewWdg(title="Print Work Order", icon=IconWdg.PRINTER) what_goes_in.add_behavior(launch_behavior) cell1 = table.add_cell(what_goes_in) cell1.add_attr('code',code) cell1.add_style('cursor: pointer;') if not do_button: cell1.add_behavior(launch_behavior) widget.add(table) if do_button: return what_goes_in else: return widget
def get_display(my): sobject = my.get_current_sobject() sk = sobject.get_search_key() widget = DivWdg() sts_to_perm = {'twog/qc_report_vars': 'compression|qc supervisor|edeliveries'} if '-1' not in sk: table = Table() table.add_attr('width', '50px') login = Environment.get_login() user_name = login.get_login() groups = Environment.get_group_names() st = sk.split('?')[0]; perms = sts_to_perm[st] allow = False for g in groups: if g in perms: allow = True if user_name == 'admin': allow = True if allow: table.add_row() cell1 = table.add_cell(my.x_butt) cell1.add_attr('id','sp_del_%s' % sk) launch_behavior = my.get_delete_behavior(sk) cell1.add_style('cursor: pointer;') cell1.add_behavior(launch_behavior) widget.add(table) return widget
def get_display(my): sobject = my.get_current_sobject() code = sobject.get_code() sk = my.server.build_search_key('twog/movement', code) shipping_class = sobject.get_value('shipping_class') title = sobject.get_value('name') waybill = sobject.get_value('waybill') sending_company_code = sobject.get_value('sending_company_code') receiving_company_code = sobject.get_value('receiving_company_code') shipper_code = sobject.get_value('shipper_code') description = sobject.get_value('description') timestamp = sobject.get_value('timestamp') widget = DivWdg() table = Table() table.add_attr('width', '50px') table.add_row() cell1 = table.add_cell('<img border="0" style="vertical-align: middle" title="" src="/context/icons/silk/printer.png">') launch_behavior = my.get_launch_behavior() cell1.add_attr('sk',sk) cell1.add_attr('shipping_class',shipping_class) cell1.add_attr('to_comp',receiving_company_code) cell1.add_attr('from_comp',sending_company_code) cell1.add_attr('waybill',waybill) cell1.add_attr('title',title) cell1.add_attr('shipper',shipper_code) cell1.add_attr('description',description) cell1.add_attr('timestamp',timestamp) cell1.add_style('cursor: pointer;') cell1.add_behavior(launch_behavior) widget.add(table) return widget
def get_display(my): sobject = None code = '' show_checks = False if 'source_code' in my.kwargs.keys(): code = str(my.kwargs.get('source_code')) else: sobject = my.get_current_sobject() code = sobject.get_code() if sobject.get_value('high_security') in [True,'T','t','1']: show_checks = True widget = DivWdg() table = Table() table.add_attr('width', '50px') if show_checks: table.add_style('background-color: #ff0000;') login = Environment.get_login() user_name = login.get_login() table.add_row() cell1 = table.add_cell('<img border="0" style="vertical-align: middle" title="Security Checklist" name="Security Checklist" src="/context/icons/32x32/lock_32_01.png">') cell1.add_attr('user', user_name) launch_behavior = my.get_launch_behavior(code,user_name) cell1.add_style('cursor: pointer;') cell1.add_behavior(launch_behavior) widget.add(table) return widget
def get_display(my): from tactic.ui.widget import SObjectCheckinHistoryWdg my.code = str(my.kwargs.get('source_code')) my.sk = my.server.build_search_key('twog/source',my.code) my.movement_code = str(my.kwargs.get('movement_code')) ms = MovementScripts(movement_code=my.movement_code) clients_expr = "@SOBJECT(twog/client['@ORDER_BY','name desc'])" clients = my.server.eval(clients_expr) client_sel = '<select class="REPLACE_ME"><option value="">--Select--</option>' for client in clients: client_sel = '%s<option value="%s">%s</option>' % (client_sel, client.get('code'), client.get('name')) client_sel = '%s</select>' % client_sel existing_expr = "@SOBJECT(twog/outside_barcode['source_code','%s'])" % my.code existing = my.server.eval(existing_expr) count = 0 table = Table() table.add_attr('class','movement_outside_barcodes') for obc in existing: table.add_row() barcode_text_wdg = TextWdg('outside_barcode_insert_%s' % count) barcode_text_wdg.set_value(obc.get('barcode')) barcode_text_wdg.add_attr('curr_code',obc.get('code')) table.add_cell(barcode_text_wdg) new_sel = client_sel new_sel2 = new_sel.replace('REPLACE_ME','outside_client_%s' % count) found = new_sel2.find('"%s"' % obc.get('client_code')) if found > 0: part1 = new_sel2[:found] part2 = new_sel2[found:] found2 = part2.find('>') if found2 > 0: good2 = part2[found2:] new_sel2 = '%s"%s" selected="selected"%s' % (part1, obc.get('client_code'),good2) table.add_cell(new_sel2) count = count + 1 additional_count = [1, 2, 3, 4, 5] for n in additional_count: table.add_row() barcode_text_wdg = TextWdg('outside_barcode_insert_%s' % count) barcode_text_wdg.add_attr('curr_code','') table.add_cell(barcode_text_wdg) new_sel = client_sel new_sel = new_sel.replace('REPLACE_ME','outside_client_%s' % count) table.add_cell(new_sel) count = count + 1 table.add_row() save_tbl = Table() save_tbl.add_row() s1 = save_tbl.add_cell(' ') s1.add_attr('width','100%s' % '%') save_cell = table.add_cell('<input type="button" value="Save All"/>') save_cell.add_attr('align','center') save_cell.add_behavior(ms.get_save_outside_barcodes_behavior(my.code)) s2 = save_tbl.add_cell(' ') s2.add_attr('width','100%s' % '%') ss = table.add_cell(save_tbl) ss.add_attr('colspan','2') ss.add_attr('align','center') return table
def get_display(my): widget = DivWdg() contents_div = FileBrowserDirectoryContents(dir=my.start_dir,mode=my.mode,custom_top_name=my.custom_top_name) table = Table() table.add_attr('id','top_of_file_browser_%s' % my.custom_top_name) table.add_row() con_div = table.add_cell(contents_div) con_div.add_attr('id','con_div') widget.add(table) return widget
def get_row_wdg_new(my, buttons, show_title=False): div = DivWdg() """ div.set_round_corners(8) div.add_border() div.add_style("padding-top: 1px") div.add_style("padding-left: 5px") div.add_style("padding-right: 5px") div.add_gradient("background", "background", 5, -30) """ div = DivWdg() div.set_round_corners(3) #div.add_border() div.add_style("padding-top: 1px") div.add_style("padding-left: 5px") div.add_style("padding-right: 5px") #div.add_gradient("background", "background", -5, -10) web = WebContainer.get_web() browser = web.get_browser() table = Table() div.add(table) div.add_style("overflow: hidden") table.add_attr("cellspacing", "0px") table.add_attr("cellpadding", "0px") table.add_row() if browser == "Mozilla": table.add_style("margin-top: -5px") div.add_style("height: 30px") else: table.add_style("margin-top: -5px") base = "%s/%s" % (BASE, my.top.get_theme()) for count, button in enumerate(buttons): td = table.add_cell() td.add(button) if button.get_show_arrow_menu(): spacer = DivWdg() table.add_cell(spacer) spacer.add_style("width: 6px") if count < len(buttons) - 1: spacer = DivWdg() table.add_cell(spacer) spacer.add_style("width: 6px") return div
def get_display(my): from pyasm.search import Search #from tactic_client_lib import TacticServerStub barcode = '' sources = [] bad_sources = [] if 'barcode' in my.kwargs.keys(): barcode = my.kwargs.get('barcode') tracker_s = Search("twog/location_tracker") tracker_s.add_filter('location_barcode',barcode) trackers = tracker_s.get_sobjects() #print "BARCODE = %s" % barcode #print "LEN TRACKERS = %s" % len(trackers) for t in trackers: tdate = t.get('timestamp') source_barcode = t.get('source_barcode') other_tracks = Search("twog/location_tracker") other_tracks.add_filter('source_barcode',source_barcode) other_tracks.add_filter('timestamp',tdate, op=">") others = other_tracks.get_sobjects() if len(others) == 0: source_s = Search("twog/source") source_s.add_filter('barcode',source_barcode) source = source_s.get_sobject() if source: if source.get_value('in_house') in [True,'true','True',1,'1']: sources.append(source) else: bad_sources.append({'barcode': source_barcode, 'title': 'UNKNOWN SOURCE'}) table = Table() table.add_attr('class','location_inventory_wdg') table.add_row() bc = TextWdg('nextbc') bc.add_attr('id', 'location_inventory_txtbox') bc.add_behavior(my.get_entry_bvr()) bc.set_value(barcode) table.add_cell(bc) #print "LEN SOURCES = %s" % len(sources) if len(sources) > 0: table.add_row() table.add_cell("<b>TOTAL: %s (UNKNOWN: %s)</b>" % (len(sources), len(bad_sources))) for source in sources: table.add_row() table.add_cell('Barcode: %s, Code: %s, Name: %s: %s' % (source.get_value('barcode'), source.get_code(), source.get_value('title'), source.get_value('episode'))) if len(bad_sources) > 0: table.add_row() table.add_cell("<b>UNKNOWN SOURCES</b>") for b in bad_sources: table.add_row() table.add_cell('Barcode: %s, Name: %s' % (b.get('barcode'), b.get('title'))) widget = DivWdg() widget.add(table) return widget
def get_buttons(is_admin_user): btns = Table() btns.add_attr('class', 'auto_buttons') btns.add_row() to_top = btns.add_cell('<input type="button" value="Go To Top"/>') to_top.add_behavior(bring_to_top()) if is_admin_user: saveit = btns.add_cell('<input type="button" value="Save Priorities"/>') saveit.add_behavior(save_priorities()) return btns
def get_display(my): import time, datetime from tactic_client_lib import TacticServerStub from pyasm.common import Environment code = '' fault_files = None rowct = 1 server = TacticServerStub.get() if 'external_rejection_code' in my.kwargs.keys(): code = my.kwargs.get('external_rejection_code') fault_files = server.eval("@SOBJECT(twog/external_rej_at_fault_files['external_rejection_code','%s'])" % code) if 'rowct' in my.kwargs.keys(): rowct = int(my.kwargs.get('rowct')) adding = False if 'adding' in my.kwargs.keys(): if my.kwargs.get('adding') == 'true': adding = True table = Table() table.add_attr('class','fftable') table.add_attr('border','1') if rowct == 1 and not adding: table.add_row() table.add_cell("<b>List of At-Fault Files:</b>") if code not in [None,''] and not adding: for ff in fault_files: brow = table.add_row() brow.add_attr('line',rowct) brow.add_attr('code',ff.get('code')) brow.add_attr('prev',ff.get('file_path')) brow.add_attr('sk',ff.get('__search_key__')) brow.add_attr('class','fault_files') table.add_cell(my.txtbox('file_path-%s' % rowct, ff.get('file_path'),width='700px')) killer = table.add_cell('<b>X</b>')#This must delete the entry killer.add_style('cursor: pointer;') killer.add_behavior(my.get_kill_bvr(rowct, code, ff.get('code'))) rowct = rowct + 1 erow = table.add_row() erow.add_attr('line',rowct) erow.add_attr('code','') erow.add_attr('prev','') erow.add_attr('sk','') erow.add_attr('class','fault_files') table.add_cell(my.txtbox('file_path-%s' % rowct, '',width='700px')) addnew = table.add_cell('<b>+</b>')#This must add new entry addnew.add_style('cursor: pointer;') addnew.add_behavior(my.get_add_line(rowct, code, '')) erow2 = table.add_row() erow2.add_attr('class','new_ff_line') return table
def get_display(self): outer_div = DivWdg() outer_div.set_id('link_components_to_packages_div') table = Table() table.add_attr('id', 'link_components_to_packages_table') table.add_style('width', '100%') table.add_border(style='solid', color='#F2F2F2', size='1px') order_code = self.order_sobject.get_code() components = get_component_sobjects_from_order_code(order_code) packages = get_package_sobjects_from_order_code(order_code) existing_component_package_links = self.get_existing_entries( components, packages) package_row = table.add_row() table.add_cell(row=package_row) for package in packages: table.add_cell(package.get('name'), row=package_row) for component in components: component_row = table.add_row() component_row.set_id(component.get_code()) table.add_cell(component.get('name'), row=component_row) for package in packages: checkbox = CheckboxWdg(name='{0}_{1}'.format( component.get_code(), package.get_code())) if self.component_package_link_exists( component, package, existing_component_package_links): checkbox.set_checked() checkbox_cell = table.add_cell(checkbox) checkbox_cell.add_style('text-align', 'center') outer_div.add(table) submit_button = SubmitWdg('Submit') submit_button.add_behavior(self.get_submit_button_behavior()) outer_div.add(submit_button) return outer_div
def get_display(my): sobject = my.get_current_sobject() code = sobject.get_code() widget = DivWdg() table = Table() table.add_attr('width', '50px') table.add_row() #cell1 = table.add_cell('<img border="0" style="vertical-align: middle" title="" src="/context/icons/custom/work.png">') cell1 = table.add_cell('<img border="0" style="vertical-align: middle" title="" src="/context/icons/silk/page_white_edit.png">') cell1.add_attr('code',code) launch_behavior = my.get_launch_behavior() cell1.add_style('cursor: pointer;') cell1.add_behavior(launch_behavior) widget.add(table) return widget
def get_row_wdg(my, buttons, show_title=False): table = Table() table.set_round_corners(20) table.add_style("margin-top: -3px") table.add_attr("cellspacing", "0px") table.add_attr("cellpadding", "0px") table.add_row() base = "%s/%s" % (BASE, my.top.get_theme() ) img = "<img src='%s/MainButtonSlices_left.png'/>" % base left = DivWdg(img) left.add_style("opacity", ALPHA) table.add_cell(left) td = table.add_cell() td.add_style("border-size: 0") for count, button in enumerate(buttons): button.add_style("float: left") td.add(button) if button.get_show_arrow_menu(): spacer = DivWdg() spacer.add_style("float: left") td.add(spacer) img = "<img src='%s/MainButtonSlices_between.png'/>" % base spacer.add(img) spacer.add_style("opacity", ALPHA) if count < len(buttons)-1: spacer = DivWdg() spacer.add_style("float: left") td.add(spacer) img = "<img src='%s/MainButtonSlices_between.png'/>" % base spacer.add(img) spacer.add_style("opacity", ALPHA) img = "<img src='%s/MainButtonSlices_right.png'/>" % base right = DivWdg(img) right.add_style("opacity", ALPHA) table.add_cell(right) return table
def get_display(my): widget = DivWdg() table = Table() if 'code' in my.kwargs.keys(): code = my.kwargs.get('code') else: sobject = my.get_current_sobject() code = sobject.get_code() if code not in [None,'',-1,'-1']: source_type = sobject.get_value('source_type') if source_type not in [None,'']: table.add_attr('width', '36px') table.add_row() cell1 = table.add_cell('<img border="0" style="vertical-align: middle" title="%s" name="%s" alt="%s" src="%s">' % (source_type, source_type, source_type, my.lookups[source_type])) widget.add(table) return widget
def get_display(self): outer_div = DivWdg() outer_div.set_id('link_components_to_packages_div') table = Table() table.add_attr('id', 'link_components_to_packages_table') table.add_style('width', '100%') table.add_border(style='solid', color='#F2F2F2', size='1px') order_code = self.order_sobject.get_code() components = get_component_sobjects_from_order_code(order_code) packages = get_package_sobjects_from_order_code(order_code) existing_component_package_links = self.get_existing_entries(components, packages) package_row = table.add_row() table.add_cell(row=package_row) for package in packages: table.add_cell(package.get('name'), row=package_row) for component in components: component_row = table.add_row() component_row.set_id(component.get_code()) table.add_cell(component.get('name'), row=component_row) for package in packages: checkbox = CheckboxWdg(name='{0}_{1}'.format(component.get_code(), package.get_code())) if self.component_package_link_exists(component, package, existing_component_package_links): checkbox.set_checked() checkbox_cell = table.add_cell(checkbox) checkbox_cell.add_style('text-align', 'center') outer_div.add(table) submit_button = SubmitWdg('Submit') submit_button.add_behavior(self.get_submit_button_behavior()) outer_div.add(submit_button) return outer_div
def get_row_wdg(my, buttons, show_title=False): table = Table() table.set_round_corners(20) table.add_style("margin-top: -3px") table.add_attr("cellspacing", "0px") table.add_attr("cellpadding", "0px") table.add_row() base = "%s/%s" % (BASE, my.top.get_theme()) img = "<img src='%s/MainButtonSlices_left.png'/>" % base left = DivWdg(img) left.add_style("opacity", ALPHA) table.add_cell(left) td = table.add_cell() td.add_style("border-size: 0") for count, button in enumerate(buttons): button.add_style("float: left") td.add(button) if button.get_show_arrow_menu(): spacer = DivWdg() spacer.add_style("float: left") td.add(spacer) img = "<img src='%s/MainButtonSlices_between.png'/>" % base spacer.add(img) spacer.add_style("opacity", ALPHA) if count < len(buttons) - 1: spacer = DivWdg() spacer.add_style("float: left") td.add(spacer) img = "<img src='%s/MainButtonSlices_between.png'/>" % base spacer.add(img) spacer.add_style("opacity", ALPHA) img = "<img src='%s/MainButtonSlices_right.png'/>" % base right = DivWdg(img) right.add_style("opacity", ALPHA) table.add_cell(right) return table
def get_display(my): my.work_order_code = str(my.kwargs.get('work_order_code')) my.order_sk = str(my.kwargs.get('order_sk')) my.client_code = str(my.kwargs.get('client_code')) my.is_master = str(my.kwargs.get('is_master')) table = Table() table.add_attr('class', 'intermediate_file_add_wdg') table.add_attr('work_order_code', my.work_order_code) table.add_attr('order_sk', my.order_sk) table.add_attr('client_code', my.client_code) table.add_attr('is_master', my.is_master) table.add_row() insert_wdg = EditWdg(element_name='general', mode='insert', search_type='twog/intermediate_file', title='Create Intermediate File', view='insert', widget_key='edit_layout', cbjs_insert_path='builder/new_inter_file') table.add_cell(insert_wdg) return table
def get_display(my): my.work_order_code = str(my.kwargs.get('work_order_code')) my.proj_code = str(my.kwargs.get('proj_code')) my.wo_templ_code = str(my.kwargs.get('wo_templ_code')) my.order_sk = str(my.kwargs.get('order_sk')) table = Table() table.add_attr('class', 'intermediate_passin_add_wdg') wos_search = Search("twog/work_order") wos_search.add_filter('proj_code', my.proj_code) wos_search.add_filter('code', my.work_order_code, op="!=") wos_search.add_order_by('order_in_pipe') all_wos = wos_search.get_sobjects() all_wo_is = [] for a in all_wos: wi_search = Search("twog/work_order_intermediate") wi_search.add_filter('work_order_code', a.get_value('code')) wo_inters = wi_search.get_sobjects() for woi in wo_inters: int_search = Search("twog/intermediate_file") int_search.add_filter('code', woi.get_value('intermediate_file_code')) inter = int_search.get_sobject() all_wo_is.append([a.get_value('code'), woi.get_value('code'), woi.get_value('title'), '%s: %s' % (inter.get_value('title'), inter.get_value('episode')), inter.get_value('code')]) for b in all_wo_is: table.add_row() checkbox = CustomCheckboxWdg(name='selecta_perm_%s' % b[1], value_field=b[1], checked='false', dom_class='inter_passin_selector', code=b[1], woi_code=b[1], inter_code=b[4]) ck = table.add_cell(checkbox) ck.add_attr('align', 'center') nw1 = table.add_cell('From Work Order: %s' % b[0]) nw1.add_attr('nowrap', 'nowrap') table.add_cell(' ') nw2 = table.add_cell('Intermediate: %s (%s)' % (b[3], b[2])) nw2.add_attr('nowrap', 'nowrap') table.add_row() passin_butt = table.add_cell('<input type="button" value="Add As Pass-in(s) to Work Order"/>') passin_butt.add_behavior(get_assign_intermediate_passins_behavior(my.work_order_code, my.order_sk)) return table
def get_display(my): my.work_order_code = str(my.kwargs.get('work_order_code')) my.proj_code = str(my.kwargs.get('proj_code')) my.wo_templ_code = str(my.kwargs.get('wo_templ_code')) my.order_sk = str(my.kwargs.get('order_sk')) table = Table() table.add_attr('class', 'deliverable_passin_add_wdg') wo_search = Search("twog/work_order") wo_search.add_filter('proj_code', my.proj_code) wo_search.add_filter('code', my.work_order_code,op="!=") wo_search.add_order_by('order_in_pipe') all_wos = wo_search.get_sobjects() all_wo_ds = [] for a in all_wos: deliv_search = Search("twog/work_order_deliverables") deliv_search.add_filter("work_order_code", a.get_value('code')) wo_delivs = deliv_search.get_sobjects() for wod in wo_delivs: src_search = Search("twog/source") src_search.add_filter('code', wod.get_value('deliverable_source_code')) src = src_search.get_sobject() all_wo_ds.append([a.get_value('code'), wod.get_value('code'), wod.get_value('name'), '%s: %s' % (src.get_value('title'), src.get_value('episode')), src.get_value('code')]) for b in all_wo_ds: table.add_row() checkbox = CustomCheckboxWdg(name='selecta_perm_%s' % b[1], value_field=b[1], checked='false', dom_class='deliverable_passin_selector', code=b[1], wod_code=b[1], src_code=b[4]) ck = table.add_cell(checkbox) ck.add_attr('align', 'center') nw1 = table.add_cell('From Work Order: %s' % b[0]) nw1.add_attr('nowrap', 'nowrap') table.add_cell(' ') nw2 = table.add_cell('Permanent: %s (%s)' % (b[3], b[2])) nw2.add_attr('nowrap', 'nowrap') table.add_row() passin_butt = table.add_cell('<input type="button" value="Add As Pass-in(s) to Work Order"/>') passin_butt.add_behavior(get_assign_deliverable_passins_behavior(my.work_order_code, my.order_sk)) return table
def get_display(my): if 'movement_code' in my.kwargs.keys(): my.movement_code = str(my.kwargs.get('movement_code')) mov_expr = "@SOBJECT(twog/movement['code','%s'])" % my.movement_code mo = my.server.eval(mov_expr) if len(mo) > 0: mo = mo[0] my.movement_sk = mo.get('__search_key__') my.movement_id = mo.get('id') #my.movement_code ='MOVEMENT00021' insert_wdg = None if my.movement_code != '': insert_wdg = EditWdg(element_name='general', mode='edit', search_type='twog/movement', code=my.movement_code, title='Edit Movement',view='edit', widget_key='edit_layout') else: insert_wdg = EditWdg(element_name='general', mode='insert', search_type='twog/movement', title='Create Movement',view='insert', widget_key='edit_layout', cbjs_insert_path='movement/refresh_from_create') table = Table() table.add_attr('class', 'movement_maker_top'); table.add_attr('id', 'movement_maker_top_%s' % my.movement_code); table.add_attr('movement_id',my.movement_id) table.add_attr('movement_sk',my.movement_sk) table.add_attr('movement_code',my.movement_code) table.add_row() ins_cell = table.add_cell(insert_wdg) ins_cell.add_attr('class','movement_edit_top') source_add_wdg = SourceAddWdg(movement_code=my.movement_code) source_add_row = table.add_row() source_add_row.add_attr('class','source_add_row') if my.movement_code in ['',None]: source_add_row.add_style('display: none;') source_add_cell = table.add_cell(source_add_wdg) source_add_cell.add_attr('class','source_add_cell') source_add_cell.add_attr('align','center') sources_list = SourcesListWdg(movement_code=my.movement_code) sources_row = table.add_row() sources_row.add_attr('class','sources_row') if my.movement_code in ['',None]: sources_row.add_style('display: none;') sources_list_cell = table.add_cell(sources_list) sources_list_cell.add_attr('class','sources_list_cell') sources_list_cell.add_attr('align','center') submit_row = table.add_row() sub_tbl = Table() sub_tbl.add_row() submit_pad1 = sub_tbl.add_cell(' ') submit_pad1.add_style('width: 50%s;' % '%') submit_butt = sub_tbl.add_cell('<input type="button" value="Submit"/>') submit_butt.add_attr('align','center') submit_butt.add_behavior(my.get_submit_behavior(my.movement_code)) submit_pad2 = sub_tbl.add_cell(' ') submit_pad2.add_style('width: 50%s;' % '%') table.add_cell(sub_tbl) return table
def get_display(my): sk = '' if 'search_key' in my.kwargs.keys(): sk = my.kwargs.get('search_key') else: sobject = my.get_current_sobject() sk = sobject.get_search_key() widget = DivWdg() table = Table() table.add_attr('width', '50px') table.add_row() cell1 = table.add_cell('<img border="0" style="vertical-align: middle" title="" src="/context/icons/custom/history_log_button.png">') cell1.add_attr('sk', sk) launch_behavior = my.get_launch_behavior() cell1.add_style('cursor: pointer;') cell1.add_behavior(launch_behavior) widget.add(table) return widget
def get_operator_section(self): operator_table = Table() operator_table.add_attr('class', 'operator_table') operator_table.add_row() operator_table.add_header('DATE') operator_table.add_header('OPERATOR') operator_table.add_header('STYLE') operator_table.add_header('BAY') operator_table.add_header('MACHINE') operator_table.add_row() operator_table.add_cell(self.get_date_calendar_wdg()) operator_table.add_cell(get_text_input_wdg('operator', get_attribute_or_none(self, 'operator'))) operator_table.add_cell(self.get_style_select()) operator_table.add_cell(self.get_bay_select()) operator_table.add_cell(self.get_machine_select()) return operator_table
def get_operator_section(self): operator_table = Table() operator_table.add_attr('class', 'operator_table') operator_table.add_row() operator_table.add_header('DATE') operator_table.add_header('OPERATOR') operator_table.add_header('STYLE') operator_table.add_header('BAY') operator_table.add_header('MACHINE') operator_table.add_row() operator_table.add_cell(self.get_date_calendar_wdg()) operator_table.add_cell(self.get_text_input_wdg('operator')) operator_table.add_cell(self.get_style_select()) operator_table.add_cell(self.get_bay_select()) operator_table.add_cell(self.get_machine_select()) return operator_table
def get_display(my): code = '' order_name = '' sob_sk = '' title_code = '' if 'title_code' in my.kwargs.keys(): title_code = my.kwargs.get('title_code') elif 'code' in my.kwargs.keys(): code = str(my.kwargs.get('code')) else: sobject = my.get_current_sobject() code = sobject.get_code() widget = DivWdg() table = Table() table.add_attr('width', '50px') table.add_row() cell1 = table.add_cell('<img border="0" style="vertical-align: middle" title="" src="/context/icons/silk/door_in.png">') launch_behavior = my.get_launch_behavior(code, title_code) cell1.add_style('cursor: pointer;') cell1.add_behavior(launch_behavior) widget.add(table) return widget
def get_display(self): top = DivWdg() name = self.get_name() top.add_class("spt_note_input_top") context = self.get_option("context") if not context: context = name sobject = self.get_option("sobject") if not sobject: search_key = self.get_option("search_key") sobject = Search.get_by_search_key(search_key) else: search_key = sobject.get_search_key() if search_key or (sobject and not sobject.is_insert()): search = Search("sthpw/note") #search.add_relationship_filters(self.filtered_parents, type='hierarchy') search.add_parent_filter(sobject) search.add_filter("context", context) search.add_order_by("process") search.add_order_by("context") search.add_order_by("timestamp desc") search.add_filter("context", context) count = search.get_count() last_note = search.get_sobject() else: last_note = None count = 0 #if not last_note: # last_note = SearchType.create("sthpw/note") # last_note.set_value("login", "") # last_note.set_value("timestamp", "") # last_note.set_value("note", "") if last_note: last_div = DivWdg() top.add(last_div) table = Table() table.add_style("width: 100%") table.add_attr("cellpadding", "0px") table.add_attr("cellspacing", "0px") last_div.add(table) table.add_row() td = table.add_cell() td.add_style("vertical-align: top") td.add_style("padding: 5px 15px 10px 5px") table.add_border() table.add_color("background", "background", -5) note_str = last_note.get_value("note") login = last_note.get_value("login") if not login: login = "******" date = last_note.get_datetime_value("timestamp") if date: date_str = "<i style='font-size: 0.8em'>%s</i>" % date.strftime( "%Y-%m-%d") else: date_str = "" login = "******" % login td.add("%s - %s<br/>" % (date_str, login)) note_str_div = DivWdg() note_str_div.add(note_str) note_str_div.add_style("padding: 10px 15px 10px 10px") #td = table.add_cell( note_str_div ) td.add(note_str_div) #td.add_style("vertical-align: top") #td.add_style("padding: 10px 15px 10px 10px") """ td.add_behavior( { 'type': 'click_up', 'cbjs_action': ''' var top = bvr.src_el.getParent(".spt_note_input_top"); var text_el = top.getElement(".spt_add_entry"); text_el.setStyle("display", ""); ''' } ) """ # log if count == 0: td = table.add_cell("") elif count == 1: td = table.add_cell( "<i style='font-size: 0.8em'>More...><br/>(%s entry)</i>" % count) else: td = table.add_cell( "<i style='font-size: 0.8em'>More...><br/>(%s entries)</i>" % count) td.add_style("vertical-align: top") td.add_style("padding: 3px") td.add_class("hand") td.add_behavior({ 'type': 'click_up', 'search_key': search_key, 'context': context, 'cbjs_action': ''' var class_name = 'tactic.ui.input.note_input_wdg.NoteHistoryWdg'; var kwargs = { search_key: bvr.search_key, context: bvr.context } spt.panel.load_popup("Notes Log", class_name, kwargs); ''' }) name = self.get_input_name() text = TextAreaWdg(name) top.add(text) text.add_style("width: 100%") text.add_class("spt_add_entry") """ if search_key and not sobject.is_insert(): from tactic.ui.widget import DiscussionWdg discussion_wdg = DiscussionWdg(search_key=search_key, context_hidden=False, show_note_expand=False, show_add=False) top.add(discussion_wdg) """ return top
def get_display(my): element_auds = [] server = TacticServerStub.get() wo_code = str(my.kwargs.get('wo_code')) if 'code' in my.kwargs.keys(): code = my.kwargs.get('code') element_auds = server.eval( "@SOBJECT(twog/element_eval_audio['element_eval_code','%s']['@ORDER_BY','channel'])" % code) force_it = False if 'force_it' in my.kwargs.keys(): if my.kwargs.get('force_it') == 'true': force_it = True channels = 21 if 'channels' in my.kwargs.keys(): channels = int(my.kwargs.get('channels')) if len(element_auds) > 0 and not force_it: channels = len(element_auds) leng = len(element_auds) for i in range(leng, channels - leng): element_auds.append(None) a_third = int(channels / 3) if int(float( float(float(channels) / float(3)) * 1000)) != a_third * 1000: a_third += 1 grand_table = Table() grand_table.add_attr('id', 'audio_information') grand_table.add_attr('channels', channels) grand_table.add_row() atable = None for i in range(0, channels): if i in [0, a_third, (a_third * 2)]: atable = Table() atable.add_attr('class', 'atable') atable.add_attr('border', '1') atable.add_row() atable.add_cell('Channel') atable.add_cell('Content') atable.add_cell('Tone') atable.add_cell('Peak') atable.add_row() the_code = '' channel = '' content = '' tone = '' peak = '' if i < len(element_auds): if element_auds[i] != None: the_code = element_auds[i].get('code') channel = element_auds[i].get('channel') content = element_auds[i].get('content') tone = element_auds[i].get('tone') peak = element_auds[i].get('peak') atable.add_cell( my.txtbox('channel-%s' % i, channel, the_code, channel, width='68px', js='yes')) sellie = atable.add_cell( my.txtbox('content-%s' % i, content, the_code, content, width='132px')) atable.add_cell( my.txtbox('tone-%s' % i, tone, the_code, tone, width='68px')) atable.add_cell( my.txtbox('peak-%s' % i, peak, the_code, peak, width='68px')) if i in [a_third - 1, (a_third * 2) - 1, channels - 1]: grand_cell = grand_table.add_cell(atable) grand_cell.add_attr('valign', 'top') if i != channels - 1: grand_table.add_cell(' ') atable = None return grand_table