Beispiel #1
0
 def make_check_table(my, dictoid, arr, sob, my_name, color, is_external_rejection=False):
     table = Table()
     table.add_style('background-color: %s;' % color)
     max_width = 3
     table.add_row()
     top_cell = table.add_cell('<b><u>%s</u></b>' % my_name)
     top_cell.add_attr('colspan',max_width)
     top_cell.add_attr('align','center')
     count = 0
     for entry in arr:
         if count % max_width == 0:
             table.add_row()
         checker = CheckboxWdg('check_%s' % dictoid[entry])
         checker.add_attr('code', sob.get('code'))
         checker.add_attr('field', dictoid[entry])
         #checker.set_persistence()
         if sob.get(dictoid[entry]):
             checker.set_value(True)
         else:
             checker.set_value(False)
         if not is_external_rejection:
             checker.add_behavior(my.get_reason_check_behavior(dictoid[entry]))
         check_hold = table.add_cell(checker)
         check_hold.add_attr('code', sob.get('code'))
         check_hold.add_attr('field', dictoid[entry])
         label = table.add_cell(entry)
         label.add_attr('nowrap','nowrap')
         label.add_attr('width','190px')
         count = count + 1 
     return table
    def get_display(my):   
        my.sk = str(my.kwargs.get('search_key'))
        my.code = str(my.kwargs.get('code'))
        my.name = str(my.kwargs.get('name'))

        src_tbl = Table()
        togs = my.server.eval("@SOBJECT(twog/title_origin['title_code','%s'])" % my.code)
        sources = []
        for tog in togs:
            single = my.server.eval("@SOBJECT(twog/source['code','%s'])" % tog.get('source_code'))[0]
            sources.append(single)
        if len(sources) > 0:
            src_title = src_tbl.add_row()
            src_title.add_style('background-color: #cedb3a;')
            src_tbl.add_cell('Sources')
        for src in sources:
            src_tbl.add_row()
            source_look = src_tbl.add_cell('<u>Title: %s, Type: %s</u>' % (src.get('title'), src.get('source_type')))
            source_look.add_attr('nowrap', 'nowrap')
            source_look.add_style('cursor: pointer;')
            source_look.add_behavior(get_open_sob_behavior(src.get('code'), 'twog/source', 'view'))
        view_edit_wdg = EditWdg(element_name='general',mode='view',search_type='twog/title',code=my.code,title="Info for %s" % my.name,view='edit',widget_key='edit_layout',search_key=my.sk)
        delivs_tbl = Table()
        delivs = my.server.eval("@SOBJECT(twog/deliverable['title_code','%s'])" % my.code)
        if len(delivs) > 0:
            d_title = delivs_tbl.add_row()
            d_title.add_style('background-color: #3e5fc9;')
            delivs_tbl.add_cell('Deliverable(s)')
            delivs_tbl.add_cell('Satisfied?')
            
        for d in delivs:
            delivs_tbl.add_row()
            launch_look = delivs_tbl.add_cell('<u>Name: %s, Type: %s To: %s</u>' % (d.get('name'),d.get('source_type'), d.get('deliver_to'))) 
            launch_look.add_attr('nowrap', 'nowrap')
            launch_look.add_style('cursor: pointer;')
            launch_look.add_behavior(get_open_sob_behavior(d.get('code'), 'twog/deliverable', 'view'))
            checkbox = CheckboxWdg('satisfied_%s' % d.get('code'))

            if d.get('satisfied') == True:
                checkbox.set_value(True)
            else:
                checkbox.set_value(False)

            checkbox.add_behavior(get_change_deliverable_satisfied_behavior(d.get('code'), d.get('satisfied')))
            satisfied_cell = delivs_tbl.add_cell(checkbox)
            satisfied_cell.add_attr('align', 'center')
        table = Table()
        table.add_row()
        stbl = table.add_cell(src_tbl)
        stbl.add_attr('align', 'center')
        table.add_row()
        table.add_cell(' ')
        table.add_row()
        dtbl = table.add_cell(delivs_tbl)
        dtbl.add_attr('align', 'center')
        table.add_row()
        table.add_cell(view_edit_wdg)
        return table
Beispiel #3
0
    def make_intermediate_unit(my, in_link, work_order_code, in_or_out, type_str):
        inlink_st = in_link.get('__search_key__').split('?')[0]
        if inlink_st == 'twog/work_order_intermediate':
            lookmeup = in_link.get('intermediate_file_code')
        elif inlink_st == 'twog/work_order_passin':
            lookmeup = in_link.get('intermediate_file_code')
        sob = my.server.eval("@SOBJECT(twog/intermediate_file['code','%s'])" % lookmeup)[0]
        table = Table()
        name = sob.get('name')
        description = sob.get('description')
        table.add_attr('width','100%s' % '%')
        table.add_attr('border','1')
        table.add_style('background-color: %s;' % my.color_lookup[in_or_out])
        table.add_row()
        table_src = Table()
        type_cell = table_src.add_cell(type_str)
        type_cell.add_attr('width', '25%s' % '%')
        table_src.add_row()
        checkbox = CheckboxWdg('src_disp_chk_%s' % sob.get('code'))
        checkbox.add_attr('code',sob.get('code'))
        checkbox.add_attr('special_name',name)
        checkbox.add_attr('location',sob.get('location'))
        checkbox.set_value(False)
        #checkbox.set_persistence()
        table_src.add_cell(checkbox)
        table.add_cell(table_src)

        info_tbl = Table() 
        info_tbl.add_attr('width','100%s' % '%')
        info_tbl.add_row()
        cell1 = info_tbl.add_cell('<u>Title:</u> %s' % name)
        cell1.add_style('cursor: pointer;')
        cell1.add_behavior(my.inspect_intermediate_popup(sob.get('code')))
        if in_or_out == 'IN':
            killer = info_tbl.add_cell(my.x_butt)
            killer.add_style('cursor: pointer;')
            killer.add_behavior(my.get_intermediate_passin_killer_behavior(in_link.get('code'), work_order_code, name))
            info_tbl.add_row()
            desc = info_tbl.add_cell(description)
            desc.add_attr('colspan','2')
        else:
            info_tbl.add_row()
            desc = info_tbl.add_cell(description)

        long_cell = table.add_cell(info_tbl)
        long_cell.add_attr('width','75%s' % '%')
        table.add_row()
        loc_cell1 = table.add_cell('&nbsp;&nbsp;<u>Location:</u>')
        loc_cell1.add_style('cursor: pointer;')
        loc_cell1.add_behavior(my.location_changer(sob.get('__search_key__')))
        loc_cell2 = table.add_cell(sob.get('location'))
        loc_cell2.add_attr('class', 'sd_location_%s' % sob.get('code'))
        loc_cell2.add_attr('colspan','2')
        return table
Beispiel #4
0
 def make_login_table(my, sob):
     table = Table()
     table.add_style('background-color: #fffff1;')
     max_width = 4
     table.add_row()
     top_cell = table.add_cell('<b><u>Responsible</u></b>')
     top_cell.add_attr('colspan',max_width)
     top_cell.add_attr('align','center')
     count = 0
     users = my.server.eval("@SOBJECT(sthpw/login['location','internal']['license_type','user']['@ORDER_BY','login'])")
     for u in users:
         if count % max_width == 0:
             table.add_row()
         checker = CheckboxWdg('responsible_%s' % u.get('login'))
         checker.add_attr('login',u.get('login'))
         checker.add_attr('code',sob.get('code'))
         checker.add_attr('current_list', sob.get('responsible_users'))
         #checker.set_persistence()
         if sob.get('responsible_users') not in [None,'']:
             if u.get('login') in sob.get('responsible_users'):
                 checker.set_value(True)
             else:
                 checker.set_value(False)
         else:
             checker.set_value(False)
         checker.add_behavior(my.get_make_responsible_behavior())
         table.add_cell(checker)
         label = table.add_cell(u.get('login'))
         label.add_attr('nowrap','nowrap')
         label.add_attr('width','137px')
         count = count + 1
     return table
    def get_display(my):
        from tactic_client_lib import TacticServerStub
        widget = DivWdg()
        server = TacticServerStub.get()
        allowed_groups = ['admin','audio','billing and accounts receivable','compression','compression supervisor','edeliveries','edit','edit supervisor','executives','it','machine room','machine room supervisor','management','media vault','media vault supervisor','office employees','qc','qc supervisor','sales','sales supervisor','scheduling','scheduling supervisor','senior_staff','streamz','technical services']
        sobject = None
        code = None
        user_name = None 
        do_inserted_msg = False
        table = Table() 
        table.add_attr('class','source_security_wdg')
        if 'source_code' in my.kwargs.keys():
            code = str(my.kwargs.get('source_code'))    
        if code in [None,'']:
            if 'code' in my.kwargs.keys():
                code = my.kwargs.get('code')
        if 'user_name' in my.kwargs.keys():
            user_name = my.kwargs.get('user_name')
        else:
            login = Environment.get_login()
            user_name = login.get_login()
        if 'from' in my.kwargs.keys():
            if my.kwargs.get('from') == 'insert':
                do_inserted_msg = True
                table.add_attr('from','insert')
        if not do_inserted_msg:
            table.add_attr('from','i dunno')
        group = None
        login_in_groups = server.eval("@SOBJECT(sthpw/login_in_group['login','%s']['login_group','not in','user|client'])" % user_name)
        for lg in login_in_groups:
            if not group:
                group = lg.get('login_group')
            if 'supervisor' in lg.get('login_group'): 
                group = lg.get('login_group')
        
        
        checks = server.eval("@SOBJECT(twog/source_req['source_code','%s'])" % code)
        visi = 'display: none;'
        if len(checks) > 0:
            visi = 'display: table-row;';
        if do_inserted_msg:
            table.add_row()
            inserted_row = table.add_cell('<font color="#f0000">!!!Please Enter the High Security Requirements!!!</font>')
            colspan = 2
            if group in allowed_groups:
                colspan = 3
            inserted_row.add_attr('colspan',colspan)
        top_row = table.add_row()
        top_row.add_style(visi)
        if group in allowed_groups:
            table.add_cell(' ')
        table.add_cell(' ')
        table.add_cell('Satisfied?')
        for check in checks:
            check_row = table.add_row()
            check_row.add_attr('class','row_%s' % check.get('__search_key__'))
            if group in allowed_groups:
                killer = table.add_cell(my.x_butt)
                killer.add_style('cursor: pointer;')
                killer.add_behavior(my.get_killer_behavior(check.get('__search_key__')))
            table.add_cell(check.get('requirement'))
            checkbox = CheckboxWdg('satisfied_%s' % check.get('__search_key__'))
            #checkbox.set_persistence()
            if check.get('satisfied'): 
                checkbox.set_value(True)
            else:
                checkbox.set_value(False)
            checkbox.add_behavior(my.get_change_satisfied(check.get('__search_key__')))
            table.add_cell(checkbox)
        
        table.add_row()
        if group in allowed_groups:
            table.add_cell(' ')
        req_text = TextWdg('new_source_req')
        req_text.add_style('width: 500px')
        req_text.add_behavior(my.get_insert_new_req_from_change(code, user_name))
        table.add_cell(req_text)
        add_button = table.add_cell('<input type="button" class="add_req_button" value="+"/>')
        add_button.add_behavior(my.get_insert_new_req(code, user_name))
        if do_inserted_msg:
            table.add_row()
            inserted_row = table.add_cell('<font color="#f0000">!!!Please Enter the High Security Requirements!!!</font>')
            colspan = 2
            if group in allowed_groups:
                colspan = 3
            inserted_row.add_attr('colspan',colspan)
 
        widget.add(table)
        return widget
Beispiel #6
0
    def make_source_unit(my, in_link, work_order_code, in_or_out, type_str):
        inlink_st = in_link.get('__search_key__').split('?')[0]
        linker = ''
        if inlink_st == 'twog/work_order_passin':
            linker = in_link.get('deliverable_source_code')
        elif inlink_st == 'twog/work_order_deliverables':
            linker = in_link.get('deliverable_source_code')
        elif inlink_st == 'twog/work_order_sources':
            linker = in_link.get('source_code')
            
        sob = my.server.eval("@SOBJECT(twog/source['code','%s'])" % linker)[0]
        st = sob.get('__search_key__').split('?')[0]
        title = sob.get('title')
        if sob.get('episode') not in [None,'']:
            title = "%s: %s" % (title, sob.get('episode'))
        part = ''
        if sob.get('part') not in [None,'']:
            part = sob.get('part') 
        table = Table()
        table.add_attr('width','100%s' % '%')
        table.add_attr('border','1')
        table.add_style('background-color: %s;' % my.color_lookup[in_or_out])
        table.add_row()
        table_src = Table()
        type_cell = table_src.add_cell(type_str)
        type_cell.add_attr('width', '25%s' % '%')
        table_src.add_row()
        checkbox = CheckboxWdg('src_disp_chk_%s' % sob.get('code'))
        checkbox.add_attr('code',sob.get('code'))
        checkbox.add_attr('special_name',sob.get('barcode'))
        checkbox.add_attr('location',sob.get('location'))
        checkbox.set_value(False)
        #checkbox.set_persistence()
        table_src.add_cell(checkbox)
        table.add_cell(table_src)

        top_tbl = Table()
        top_tbl.add_attr('width','100%s' % '%')
        top_tbl.add_row()
        top_tbl.add_cell('<u>Title:</u> %s' % title)
        if type_str == 'SRC':
            killer = top_tbl.add_cell(my.x_butt)
            killer.add_style('cursor: pointer;')
            killer.add_behavior(my.get_source_killer_behavior(in_link.get('code'), work_order_code, title))
        elif type_str == 'SRC-PASSIN':
            killer = top_tbl.add_cell(my.x_butt)
            killer.add_style('cursor: pointer;')
            killer.add_behavior(my.get_deliverable_passin_killer_behavior(in_link.get('code'), work_order_code, title))

        info_tbl = Table() 
        info_tbl.add_attr('width','100%s' % '%')
        info_tbl.add_row()
        info_tbl.add_cell(top_tbl)
        info_tbl.add_row()
        info_tbl.add_cell('<u>Part:</u> %s' % part)
        info_tbl.add_row()
        cell1 = info_tbl.add_cell('<u>Barcode: <b>%s</u></b>' % (sob.get('barcode')))
        cell1.add_style('cursor: pointer;')
        cell1.add_behavior(my.inspect_source_popup(sob.get('code'), sob.get('high_security')))
        info_tbl.add_row()
        info_tbl.add_cell('%s, %s, %s' % (sob.get('standard'), sob.get('aspect_ratio'), sob.get('total_run_time')))
        
        long_cell = table.add_cell(info_tbl)
        long_cell.add_attr('width','75%s' % '%')
        table.add_row()
        loc_cell1 = table.add_cell('&nbsp;&nbsp;<u>Location:</u>')
        loc_cell1.add_style('cursor: pointer;')
        loc_cell1.add_behavior(my.location_changer(sob.get('__search_key__')))
        loc_cell2 = table.add_cell(sob.get('location'))
        loc_cell2.add_attr('class', 'sd_location_%s' % sob.get('code'))
        loc_cell2.add_attr('colspan','2')
        
        return table