示例#1
0
    def get_display(my):
        my.order_sk = my.kwargs.get('order_sk')
        order_code = my.order_sk.split('code=')[1]
        my.groups_str = None
        if 'display_mode' in my.kwargs.keys():
            my.disp_mode = my.kwargs.get('display_mode')
            if my.disp_mode == 'Small':
                my.small = True
        if 'user' in my.kwargs.keys():
            my.user = my.kwargs.get('user')
        else:
            my.user = Environment.get_user_name()
        if 'groups_str' in my.kwargs.keys():
            my.groups_str = my.kwargs.get('groups_str')
        if my.groups_str in [None, '']:
            user_group_names = Environment.get_group_names()
            for mg in user_group_names:
                if my.groups_str == '':
                    my.groups_str = mg
                else:
                    my.groups_str = '%s,%s' % (my.groups_str, mg)
        if 'is_master' in my.kwargs.keys():
            my.is_master_str = my.kwargs.get('is_master')
            if my.is_master_str == 'true':
                my.is_master = True
        else:
            server = TacticServerStub.get()
            main_obj = server.eval("@SOBJECT(twog/order['code','%s'])" % order_code)[0]
            if main_obj.get('classification') in ['master', 'Master']:
                my.is_master = True
                my.is_master_str = 'true'
        # Get the javascript functions

        table = Table()
        table.add_attr('class', 'qe_top_%s' % my.order_sk)
        table.add_attr('width', '100%')
        table.add_row()
        type_checks_tbl = Table()
        long_row = type_checks_tbl.add_row()
        long_row.add_attr('width', '100%')
        title_check = CustomCheckboxWdg(name='qe_titles_%s' % my.order_sk, value_field='title', checked='false',
                                        dom_class='quick_edit_selector')

        type_checks_tbl.add_cell(title_check)
        type_checks_tbl.add_cell('Titles')

        proj_check = CustomCheckboxWdg(name='qe_projects_%s' % my.order_sk, value_field='projects', checked='false',
                                       dom_class='quick_edit_selector')

        type_checks_tbl.add_cell(proj_check)
        type_checks_tbl.add_cell('Projects')

        wo_check = CustomCheckboxWdg(name='qe_work_orders_%s' % my.order_sk, value_field='work orders', checked='false',
                                     dom_class='quick_edit_selector')
        type_checks_tbl.add_cell(wo_check)
        wo = type_checks_tbl.add_cell('Work Orders')
        wo.add_attr('nowrap', 'nowrap')

        eq_check = CustomCheckboxWdg(name='qe_equipment_%s' % my.order_sk, value_field='equipment', checked='false',
                                     dom_class='quick_edit_selector')

        type_checks_tbl.add_cell(eq_check)
        type_checks_tbl.add_cell('Equipment')

        group_selector = my.get_assigned_group_select(None, 'group_selector')
        group_selector.add_behavior(get_select_checks_by_group_behavior(my.order_sk))
        type_checks_tbl.add_cell('   ')
        sbd = type_checks_tbl.add_cell('Select by Dept:')
        sbd.add_attr('nowrap', 'nowrap')
        type_checks_tbl.add_cell(group_selector)

        tog_check = CustomCheckboxWdg(name='qe_toggler', additional_js=my.get_toggle_select_check_behavior(),
                                      value_field='toggler', id='selection_toggler', checked='false')

        last_cell = type_checks_tbl.add_cell(tog_check)
        last_cell.add_attr('width', '100%')
        last_cell.add_attr('align', 'right')
        lc1 = type_checks_tbl.add_cell('Select/Deselect All In Table')
        lc1.add_attr('width', '100%')
        lc1.add_attr('align', 'right')
        lc1.add_attr('nowrap', 'nowrap')

        long_cell = table.add_cell(type_checks_tbl)
        long_cell.add_attr('colspan', '8')

        table.add_row()
        table.add_cell('Platform: ')
        # Get the list of platforms from the db
        # Create the platform select wdg
        platforms = my.server.eval("@GET(twog/platform['@ORDER_BY','name'].name)")
        platform_sel = SelectWdg('platform_sel_%s' % my.order_sk)
        platform_sel.append_option('--Select--', '--Select--')
        for platform in platforms:
            platform_sel.append_option(platform, platform)
        table.add_cell(platform_sel)

        # Create the territory select wdg
        territories = my.territory_str.split('|')
        territory_sel = SelectWdg('territory_sel_%s' % my.order_sk)
        territory_sel.append_option('--Select--', '--Select--')
        for territory in territories:
            territory_sel.append_option(territory, territory)
        table.add_cell('Territory: ')
        table.add_cell(territory_sel)

        # Create the languages select wdg
        languages = my.language_str.split('|')
        language_sel = SelectWdg('language_sel_%s' % my.order_sk)
        language_sel.append_option('--Select--', '--Select--')
        for language in languages:
            language_sel.append_option(language, language)
        table.add_cell('Language: ')
        table.add_cell(language_sel)

        # Create calendar input for start date
        sd = table.add_cell('Start Date: ')
        sd.add_attr('nowrap', 'nowrap')
        start = CalendarInputWdg("qe_start_date_%s" % my.order_sk)
        start.set_option('show_activator', True)
        start.set_option('show_confirm', False)
        start.set_option('show_text', True)
        start.set_option('show_today', False)
        start.set_option('read_only', False)
        start.get_top().add_style('width: 150px')
        start.set_persist_on_submit()
        start_date = table.add_cell(start)
        start_date.add_attr('nowrap', 'nowrap')

        # Create calendar input for due date
        dd = table.add_cell('Due Date: ')
        dd.add_attr('nowrap', 'nowrap')
        due = CalendarInputWdg("qe_due_date_%s" % my.order_sk)
        due.set_option('show_activator', True)
        due.set_option('show_confirm', False)
        due.set_option('show_text', True)
        due.set_option('show_today', False)
        due.set_option('read_only', False)
        due.get_top().add_style('width: 150px')
        due.set_persist_on_submit()
        due_date = table.add_cell(due)
        due_date.add_attr('nowrap', 'nowrap')

        table.add_cell('Priority: ')
        table.add_cell('<input type="text" name="qe_priority_%s"/>' % my.order_sk)

        table.add_row()

        # Statuses should pull from the database soon, so I won't have to adjust this list every time a new status is
        # added or removed
        statuses = ['Pending', 'Ready', 'On Hold', 'Client Response', 'Fix Needed', 'Rejected', 'In Progress',
                    'DR In Progress', 'Amberfin01 In Progress', 'Amberfin02 In Progress', 'BATON In Progress',
                    'Export In Progress', 'Need Buddy Check', 'Buddy Check In Progress', 'Completed']
        status_sel = SelectWdg('eq_status_%s' % my.order_sk)
        status_sel.append_option('--Select--', '--Select--')
        for status in statuses:
            status_sel.append_option(status, status)
        table.add_cell('Status: ')
        table.add_cell(status_sel)

        assigned_group_select = my.get_assigned_group_select(None, 'assigned_group_select')
        ag = table.add_cell('Assigned Group: ')
        ag.add_attr('nowrap', 'nowrap')
        table.add_cell(assigned_group_select)

        assigned_select = my.get_assigned_select(None)
        ad = table.add_cell('Assigned: ')
        ad.add_attr('nowrap', 'nowrap')
        table.add_cell(assigned_select)

        ewh = table.add_cell('Estimated Work Hours: ')
        ewh.add_attr('nowrap', 'nowrap')
        table.add_cell('<input type="text" name="qe_ewh_%s"/>' % my.order_sk)

        table.add_row()

        ed = table.add_cell('Expected Duration: ')
        ed.add_attr('nowrap', 'nowrap')
        table.add_cell('<input type="text" name="qe_ex_dur_%s"/>' % my.order_sk)

        exq = table.add_cell('Expected Quantity: ')
        exq.add_attr('nowrap', 'nowrap')
        table.add_cell('<input type="text" name="qe_ex_quan_%s"/>' % my.order_sk)

        # Submit button applies changes to everything in the order builder that is selected
        submit_button = table.add_cell('<input type="button" name="submit_button" value="Apply Changes"/>')
        submit_button.add_behavior(get_submit_quick_changes(my.order_sk, my.user))
        # Add equipment to all work orders that are selected
        add_eq_button = table.add_cell('<input type="button" name="add_eq_button" value="Edit Equipment"/>')
        add_eq_button.add_behavior(get_eq_edit_behavior(my.order_sk, my.user))
        last_chunk = table.add_cell(' ')
        last_chunk.add_attr('width', '100%')
        open_errors = table.add_cell('<u>Document Errors</u>')
        open_errors.add_attr('name', 'qe_error_opener_%s' % my.order_sk)
        open_errors.add_style('cursor: pointer;')
        open_errors.add_behavior(get_open_errors_behavior(my.order_sk))
        # Button to delete selected objects
        delete_button = table.add_cell('<input type="button" name="delete_button" value="Delete Selected"/>')
        delete_button.add_behavior(get_qe_delete(my.order_sk, my.user))

        # This is where the scheduler can enter production errors. It is hidden until "Document Errors" is clicked
        errors_row = table.add_row()
        errors_row.add_attr('class', 'qe_errors_row_%s' % my.order_sk)
        errors_row.add_style('display: none;')
        errors_wdg = ErrorEntryWdg(order_sk=my.order_sk, code='NOCODE', user=my.user, groups_str=my.groups_str,
                                   display_mode=my.disp_mode)
        errors_cell = table.add_cell(errors_wdg)
        errors_cell.add_attr('colspan', '10')
        return table
示例#2
0
    def get_display(my):
        login = Environment.get_login()
        this_user = login.get_login()
        groups = Environment.get_group_names()
        my.get_stub()
        show_save = False
        for g in groups:
            if 'qc' in g or 'edeliveries' in g:
                show_save = True
        if this_user == 'admin':
            show_save = True
        this_timestamp = str(datetime.datetime.now()).split('.')[0]
        code = my.kwargs.get('code')
        original_code = code

        widget = DivWdg()

        if 'TITLE' in code:
            wos = my.server.eval("@GET(twog/work_order['title_code','%s'].code)" % code)
            if len(wos) > 0:
                code = wos[0]
            else:
                none_msg = 'THERE ARE NO WORK ORDERS IN THIS TITLE'
                none_tbl = Table()
                none_tbl.add_row()
                none_tbl.add_cell(none_msg)
                widget.add(none_tbl)
                return widget
        work_order = my.server.eval("@SOBJECT(twog/work_order['code','%s'])" % code)[0]
        title = my.server.eval("@SOBJECT(twog/title['code','%s'])" % work_order.get('title_code'))[0]
        tech_code = ''
        tech = {
            'code': '',
            'description': '',
            'timestamp': this_timestamp,
            'login': this_user,
            'barcode': '',
            'client_code': '',
            'client_name': '',
            'title': title.get('title'),
            'title_code': title.get('code'),
            'episode': '',
            'type': '',
            'trt': '',
            'part': '',
            'label_date': '',
            'capture_or_layoff': '',
            'date': this_timestamp,
            'order_code': work_order.get('order_code'),
            'source_deck': '',
            'record_deck': '',
            'aspect_ratio': '',
            'format': '',
            'standard': '',
            'timecode': '',
            'text': '',
            'vitc_lines': '',
            'horiz_blank': '',
            'active_video_lines': '',
            'title_safe': '',
            'error_logger': '',
            'audio_ch01': '',
            'audio_ch02': '',
            'audio_ch03': '',
            'audio_ch04': '',
            'audio_ch05': '',
            'audio_ch06': '',
            'audio_ch07': '',
            'audio_ch08': '',
            'audio_ch09': '',
            'audio_ch10': '',
            'audio_ch11': '',
            'audio_ch12': '',
            'peak_ch01': '',
            'peak_ch02': '',
            'peak_ch03': '',
            'peak_ch04': '',
            'peak_ch05': '',
            'peak_ch06': '',
            'peak_ch07': '',
            'peak_ch08': '',
            'peak_ch09': '',
            'peak_ch10': '',
            'peak_ch11': '',
            'peak_ch12': '',
            'in_phase_0102': '',
            'in_phase_0304': '',
            'in_phase_0506': '',
            'in_phase_0708': '',
            'in_phase_0910': '',
            'in_phase_1112': '',
            'first_cut': '',
            'first_cut_field': '',
            'last_cut': '',
            'last_cut_field': '',
            'tc_verify': '',
            'error_logger_messages': '',
            'general_comments': '',
            'operator': this_user,
            'source_code': '',
            'work_order_code': work_order.get('code'),
            'wo_name': work_order.get('process')
        }
        if 'tech_code' in my.kwargs.keys():
            tech_code = str(my.kwargs.get('tech_code'))
            if tech_code not in [None,'']:
                tech = my.server.eval("@SOBJECT(twog/tech_eval['code','%s'])" % tech_code)[0]
            else:
                tech_code = ''
        wo_evals = my.server.eval("@SOBJECT(twog/tech_eval['work_order_code','%s']['code','!=','%s'])" % (code, tech_code))
        title_evals = my.server.eval("@SOBJECT(twog/tech_eval['title_code','%s']['work_order_code','!=','%s']['code','!=','%s'])" % (work_order.get('title_code'), work_order.get('code'), tech_code))
        others = Table()
        others.add_style('background-color: #528B8B; width: 100%;')
        cols = ['#537072', '#518A1A']
        colsct = 0
        if len(title_evals) > 0:
            trrr = others.add_row()
            trrr.add_style('background-color: #50EDA1;')
            others.add_cell('<b>Other Tech Evals for Title</b>')
            for t in title_evals:
                click_row = others.add_row()
                click_row.add_attr('tech_code', t.get('code'))
                click_row.add_attr('work_order_code', t.get('work_order_code'))
                click_row.set_style('cursor: pointer; background-color: %s;' % cols[colsct % 2])
                click_row.add_behavior(my.get_click_row(t.get('work_order_code'), t.get('code')))
                others.add_cell('<b>WO:</b> %s, <b>CODE:</b> %s' % (t.get('wo_name'), t.get('work_order_code')))
                others.add_cell('<b>OPERATOR:</b> %s' % t.get('operator'))
                others.add_cell('<b>DATETIME:</b> %s' % fix_date(t.get('date')))
                colsct += 1
        if len(wo_evals) > 0:
            wrrr = others.add_row()
            wrrr.add_style('background-color: #50EDA1;')
            others.add_cell('<b>Other Tech Evals for Work Order</b>')
            for w in wo_evals:
                click_row = others.add_row()
                click_row.add_attr('tech_code', w.get('code'))
                click_row.add_attr('work_order_code', w.get('work_order_code'))
                click_row.set_style('cursor: pointer; background-color: %s;' % cols[colsct % 2])
                click_row.add_behavior(my.get_click_row(w.get('work_order_code'), w.get('code')))
                others.add_cell('<b>WO:</b> %s, <b>CODE:</b> %s' % (w.get('wo_name'), w.get('work_order_code')))
                others.add_cell('<b>OPERATOR:</b> %s' % w.get('operator'))
                others.add_cell('<b>DATETIME:</b> %s' % fix_date(w.get('date')))
                colsct += 1

        widget.add_attr('class', 'big_ol_tech_wdg_%s' % code)
        widget.add_attr('tech_code', tech.get('code'))
        table = Table()
        table.add_attr('class', 'printable_tech_form_%s' % code)
        table.add_attr('tech_code', tech.get('code'))
        table.add_attr('work_order_code', tech.get('work_order_code'))
        table.add_style('font-family: Calibri, sans-serif;')
        img_tbl = Table()
        img_tbl.add_row()
        i2 = Table()
        i2.add_row()
        i2.add_cell('<img src="/source_labels/2GLogo_small4.png"/>')
        img_tbl.add_cell(i2)
        ad = Table()
        ad.add_row()
        address = ad.add_cell('<b>2G Digital Post, Inc.</b><br/>280 E. Magnolia Blvd.<br/>Burbank, CA 91502<br/>310-840-0600<br/>www.2gdigitalpost.com')
        address.add_attr('nowrap', 'nowrap')
        address.add_style('font-size', '9px')
        img_tbl.add_cell(ad)

        rtbl = Table()
        rtbl.add_row()
        big = rtbl.add_cell("<b>LOAD/LAY-OFF TECH EVALUATION</b>")
        big.add_attr('nowrap', 'nowrap')
        big.add_attr('align', 'center')
        big.add_attr('valign', 'center')
        big.add_style('font-size', '40px')
        rtbl.add_cell('')
        toptbl = Table()
        toptbl.add_row()
        toptbl = Table()
        toptbl.add_row()
        toptbl.add_cell(img_tbl)
        toptbl.add_cell(rtbl)

        printtbl = Table()
        printtbl.add_style('background-color: #528B8B; width: 100%;')
        printtbl.add_row()
        p1 = printtbl.add_cell(' ')
        p1.add_style('width', '40%')
        p2 = printtbl.add_cell('<u><b>Print This Report</b></u>')
        p2.add_attr('nowrap','nowrap')
        p2.add_style('cursor: pointer;')
        p2.add_behavior(my.get_print_bvr(code, tech.get('code'), 'tech'))
        p3 = printtbl.add_cell(' ')
        p3.add_style('width', '40%')

        qcd = CalendarInputWdg("timestamp")
        qcd.set_option('show_activator', True)
        qcd.set_option('show_confirm', False)
        qcd.set_option('show_text', True)
        qcd.set_option('show_today', False)
        qcd.set_option('read_only', False)
        qcd.set_option('width', '120px')
        qcd.set_option('id', 'timestamp')
        if tech.get('timestamp') not in [None,'']:
            qcd.set_option('default', fix_date(tech.get('timestamp')))
        qcd.get_top().add_attr('id','timestamp')
        qcd.set_persist_on_submit()

        lbld = CalendarInputWdg("label_date")
        lbld.set_option('show_activator', True)
        lbld.set_option('show_confirm', False)
        lbld.set_option('show_text', True)
        lbld.set_option('show_today', False)
        lbld.set_option('read_only', False)
        lbld.set_option('width', '120px')
        lbld.set_option('id', 'label_date')
        if tech.get('label_date') not in [None,'']:
            lbld.set_option('default', fix_date(tech.get('label_date')))
        lbld.get_top().add_attr('id', 'label_date')
        lbld.set_persist_on_submit()

        majtbl = Table()
        majtbl.add_row()
        mt = majtbl.add_cell('2G BARCODE')
        mt.add_attr('align', 'left')
        mt.add_attr('nowrap', 'nowrap')
        mc = majtbl.add_cell('CLIENT')
        mc.add_attr('align', 'left')
        mc.add_attr('nowrap', 'nowrap')
        mp = majtbl.add_cell('ENTRY DATE')
        mp.add_attr('align', 'left')
        mp.add_attr('nowrap', 'nowrap')
        majtbl.add_row()
        majtbl.add_cell('<input type="text" value="%s" class="tech_r_var" id="barcode" style="width: 240px;"/>' % tech.get('barcode'))
        majtbl.add_cell('<input type="text" value="%s" class="tech_r_var" id="client_name" style="width: 340px;"/>' % tech.get('client_name'))
        majtbl.add_cell(qcd)

        titbl = Table()
        titbl.add_row()
        t1 = titbl.add_cell('TITLE')
        t1.add_attr('align', 'left')
        t2 = titbl.add_cell('EPISODE')
        t2.add_attr('align', 'left')
        titbl.add_row()
        titbl.add_cell('<input type="text" value="%s" class="tech_r_var" id="title" style="width: 340px;"/>' % tech.get('title'))
        titbl.add_cell('<input type="text" value="%s" class="tech_r_var" id="episode" style="width: 240px;"/>' % tech.get('episode'))

        majtbl.add_row()
        titc = majtbl.add_cell(titbl)
        titc.add_attr('colspan', '3')

        trtbl = Table()
        trtbl.add_row()
        tr1 = trtbl.add_cell('TYPE')
        tr1.add_attr('align', 'left')
        tr2 = trtbl.add_cell('TRT')
        tr2.add_attr('align', 'left')
        trtbl.add_row()
        trtbl.add_cell('<input type="text" value="%s" class="tech_r_var" id="type" style="width: 340px;"/>' % tech.get('type'))
        trtbl.add_cell('<input type="text" value="%s" class="tech_r_var" id="trt" style="width: 240px;"/>' % tech.get('trt'))

        majtbl.add_row()
        titr = majtbl.add_cell(trtbl)
        titr.add_attr('colspan', '3')

        dtbl = Table()
        dtbl.add_row()
        d1 = dtbl.add_cell('DESCRIPTION')
        d1.add_attr('valign', 'top')
        d2 = dtbl.add_cell('<textarea cols="100" rows="3" class="metadata_r_var" id="description">%s</textarea>' % tech.get('description'))

        d2tbl = Table()
        d2tbl.add_row()
        d2tbl.add_cell('PART')
        d2tbl.add_cell('<input type="text" value="%s" class="tech_r_var" id="part" style="width: 140px;"/>' % tech.get('part'))
        d2tbl.add_row()
        d21 = d2tbl.add_cell('LABEL DATE')
        d21.add_attr('nowrap', 'nowrap')
        d2tbl.add_cell(lbld)

        dtbl.add_cell(d2tbl)

        majtbl.add_row()
        titr = majtbl.add_cell(dtbl)
        titr.add_attr('colspan','3')

        radio = '<form class="navbar-form pull-right"><label><input type="radio" name="capture_or_layoff" value="capture" /> Capture</label><label><input type="radio" name="sex" value="layoff" /> Layoff</label></form>'


        ltbl = Table()
        ltbl.add_style('background-color: #4a4a4a;')
        ltbl.add_style('font-size: 15px;')
        ltbl.add_row()
        ltbl.add_cell(radio)

        majtbl.add_row()
        titr = majtbl.add_cell(ltbl)
        titr.add_attr('colspan', '3')

        table.add_row()
        table.add_cell(toptbl)
        table.add_row()
        table.add_cell(majtbl)

        stbl = Table()
        stbl.add_row()
        s1 = stbl.add_cell(' ')
        s1.add_style('width: 40%s;' % '%')
        s2 = stbl.add_cell('<input type="button" value="Save"/>')
        s2.add_behavior(my.get_save_bvr(code, tech.get('code')))
        s3 = stbl.add_cell(' ')
        s3.add_style('width: 40%s;' % '%')
        if tech.get('code') not in [None,'']:
            s4 = stbl.add_cell('<input type="button" value="Delete This Report"/>')
            s4.add_behavior(my.get_delete_eval(code, tech.get('code')))
        ttbl = Table()
        ttbl.add_style('background-color: #528B8B; width: 100%;')
        ttbl.add_row()
        tt1 = ttbl.add_cell(others)
        tt1.add_attr('width','100%')
        ttbl.add_row()
        tt2 = ttbl.add_cell(printtbl)
        tt2.add_attr('width','100%')
        widget.add(ttbl)
        widget.add(table)
        if show_save and 'TITLE' not in original_code:
            widget.add(stbl)

        widget.add(table)

        return widget
示例#3
0
    def get_display(my):
        logine = Environment.get_login()
        user_name = logine.get_login()
        all_days = {}
        group_days = {}
        user_days = {}
        tv_all_days = {}
        tv_group_days = {}
        tv_user_days = {}
        tv_obj = my.server.eval("@SOBJECT(twog/global_resource['name','TimeVantage'])")[0]
        snaps = my.server.eval("@SOBJECT(sthpw/snapshot['search_type','twog/global_resource?project=twog']['search_id','%s']['is_latest','true'])" % tv_obj.get('id'))
        #print "SNAPS = %s" % snaps
        file_path = my.get_snapshot_file_path(snaps[0].get('code'))
        date1, date2 = my.get_dates()
        if 'date1' in my.kwargs.keys():
            date1 = my.kwargs.get('date1')
        if 'date2' in my.kwargs.keys():
            date2 = my.kwargs.get('date2')
        #print "DATE1 = %s, DATE2 = %s" % (date1, date2)
        #file_path = '/opt/spt/custom/graphs/tv.csv'
        tv_data = my.make_TV_data_dict(file_path)
        login_file = '/opt/spt/custom/graphs/login_file'
        work_hour_file = '/opt/spt/custom/graphs/work_hour_file'
        login_in_group_file = '/opt/spt/custom/graphs/login_in_group_file'
        login_query = '/opt/spt/custom/graphs/login_query'
        login_in_group_query = '/opt/spt/custom/graphs/login_in_group_query'
        work_hour_query = '/opt/spt/custom/graphs/work_hour_query'
        os.system('''psql -U postgres sthpw < %s > %s''' % (login_query, login_file))
        os.system('''psql -U postgres sthpw < %s > %s''' % (work_hour_query, work_hour_file))
        os.system('''psql -U postgres sthpw < %s > %s''' % (login_in_group_query, login_in_group_file))
        login_data = my.make_data_dict(login_file, '')[0]
        work_hour_data = my.make_data_dict(work_hour_file, 'hours')[1]
        lig_data = my.make_data_dict(login_in_group_file, 'group')[0]
        login_groups = {}
        
        # Create login_group lookup by login name
        for key, val in login_data.iteritems():
            if key not in login_groups.keys():
                login_groups[key] = []
            for id, data in lig_data.iteritems():
                if data.get('login') == key:
                    login_groups[key].append(data.get('login_group'))
        # Match up TimeVantage names with tactic logins
        # Fill user_dates dict with all matched logins 
        user_dates = {} 
        name_to_login = {}
        for name, data in tv_data.iteritems():
            for ld, ldata in login_data.iteritems():
                lname = '%s %s' % (ldata.get('first_name').lower(), ldata.get('last_name').lower())
                if name == lname:
                    if name not in user_dates.keys():
                        user_dates[name] = {'login': ldata.get('login'), 'dates': {}}
                    if name not in name_to_login.keys():
                        name_to_login[name] = ldata.get('login')

        #print "TV-DATA = %s" % tv_data
        
        group_dates = {}
        all_dates = {}
        for name, data in user_dates.iteritems():
            tdata = tv_data[name]
            tlogin = data.get('login')
            ugroups = []
            if tlogin in login_groups.keys():
                ugroups = login_groups[tlogin]
                print "TLOGIN = %s, UGROUPS = %s" % (tlogin, ugroups)
            for tdate, ttime in tdata['days'].iteritems():
                if tdate < date2 and tdate > date1:
                    if tdate not in user_dates[name]['dates'].keys():
                        user_dates[name]['dates'][tdate] = {'cat': tdate, 'tv': ttime, 'tactic': 0}
                    else:
                        user_dates[name]['dates'][tdate]['tv'] = user_dates[name]['dates'][tdate]['tv'] + ttime 
                    for g in ugroups:
                        if g not in group_dates.keys():
                            group_dates[g] = {}
                        if tdate not in group_dates[g].keys():
                            group_dates[g][tdate] = {'cat': tdate, 'tv': ttime, 'tactic': 0}
                        else:
                            group_dates[g][tdate]['tv'] = group_dates[g][tdate]['tv'] + ttime
                    if tdate not in all_dates.keys():
                        all_dates[tdate] = {'cat': tdate, 'tv': ttime, 'tactic': 0}
                    else:
                        all_dates[tdate]['tv'] = all_dates[tdate]['tv'] + ttime
            if tlogin in work_hour_data.keys():
                for tdict in work_hour_data[tlogin]:
                    day = tdict.get('day')
                    amt = tdict.get('straight_time')
                    if day < date2 and day > date1:
                        if day not in user_dates[name]['dates'].keys():
                            user_dates[name]['dates'][day] = {'cat': day, 'tv': 0, 'tactic': amt}
                        else:
                            user_dates[name]['dates'][day]['tactic'] = user_dates[name]['dates'][day]['tactic'] + amt
                        for g in ugroups:
                            if g not in group_dates.keys():
                                group_dates[g] = {}
                            if day not in group_dates[g].keys():
                                print "DAY = %s, Group Dates Keys = %s" % (day, group_dates[g].keys())
                                group_dates[g][day] = {'cat': day, 'tv': 0, 'tactic': amt}
                                print "GROUP DATES KEYS = %s" % group_dates[g].keys()
                            else:
                                print "GROUP_DATES[%s][%s]['tactic'] = %s, amt = %s" % (g, day, group_dates[g][day]['tactic'], amt)
                                group_dates[g][day]['tactic'] = group_dates[g][day]['tactic'] + amt
                                print "GROUP_DATES[%s][%s]['tactic'] = %s" % (g, day, group_dates[g][day]['tactic'])
                        if day not in all_dates.keys():
                            all_dates[day] = {'cat': day, 'tv': 0, 'tactic': amt}
                        else:
                            all_dates[day]['tactic'] = all_dates[day]['tactic'] + amt
        print "GROUP DATES = %s" % group_dates
        d1s = date1.split('-')
        d2s = date2.split('-')
        d1 = date(int(d1s[0]),int(d1s[1]),int(d1s[2]))
        d2 = date(int(d2s[0]),int(d2s[1]),int(d2s[2]))

        delta = d2 - d1
        dates_to_fill = []
        for i in range(delta.days + 1):
            dates_to_fill.append('%s' % (d1 + td(days=i)))

        users = user_dates.keys()
        idx = 0
        for user in users:
            udkeys = user_dates[user]['dates'].keys()
            if len(udkeys) > 0:
                for dtf in dates_to_fill:
                    found = False
                    for d, l in user_dates[user]['dates'].iteritems():
                        if d == dtf:
                            found = True
                    if not found:
                        user_dates[user]['dates'][dtf] = {'cat': dtf, 'tactic': 0, 'tv': 0}
        for grp, gdata in group_dates.iteritems():
            for dtf in dates_to_fill:
                found = False
                for d, l in group_dates[grp].iteritems():
                    if d == dtf:
                        found = True
                if not found:
                    group_dates[grp][dtf] = {'cat': dtf, 'tactic': 0, 'tv': 0}
        for dtf in dates_to_fill:
            found = False
            for d, l in all_dates.iteritems():
                if d == dtf:
                    found = True
            if not found:
                all_dates[dtf] = {'cat': dtf, 'tactic': 0, 'tv': 0}
        #print "LOGIN GROUPS = %s" % login_groups
        filtbl = Table()
        filtbl.add_row()
        date1_el = CalendarInputWdg("wh_graph_date1")
        date1_el.set_option('show_activator',True) 
        date1_el.set_option('show_confirm', False)
        date1_el.set_option('show_text', True)
        date1_el.set_option('show_today', False)
        date1_el.set_option('show_value', True)
        date1_el.set_option('read_only', False)    
        if date1 not in [None,'']:
            date1_el.set_option('default', date1)
        date1_el.get_top().add_style('width: 150px')
        date1_el.set_persist_on_submit()
        
        date2_el = CalendarInputWdg("wh_graph_date2")
        date2_el.set_option('show_activator',True) 
        date2_el.set_option('show_confirm', False)
        date2_el.set_option('show_text', True)
        date2_el.set_option('show_today', False)
        date2_el.set_option('show_value', True)
        date2_el.set_option('read_only', False)    
        if date2 not in [None,'']:
            date2_el.set_option('default', date2)
        date2_el.get_top().add_style('width: 150px')
        date2_el.set_persist_on_submit()
 
        f1 = filtbl.add_cell(' ')
        f11 = filtbl.add_cell(' Date 1: ')
        f2 = filtbl.add_cell(date1_el)
        f21 = filtbl.add_cell(' Date 2: ')
        f3 = filtbl.add_cell(date2_el)
        f4 = filtbl.add_cell('<input type="button" value="Load Graph" name="not_yo_date"/>') 
        f4.add_style('cursor: pointer;')
        f4.add_behavior(my.get_load_again())
        f1.add_attr('width','40%%')
        f4.add_attr('width','40%%')
                

        surrounder = Table()
        surrounder.add_attr('width','100%%')
        surrounder.add_attr('class','graph_surrounder')
        surrounder.add_row()
        surrounder.add_cell(filtbl)
        
        table = Table()
        table.add_attr('width','100%%')
        table.add_attr('class','graph_top')
        table.add_style('background-color: #60ca9d;')
        lgroupkeys = login_groups.keys()
        arr = []
        # Need to show this one for elites only
        # Show supervisors their department's
        # Show individuals their own
        # Try to implement drop-downs
        for d, l in all_dates.iteritems():
            arr.append(l)
        if len(arr) > 0:
            arr2 = sorted(arr, key=lambda k: k['cat']) 
            acount = 0
            for a1 in arr2:
                percentage = 0
                tv = float(a1.get('tv'))
                tc = float(a1.get('tactic'))
                if tv != 0:
                    percentage = tc/tv * 100
                    pps = '%.2f' % percentage
                    percentage = float(pps)
                if percentage > 100:
                    percentage = 100
                a1['percentage'] = percentage
                arr2[acount] = a1
                acount = acount + 1
            widget = DivWdg("Chart area 2")
            widget.add_attr('id','chartdiv_%s'%idx)
            str_data = my.make_string_dict(arr2)
            widget.add_attr('datastr', str_data)
            widget.add_styles('width: 100%%;height: 200px;')
            my.draw_chart3(widget, idx, 'All')
            table.add_row()
            tc = table.add_cell(widget)
            tc.add_attr('width','100%%')
            tc.add_attr('title','ALL')
            idx = idx + 1
        groups = group_dates.keys()
        for group in groups:
            grptbl = Table()
            grptbl.add_attr('width','100%%')
            grptbl.add_style('background-color: #a1b3e6;')
            #print "GROUP = %s" % group
            arr = []
            for d, l in group_dates[group].iteritems():
                arr.append(l)
            if len(arr) > 0:
                arr2 = sorted(arr, key=lambda k: k['cat']) 
                acount = 0
                for a1 in arr2:
                    percentage = 0
                    tv = float(a1.get('tv'))
                    tc = float(a1.get('tactic'))
                    if tv != 0:
                        percentage = tc/tv * 100
                        pps = '%.2f' % percentage
                        percentage = float(pps)
                    if percentage > 100:
                        percentage = 100
                    a1['percentage'] = percentage
                    arr2[acount] = a1
                    acount = acount + 1
                     
                widget = DivWdg("Chart area 2")
                widget.add_attr('id','chartdiv_%s'%idx)
                str_data = my.make_string_dict(arr2)
                widget.add_attr('datastr', str_data)
                widget.add_styles('width: 100%%;height: 200px;')
                my.draw_chart3(widget, idx, group)
                grptbl.add_row()
                tc = grptbl.add_cell(widget)
                tc.add_attr('width','100%%')
                tc.add_attr('title',group)
                grptbl.add_row()
                opener = grptbl.add_cell('<b><u>Show Users</u></b>')
                opener.add_style('cursor: pointer;')
                toggle_row_behavior = my.get_toggle_row_behavior(group)
                opener.add_behavior(toggle_row_behavior)
                idx = idx + 1
            grpusers = 0
            usertbl = Table()
            usertbl.add_attr('width','100%%')
            usertbl.add_style('background-color: #c8d0e7;')
            for user in users:
                if user in name_to_login.keys():
                    login_name = name_to_login[user] 
                    #print "USER = %s, LOGIN NAME = %s" % (user, login_name)
                    if login_name in lgroupkeys:
                        lgroups = []
                        lgroups = login_groups[login_name]
                        #print "GROUP = %s, USER = %s, LGROUPS = %s" % (group, user, lgroups)
                        #print "LOGIN GROUPS = %s" % login_groups
                        if group in lgroups:
                            arr3 = []
                            for d, l in user_dates[user]['dates'].iteritems():
                                arr3.append(l)
                            if len(arr) > 0:
                                arr4 = sorted(arr3, key=lambda k: k['cat']) 
                                acount = 0
                                for a1 in arr4:
                                    percentage = 0
                                    tv = float(a1.get('tv'))
                                    tc = float(a1.get('tactic'))
                                    if tv != 0:
                                        percentage = tc/tv * 100
                                        pps = '%.2f' % percentage
                                        percentage = float(pps)
                                    if percentage > 100:
                                        percentage = 100
                                    a1['percentage'] = percentage
                                    arr4[acount] = a1
                                    acount = acount + 1
                                widget = DivWdg("Chart area 2")
                                widget.add_attr('id','chartdiv_%s'%idx)
                                str_data = my.make_string_dict(arr4)
                                widget.add_attr('datastr', str_data)
                                widget.add_styles('width: 100%%;height: 200px;')
                                my.draw_chart3(widget, idx, user)
                                if grpusers % 2 == 0:
                                    usertbl.add_row()
                                tc = usertbl.add_cell(widget)
                                tc.add_attr('width','50%%')
                                tc.add_attr('title',user)
                                idx = idx + 1
                                grpusers = grpusers + 1
            if grpusers % 2 == 1:
                te = usertbl.add_cell(' ')
                te.add_attr('width','50%%')
            grprow = grptbl.add_row()
            grprow.add_attr('id','graphs_%s_row' % group)
            grprow.add_style('display: table-row;')
            grptbl.add_cell(usertbl)
            table.add_row()
            table.add_cell(grptbl)
            surrounder.add_row()
            surrounder.add_cell(table)
        return surrounder
示例#4
0
    def get_display(my):
        my.client_code = str(my.kwargs.get('client_code'))
        my.order_sk = str(my.kwargs.get('order_sk'))
        my.order_sid = str(my.kwargs.get('order_sid'))
        order_code = my.order_sk.split('code=')[1]
        order_search = Search("twog/order")
        order_search.add_filter('code',order_code)
        the_order = order_search.get_sobject()

        table = Table()
        table.add_attr('class', 'title_adder_top_%s' % my.order_sk)
        table.add_row()
        table.add_cell('Title: ')
        cell1 = table.add_cell('<input class="tadd_title" type="text"/>')
        cell1.add_attr('colspan','5')
        cell1.add_attr('align','left')

        table.add_row()
        empt = table.add_cell(' ')
        beg = table.add_cell('Range Begin')
        empt = table.add_cell(' ')
        end = table.add_cell('Range End')
        formatter = table.add_cell('# Formatter')
        empt = table.add_cell(' ')
        beg.add_attr('nowrap', 'nowrap')
        beg.add_attr('valign', 'bottom')
        end.add_attr('nowrap', 'nowrap')
        end.add_attr('valign', 'bottom')
        formatter.add_attr('nowrap', 'nowrap')
        formatter.add_attr('valign', 'bottom')
        beg.add_style('font-size: 50%;')
        end.add_style('font-size: 50%;')
        formatter.add_style('font-size: 50%;')
        singl = table.add_cell('Single Episode Name, or Comma Seperated Episode Names')
        singl.add_attr('valign', 'bottom')
        singl.add_style('font-size: 50%;')
        table.add_row()
        table.add_cell('Episode: ')
        table.add_cell('<input class="tadd_epi_range_1" type="text" style="width: 35px;"/>')
        ctr = table.add_cell(' - ')
        ctr.add_attr('align', 'center')
        table.add_cell('<input class="tadd_epi_range_2" type="text" style="width: 35px;"/>')
        table.add_cell('<input class="tadd_episode_format" type="text" style="width: 70px;"/>')
        table.add_cell(' OR ')
        table.add_cell('<input class="tadd_epi_name" type="text" style="width: 200px;"/>')
        #There is no territory table in Tactic rigt now. We may want to do that in the future
        territories_str = 'Afghanistan|Aland Islands|Albania|Algeria|American Samoa|Andorra|Angola|Anguilla|Antigua and Barbuda|Argentina|Armenia|Aruba|Australia|Austria|Azerbaijan|Bahamas|Bahrain|Bangladesh|Barbados|Belarus|Belgium|Belize|Benin|Bermuda|Bhutan|Bolivia|Bonaire|Bosnia and Herzegovina|Botswana|Bouvet Island|Brazil|Brunei Darussalam|Bulgaria|Burkina Faso|Burundi|Cambodia|Cameroon|Canada|Cantonese|Cape Verde|Cayman Islands|Central African Republic|Chad|Chile|China|Christmas Island|Cocos Islands|Colombia|Comoros|Congo|Dem. Rep. of Congo|Cook Islands|Costa Rica|Croatia|Cuba|Curacao|Cyprus|Czech|Denmark|Djibouti|Dominica|Dominican Republic|Ecuador|Egypt|El Salvador|English|Equatorial Guinea|Eritrea|Estonia|Ethiopia|Falkland Islands|Faroe Islands|Fiji|Finland|France|French Guiana|French Polynesia|Gabon|Gambia|Georgia|Germany|Ghana|Gibraltar|Greece|Greek|Greenland|Grenada|Guadeloupe|Guam|Guatemala|Guernsey|Guinea|Guinea-Bissau|Guyana|Haiti|Honduras|Hong Kong|Hungary|Iceland|India|Indonesia|Iran|Iraq|Ireland|Isle of Man|Israel|Italy|Ivory Coast|Jamaica|Japan|Jersey|Jordan|Kazakhstan|Kenya|Kiribati|Kuwait|Kyrgyztan|Laos|Latin America|Latin Spanish|Latvia|Lebanon|Lesotho|Liberia|Libya|Liechtenstein|Lithuania|Luzembourg|Macao|Macedonia|Madagascar|Malawi|Malaysia|Maldives|Mali|Malta|Marshall Islands|Martinique|Mauritania|Mauritius|Mayotte|Mexico|Micronesia|Moldova|Monaco|Mongolia|Montenegro|Montserrat|Morocco|Mozambique|Multi-language|Myanmar|Namibia|Nauru|Nepal|Netherlands|New Caledonia|New Zealand|Nicaragua|Niger|Nigeria|Niue|Norfolk Island|North Korea|Northern Mariana Islands|Norway|Oman|Pakistan|Palau|Palestine|Panama|Papua New Guinea|Pan-Asia|Paraguay|Peru|Philippines|Pitcairn|Poland|Portugal|Puerto Rico|Qatar|Reunion|Romania|Russia|Russian|Rwanda|St Barthelemy|St Helena|St Kitts and Nevis|St Lucia|St Martin|St Pierre and Miquelo|St Vincent and Grenadines|Samoa|San Marino|Sao Tome and Principe|Saudi Arabia|Senegal|Serbia|Seychelles|Sierra Leone|Signapore|Sint Maarten|Slovakia|Slovenia|Solomon Islands|Somalia|South Africa|South Georgia and Swch Islands|South Korea|South Sudan|Spain|Sri Lanka|Sudan|Suriname|Svalbard|Swaziland|Sweden|Switzerland|Syria|Taiwan|Tajikistan|Tanzania|Thai|Thailand|Timor-Leste|Togo|Tokelau|Tonga|Trinidad and Tobago|Tunisia|Turkey|Turkmenistan|Turks and Caicos Islands|Tuvalu|Uganda|Ukraine|UAE|United Kingdom|United States|Uruguay|Uzbekistan|Vanuatu|Various|Vatican|Venezuela|Vietnam|Virgin Islands|Wallis and Futuna|West Indies|Western Sahara|Yemen|Zambia|Zimbabwe'
        territories = territories_str.split('|')
        territory_sel = SelectWdg('tadd_territory')
        territory_sel.append_option('--Select--', '--Select--')
        for terr in territories:
            territory_sel.append_option(terr, terr)
        #There is no language table in Tactic. We may want to change that in the future.
        language_str = 'Abkhazian|Afar|Afrikaans|Akan|Albanian|All Languages|Amharic|Arabic|Arabic - Egypt|Arabic - UAE and Lebanon|Aragonese|Aramaic|Armenian|Assamese|Avaric|Avestan|Aymara|Azerbaijani|Bahasa (Not Specified)|Bashkir|Basque|Belarusian|Bengali|Bihari languages|Bislama|Bosnian|Breton|Bulgarian|Burmese|Catalan|Catalan (Valencian)|Central Khmer|Chamorro|Chechen|Chichewa (Chewa, Nyanja)|Chinese (Cantonese)|Chinese (Mandarin - Not Specified)|Chinese (Mandarin - PRC)|Chinese (Mandarin - Taiwan)|Chinese Simplified Characters|Chinese Simplified Characters - Malaysia|Chinese Simplified Characters - PRC|Chinese Simplified Characters - Singapore|Chinese Traditional Characters|Chinese Traditional Characters - Hong Kong|Chinese Traditional Characters - Taiwan|Chuvash|Cornish|Corsican|Cree|Croatian|Czech|Danish|Dari|Divehi (Dhivehi, Maldivian)|Dutch|Dzongkha|English|English - Australian|English - British|Esperanto|Estonian|Ewe|Faroese|Farsi (Persian)|Fijian|Finnish|Flemish|French (Not Specified)|French - Canadian (Quebecois)|French - France|Fulah|Gaelic (Scottish Gaelic)|Galician|Georgian|German|German - Austrian|German - Swiss/Alsatian|Greek - Modern|Guarani|Gujarati|Haitian (Haitian Creole)|Hausa|Hawaiian|Hebrew|Herero|Hindi|Hiri Motu|Hungarian|Icelandic|Ido|Indonesian Bahasa|Interlingua (International Auxiliary Language Association)|Interlingue (Occidental)|Inuktitut|Inupiaq|Italian|Japanese|Javanese|Kalaallisut (Greenlandic)|Kannada|Kanuri|Kashmiri|Kazakh|Kikuyu (Gikuyu)|Kinyarwanda|Kirghiz (Kyrgyz)|Komi|Kongo|Korean|Kuanyama (Kwanyama)|Kurdish|Lao|Latin|Latvian|Limburgan (Limburger, Limburgish)|Lingala|Lithuanian|Luba-Katanga|Luxembourgish (Letzeburgesch)|MOS (no audio)|Macedonian|Malagasy|Malay Bahasa|Malayalam|Maltese|Maori|Marathi|Marshallese|Mauritian Creole|Mayan|Moldavian|Mongolian|Nauru|Navajo (Navaho)|Ndebele - North|Ndebele - South|Ndonga|Nepali|No Audio|Northern Sami|Norwegian|Occitan|Ojibwa|Oriya|Oromo|Ossetian (Ossetic)|Palauan|Pali|Panjabi (Punjabi)|Polish|Polynesian|Portuguese (Not Specified)|Portuguese - Brazilian|Portuguese - European|Pushto (Pashto)|Quechua|Romanian|Romanian (Moldavian)|Romansh|Rundi|Russian|Samoan|Sango|Sanskrit|Sardinian|Sepedi|Serbian|Serbo-Croatian|Setswana|Shona|Sichuan Yi (Nuosu)|Sicilian|Silent|Sindhi|Sinhala (Sinhalese)|Slavic|Slovak|Slovenian|Somali|Sotho, Sesotho|Spanish (Not Specified)|Spanish - Argentinian|Spanish - Castilian|Spanish - Latin American|Spanish - Mexican|Sudanese|Swahili|Swati|Swedish|Tagalog|Tahitian|Taiwanese (Min Nah)|Tajik|Tamil|Tatar|Telugu|Tetum|Textless|Thai|Tibetan|Tigrinya|Tok Pisin|Tongan|Tsonga|Turkish|Turkmen|Tuvaluan|Twi|Uighur (Uyghur)|Ukrainian|Unavailable|Unknown|Unknown|Urdu|Uzbek|Valencian|Venda|Vietnamese|Volapuk|Walloon|Welsh|Western Frisian|Wolof|Xhosa|Yiddish|Yoruba|Zhuang (Chuang)|Zulu'

        languages = language_str.split('|')
        language_sel = SelectWdg('tadd_language')
        language_sel.append_option('--Select--', '--Select--')
        for language in languages:
            language_sel.append_option(language, language)

        client_search = Search("twog/client")
        client_search.add_order_by('name desc')
        clients = client_search.get_sobjects()

        pipe_search = Search("sthpw/pipeline")
        pipe_search.add_filter('search_type', 'twog/title')
        pipelines = pipe_search.get_sobjects()
        client_pull = SelectWdg('tadd_client_pull')
        client_name = ''
        if len(clients) > 0:
            client_pull.append_option('--Select--', 'NOTHINGXsXNOTHING')
            for client in clients:
                client_pull.append_option(client.get_value('name'), '%sXsX%s' % (client.get_value('code'),client.get_value('name')))
                if client.get_value('code') == my.client_code:
                    client_name = client.get_value('name')
                    client_name_pull = '%sXsX%s' % (client.get_value('code'), client.get_value('name'))
                    client_pull.set_value(client_name_pull)
        client_pull.add_behavior(get_client_change_behavior(my.order_sk))
        platform_search = Search("twog/platform")
        platform_search.add_order_by('name desc')
        outlet_list = platform_search.get_sobjects()
        outlet_pull = SelectWdg('tadd_outlet_pull')
        outlet_pull.append_option('--Select--', 'NOTHINGXsXNOTHING')
        for outlet in outlet_list:
            outlet_pull.append_option(outlet.get_value('name'), outlet.get_value('name'))
        pipe_pull = SelectWdg('tadd_pipe_pull')
        if len(pipelines) > 0:
            pipe_pull.append_option('--Select--', 'NOTHINGXsXNOTHING')
            for pipe in pipelines:
                if not pipe.get_value('hide'):
                    if pipe.get_value('code').split('_')[0] == client_name:
                        pipe_pull.append_option(pipe.get_value('code'), pipe.get_value('code'))
            for pipe in pipelines:
                if not pipe.get_value('hide'):
                    if pipe.get_value('code').split('_')[0] != client_name:
                        pipe_pull.append_option(pipe.get_value('code'), pipe.get_value('code'))
        pipe_pull.add_behavior(get_pipeline_change_behavior(my.order_sk))


        dlv_standard_pull = SelectWdg('tadd_deliverable_standard')
        dlv_standard_pull.append_option('--Select--', 'NOTHINGXsXNOTHING')
        for s in my.standards:
            dlv_standard_pull.append_option(s, s)
        dlv_format_pull = SelectWdg('tadd_deliverable_format')
        dlv_format_pull.append_option('--Select--', 'NOTHINGXsXNOTHING')
        for f in my.formats:
            dlv_format_pull.append_option(f, f)
        dlv_aspect_ratio_pull = SelectWdg('tadd_deliverable_aspect_ratio')
        dlv_aspect_ratio_pull.append_option('--Select--', 'NOTHINGXsXNOTHING')
        for a in my.aspect_ratios:
            dlv_aspect_ratio_pull.append_option(a, a)
        dlv_frame_rate_pull = SelectWdg('tadd_deliverable_frame_rate')
        dlv_frame_rate_pull.append_option('--Select--', 'NOTHINGXsXNOTHING')
        for f in my.frame_rates:
            dlv_frame_rate_pull.append_option(f, f)

        status_triggers_pull = SelectWdg('tadd_status_triggers')
        for f in ['Yes', 'No']:
            status_triggers_pull.append_option(f, f)

        priority_triggers_pull = SelectWdg('tadd_priority_triggers')
        for f in ['Yes', 'No']:
            priority_triggers_pull.append_option(f, f)

        table.add_row()
        t1 = table.add_cell('Territory: ')
        t2 = table.add_cell(territory_sel)
        t1.add_attr('align', 'left')
        t2.add_attr('colspan', '6')
        t2.add_attr('align', 'left')

        table.add_row()
        t1 = table.add_cell('Language: ')
        t2 = table.add_cell(language_sel)
        t1.add_attr('align', 'left')
        t2.add_attr('colspan', '6')
        t2.add_attr('align', 'left')

        table.add_row()
        c1 = table.add_cell('Client: ')
        c2 = table.add_cell(client_pull)
        c1.add_attr('align', 'left')
        c2.add_attr('colspan', '6')
        c2.add_attr('align', 'left')

        table.add_row()
        o1 = table.add_cell('Platform: ')
        o2 = table.add_cell(outlet_pull)
        o1.add_attr('align', 'left')
        o2.add_attr('colspan', '6')
        o2.add_attr('align', 'left')

        table.add_row()
        r1 = table.add_cell('Title Id Num: ')
        r2 = table.add_cell('<input type="text" class="tadd_title_id_number"/>')
        r1.add_attr('align', 'left')
        r2.add_attr('colspan', '6')
        r2.add_attr('align', 'left')

        table.add_row()
        w1 = table.add_cell('Total Program Run Time: ')
        w2 = table.add_cell('<input type="text" class="tadd_total_program_run_time"/>')
        w1.add_attr('align', 'left')
        w2.add_attr('colspan', '6')
        w2.add_attr('align', 'left')

        table.add_row()
        z1 = table.add_cell('Total Run Time w/ Textless: ')
        z2 = table.add_cell('<input type="text" class="tadd_total_run_time_with_textless"/>')
        z1.add_attr('align', 'left')
        z2.add_attr('colspan', '6')
        z2.add_attr('align', 'left')

        table.add_row()
        p1 = table.add_cell('Pipeline: ')
        p2 = table.add_cell(pipe_pull)
        p1.add_attr('align', 'left')
        p2.add_attr('colspan', '6')
        p2.add_attr('align', 'left')

        table.add_row()
        sd = table.add_cell('Start Date: ')
        sd.add_attr('nowrap', 'nowrap')
        start = CalendarInputWdg("tadd_start_date")
        if the_order.get_value('start_date') not in [None,'']:
            start.set_option('default', fix_date(the_order.get_value('start_date')))
        start.set_option('show_activator', True)
        start.set_option('show_confirm', False)
        start.set_option('show_text', True)
        start.set_option('show_today', False)
        start.set_option('read_only', False)
        start.get_top().add_style('width: 150px')
        start.set_persist_on_submit()
        start_date = table.add_cell(start)
        start_date.add_attr('colspan', '7')
        start_date.add_attr('nowrap', 'nowrap')

        table.add_row()
        ed = table.add_cell('Due Date: ')
        ed.add_attr('nowrap','nowrap')
        end = CalendarInputWdg("tadd_due_date")
        if the_order.get_value('due_date') not in [None,'']:
            end.set_option('default', fix_date(the_order.get_value('due_date')))
        end.set_option('show_activator', True)
        end.set_option('show_confirm', False)
        end.set_option('show_text', True)
        end.set_option('show_today', False)
        end.set_option('read_only', False)
        end.get_top().add_style('width: 150px')
        end.set_persist_on_submit()
        end_date = table.add_cell(end)
        end_date.add_attr('colspan', '7')
        end_date.add_attr('nowrap', 'nowrap')

        table.add_row()
        rm = table.add_cell('Revenue Month: ')
        rm.add_attr('nowrap','nowrap')
        rem = CalendarInputWdg("tadd_rm_date")
        if the_order.get_value('expected_delivery_date') not in [None,'']:
            rem.set_option('default', fix_date(the_order.get_value('expected_delivery_date')))
        rem.set_option('show_activator', True)
        rem.set_option('show_confirm', False)
        rem.set_option('show_text', True)
        rem.set_option('show_today', False)
        rem.set_option('read_only', False)
        rem.get_top().add_style('width: 150px')
        rem.set_persist_on_submit()
        rem_date = table.add_cell(rem)
        rem_date.add_attr('colspan', '7')
        rem_date.add_attr('nowrap', 'nowrap')

        table.add_row()
        r8 = table.add_cell('Expected Price: ')
        r9 = table.add_cell('<input type="text" class="tadd_expected_price"/>')
        r8.add_attr('align', 'left')
        r9.add_attr('colspan', '6')
        r9.add_attr('align', 'left')

        table.add_row()
        taa = table.add_cell('Description')
        taa.add_attr('valign', 'top')
        ta1 = table.add_cell('<textarea cols="50" rows="10" class="tadd_description"></textarea>')
        ta1.add_attr('colspan', '6')

        table.add_row()
        s1 = table.add_cell('Deliverable Standard: ')
        s2 = table.add_cell(dlv_standard_pull)
        s1.add_attr('align', 'left')
        s2.add_attr('colspan', '6')
        s2.add_attr('align', 'left')

        table.add_row()
        s1 = table.add_cell('Deliverable Aspect Ratio: ')
        s2 = table.add_cell(dlv_aspect_ratio_pull)
        s1.add_attr('align', 'left')
        s2.add_attr('colspan', '6')
        s2.add_attr('align', 'left')

        table.add_row()
        s1 = table.add_cell('Deliverable Frame Rate: ')
        s2 = table.add_cell(dlv_frame_rate_pull)
        s1.add_attr('align', 'left')
        s2.add_attr('colspan', '6')
        s2.add_attr('align', 'left')

        table.add_row()
        s1 = table.add_cell('Deliverable Format: ')
        s2 = table.add_cell(dlv_format_pull)
        s1.add_attr('align', 'left')
        s2.add_attr('colspan', '6')
        s2.add_attr('align', 'left')

        table.add_row()
        s1 = table.add_cell('Status Triggers?: ')
        s2 = table.add_cell(status_triggers_pull)
        s1.add_attr('align', 'left')
        s2.add_attr('colspan', '6')
        s2.add_attr('align', 'left')

        table.add_row()
        s1 = table.add_cell('Priority Triggers?: ')
        s2 = table.add_cell(priority_triggers_pull)
        s1.add_attr('align', 'left')
        s2.add_attr('colspan', '6')
        s2.add_attr('align', 'left')

        table.add_row()
        tca = table.add_cell('Deliverable Specs')
        tca.add_attr('valign', 'top')
        ta8 = table.add_cell('<textarea cols="50" rows="10" class="tadd_delivery_specs"></textarea>')
        ta8.add_attr('colspan', '6')

        table.add_row()
        table.add_cell('Keywords')
        ta2 = table.add_cell('<textarea cols="50" class="tadd_keywords"></textarea>')
        ta2.add_attr('colspan', '6')

        go_butt = ActionButtonWdg(tip='Create', title='Create')
        go_butt.add_behavior(get_create_titles_behavior(my.order_sk, my.order_sid, my.user))
        table.add_row()
        bottom_butt = table.add_cell(go_butt)
        bottom_butt.add_attr('colspan', '7')
        bottom_butt.add_attr('align', 'center')

        return table