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(self):
        """
        Handle how the widget is displayed.

        :return: a widget containing a copy button
        """
        button = ButtonSmallNewWdg(title=self.kwargs.get('title', 'Copy URL to Clipboard'))
        button.set_option('icon', 'LINK')
        url = self.get_url()
        button.add_behavior(self.get_click_behavior(url))

        return button
    def get_display(my):
        my.work_order_code = str(my.kwargs.get('work_order_code'))
        my.client_code = str(my.kwargs.get('client_code'))
        my.parent_pipe = str(my.kwargs.get('parent_pipe'))
        my.is_master = str(my.kwargs.get('is_master'))
        my.order_sk = str(my.kwargs.get('order_sk'))
        wo_search = Search("twog/work_order")
        wo_search.add_filter('code', my.work_order_code)
        work_order = wo_search.get_sobject()
        wo_sk = work_order.get_search_key()
        proj_code = work_order.get_value('proj_code')
        wo_templ_code = work_order.get_value('work_order_templ_code')
        ws_search = Search("twog/work_order_sources")
        ws_search.add_filter("work_order_code", my.work_order_code)
        work_order_sources = ws_search.get_sobjects()

        user_group_names = Environment.get_group_names()
        groups_str = ''
        for mg in user_group_names:
            if groups_str == '':
                groups_str = mg
            else:
                groups_str = '%s,%s' % (groups_str, mg)
        user_is_scheduler = False
        if 'scheduling' in groups_str:
            user_is_scheduler = True

        ignore_processes = work_order.get_value('process')
        other_search = Search("twog/work_order")
        other_search.add_filter('proj_code', work_order.get_value('proj_code'))
        other_search.add_filter('process', ignore_processes, op="!=")
        all_other_wos = other_search.get_sobjects()

        all_other_interms = {}
        for other in all_other_wos:
            or_search = Search("twog/work_order_intermediate")
            or_search.add_filter('work_order_code',other.get_value('code'))
            other_reals = or_search.get_sobjects()
            for otr in other_reals:
                intermediate_file_code = otr.get_value('intermediate_file_code')
                inter_search = Search("twog/intermediate_file")
                inter_search.add_filter('code', intermediate_file_code)
                intermediate_file = inter_search.get_sobject()
                inter_title = intermediate_file.get_value('inter_file')
                if other.get_value('code') not in all_other_interms.keys():
                    all_other_interms[other.get_value('code')] = []
                all_other_interms[other.get_value('code')].append([inter_title, intermediate_file.get_value('code')])

        order_code = my.order_sk.split('code=')[1]
        overhead = Table()
        overhead.add_attr('class','sp_overhead_%s' % my.work_order_code)
        overhead.add_attr('client_code', my.client_code)
        overhead.add_attr('is_master', my.is_master)
        overhead.add_attr('parent_pipe', my.parent_pipe)

        table = Table()
        src_tbl = Table()
        for sc in work_order_sources:
            src_search = Search("twog/source")
            src_search.add_filter('code', sc.get_value('source_code'))
            src = src_search.get_sobjects()
            if len(src) > 0:
                src = src[0]
                src_tbl.add_row()
                if user_is_scheduler:
                    killer = src_tbl.add_cell(my.x_butt)
                    killer.add_style('cursor: pointer;')
                    killer.add_behavior(get_source_killer_behavior(sc.get_value('code'), my.work_order_code,
                                                                   my.parent_pipe, my.client_code, my.is_master,
                                                                   '%s: %s' % (src.get_value('title'),
                                                                               src.get_value('episode')),
                                                                   my.order_sk))
                alabel = src_tbl.add_cell('Source: ')
                alabel.add_attr('align', 'center')
                popper = src_tbl.add_cell('<u>%s: %s</u>' % (src.get_value('title'), src.get_value('episode')))
                popper.add_attr('nowrap', 'nowrap')
                popper.add_style('cursor: pointer;')
                popper.add_behavior(get_launch_wo_source_behavior(my.work_order_code, wo_sk, src.get_value('code'),
                                                                  my.order_sk))
        table.add_row()
        table.add_cell(src_tbl)

        pass_search = Search("twog/work_order_passin")
        pass_search.add_filter('work_order_code', my.work_order_code)
        passins = pass_search.get_sobjects()

        table.add_row()
        table.add_cell(' ')
        table.add_cell(' ')
        add_deliv_passin_butt = table.add_cell('<input type="button" value="Add Permanent Element Pass-in"/>')
        add_deliv_passin_butt.add_attr('colspan', '2')
        add_deliv_passin_butt.add_behavior(get_add_deliverable_passin_behavior(my.work_order_code, wo_templ_code,
                                                                               proj_code, my.order_sk))
        # Now do passed in permanent sources, which can be templated
        dsrc_tbl = Table()
        for p in passins:
            if p.get_value('deliverable_source_code') not in [None,'']:
                ds_search = Search("twog/source")
                ds_search.add_filter('code', p.get_value('deliverable_source_code'))
                d_source = ds_search.get_sobjects()
                if len(d_source) > 0:
                    d_source = d_source[0]
                    dsrc_tbl.add_row()
                    if user_is_scheduler:
                        killer = dsrc_tbl.add_cell(my.x_butt)
                        killer.add_style('cursor: pointer;')
                        killer.add_behavior(get_deliverable_passin_killer_behavior(p.get_value('code'),
                                                                                   my.work_order_code, wo_templ_code,
                                                                                   my.parent_pipe, my.client_code,
                                                                                   my.is_master,
                                                                                   '%s: %s' % (d_source.get_value('title'),
                                                                                               d_source.get_value('episode')),
                                                                                   my.order_sk))
                    alabel = dsrc_tbl.add_cell('Source: ')
                    alabel.add_attr('align', 'center')
                    popper = dsrc_tbl.add_cell('<u>%s: %s</u>' % (d_source.get_value('title'),
                                                                  d_source.get_value('episode')))
                    popper.add_attr('nowrap', 'nowrap')
                    popper.add_style('cursor: pointer;')
                    popper.add_behavior(get_launch_wo_source_behavior(my.work_order_code, wo_sk,
                                                                      d_source.get_value('code'), my.order_sk))
                    if my.is_master in [True,'true','True',1,'t']:
                        if p.get_value('passin_templ_code') in [None,'']:
                            template_button = ButtonSmallNewWdg(title="Template This Passed-in Source", icon=CustomIconWdg.icons.get('TEMPLATE'))
                            if my.is_master == 'true':
                                template_button.add_behavior(get_template_deliverable_passin_behavior(my.work_order_code, wo_templ_code, p.get_value('code')))
                        else:
                            template_button = '<img border="0" style="vertical-align: middle" title="Templated" name="Templated" src="/context/icons/silk/tick.png">'
                        tb = dsrc_tbl.add_cell(template_button)
                        tb.add_attr('class', 'sp_templ_%s' % p.get_value('code'))
        if my.is_master in [True, 'true', 'True', 1, 't']:
            table.add_row()
            table.add_cell(dsrc_tbl)

        table.add_row()
        divider = table.add_cell('<hr/>')
        divider.add_attr('colspan', '4')
        table.add_row()
        table.add_cell(' ')
        table.add_cell(' ')
        adinter_fm_butt = table.add_cell('<input type="button" value="Add Intermediate Pass-in"/>')
        adinter_fm_butt.add_attr('colspan', '2')
        adinter_fm_butt.add_behavior(get_add_intermediate_passin_behavior(my.work_order_code, wo_templ_code, proj_code,
                                                                          my.order_sk))
        inter_tbl = Table()
        for p in passins:
            if p.get_value('intermediate_file_code') not in [None,'']:
                in_search = Search("twog/intermediate_file")
                in_search.add_filter('code', p.get_value('intermediate_file_code'))
                inter_f = in_search.get_sobjects()
                if len(inter_f) > 0:
                    inter_f = inter_f[0]
                    inter_tbl.add_row()
                    if user_is_scheduler:
                        killer = inter_tbl.add_cell(my.x_butt)
                        killer.add_style('cursor: pointer;')
                        killer.add_behavior(get_intermediate_passin_killer_behavior(p.get_value('code'),
                                                                                    my.work_order_code, wo_templ_code,
                                                                                    my.parent_pipe, my.client_code,
                                                                                    my.is_master,
                                                                                    inter_f.get_value('title'),
                                                                                    my.order_sk))
                    alabel = inter_tbl.add_cell('Intermediate: ')
                    alabel.add_attr('align','center')
                    popper = inter_tbl.add_cell('<u>%s</u>' % (inter_f.get_value('title')))
                    popper.add_attr('nowrap','nowrap')
                    popper.add_style('cursor: pointer;')
                    popper.add_behavior(get_open_intermediate_behavior(inter_f.get_value('code'),my.work_order_code, my.client_code, my.order_sk))
                    if my.is_master in [True,'true','True',1,'t']:
                        if p.get_value('passin_templ_code') in [None,'']:
                            template_button = ButtonSmallNewWdg(title="Template This Passed-in Intermediate File", icon=CustomIconWdg.icons.get('TEMPLATE'))
                        if my.is_master == 'true':
                            template_button.add_behavior(get_template_intermediate_passin_behavior(my.work_order_code, wo_templ_code, p.get_value('code')))
                        else:
                            template_button = '<img border="0" style="vertical-align: middle" title="Templated" name="Templated" src="/context/icons/silk/tick.png">'
                        tb = inter_tbl.add_cell(template_button)
                        tb.add_attr('class', 'sp_templ_%s' % p.get_value('code'))


        table.add_row()
        table.add_cell(inter_tbl)

        overhead.add_row()
        oh_cell = overhead.add_cell(table)
        oh_cell.add_attr('class', 'sp_list_cell')

        return overhead
Exemple #4
0
    def get_display(my):
        my.sk = str(my.kwargs.get('sk'))
        my.code = my.sk.split('code=')[1]
        my.order_sk = str(my.kwargs.get('parent_sk'))
        order_code = my.order_sk.split('code=')[1]
        my.parent_sid = str(my.kwargs.get('parent_sid'))
        if 'display_mode' in my.kwargs.keys():
            my.disp_mode = str(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)
        user_is_scheduler = False
        if 'scheduling' in my.groups_str or 'onboarding' in my.groups_str:
            user_is_scheduler = True
        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:
            order_search = Search("twog/order")
            order_search.add_filter('code', order_code)
            order = order_search.get_sobject()
            order_classification = order.get_value('classification')
            if order_classification in ['master', 'Master']:
                my.is_master = True
                my.is_master_str = 'true'

        open_bottom = False
        if 'open_bottom' in my.kwargs.keys():
            ob_text = my.kwargs.get('open_bottom')
            if ob_text in [True, 'true', 't', '1', 1]:
                open_bottom = True
        my.parent_sk = my.order_sk

        if 'main_obj' in my.kwargs.keys():
            main_obj = my.kwargs.get('main_obj')
        else:
            main_search = Search("twog/title")
            main_search.add_filter('code', my.code)
            main_obj = main_search.get_sobject()
        my.search_id = main_obj.get_value('id')
        proj_search = Search("twog/proj")
        proj_search.add_filter('title_code', my.code)
        proj_search.add_order_by('order_in_pipe')
        projs = proj_search.get_sobjects()
        table = Table()
        table.add_attr('cellpadding', '0')
        table.add_attr('cellspacing', '0')
        table.add_attr('class', 'TitleRow_%s' % my.code)
        table.add_style('border-collapse', 'separate')
        table.add_style('border-spacing', '25px 0px')
        table.add_style('border-bottom-right-radius', '10px')
        table.add_style('border-bottom-left-radius', '10px')
        table.add_style('border-top-right-radius', '10px')
        table.add_style('border-top-left-radius', '10px')
        table.add_style('color: #00056a;')
        table.add_style('background-color: %s;' % my.off_color)
        table.add_style('width: 100%;')
        table.add_row()
        epis = ''
        full_title_name = main_obj.get_value('title')
        if main_obj.get_value('episode'):
            epis = ' Episode: %s' % main_obj.get_value('episode')
            full_title_name = '%s: %s' % (full_title_name, main_obj.get_value('episode'))
        title_cell = table.add_cell('<b><u>Title: %s%s</u></b>' % (main_obj.get_value('title'), epis))
        title_cell.add_attr('nowrap', 'nowrap')
        title_cell.add_style('cursor: pointer;')
        title_cell.add_behavior(get_panel_change_behavior('twog/title', my.code, my.sk, my.order_sk, my.title, '',
                                                          'builder/refresh_from_save', '', my.parent_sk,
                                                          '%s: %s' % (main_obj.get_value('title'),
                                                                      main_obj.get_value('episode')),
                                                          user_is_scheduler))
        due_cell = table.add_cell('Due: %s' % fix_date(main_obj.get_value('due_date')).split(' ')[0])
        due_cell.add_attr('nowrap', 'nowrap')
        pipe_disp = main_obj.get_value('pipeline_code')
        if 'XsX' in pipe_disp:
            pipe_disp = 'Not Assigned'
        pipe_cell = table.add_cell('Pipeline: %s' % pipe_disp)
        pipe_cell.add_attr('nowrap', 'nowrap')
        long_cell1 = table.add_cell(' ')
        long_cell1.add_attr('align', 'right')
        long_cell1.add_style('width: 100%')
        if my.small:
            select_check = CustomCheckboxWdg(name='select_%s' % my.code, value_field=my.code, checked='false',
                                             dom_class='ob_selector', parent_table="TitleRow_%s" % my.code,
                                             normal_color=my.off_color, selected_color=my.on_color, code=my.code,
                                             ntype='title', search_key=my.sk,
                                             additional_js=get_selected_color_behavior(my.code,
                                                                                       'TitleRow',
                                                                                       my.on_color,
                                                                                       my.off_color))

            table.add_cell(select_check)
        elif user_is_scheduler or 'onboarding' in my.groups_str:
            xb = table.add_cell(my.x_butt)
            xb.add_attr('align', 'right')
            xb.add_style('cursor: pointer;')
            xb.add_behavior(get_killer_behavior(my.sk, my.parent_sk, 'OrderTable',
                                                '%s: %s' % (main_obj.get_value('title'),
                                                            main_obj.get_value('episode')),
                                                my.order_sk, my.is_master))
        table.add_row()
        long_cell2 = table.add_cell('Code: %s' % my.code)
        long_cell2.add_style('width: 100%')
        status = main_obj.get_value('status')
        status = status.strip(' \t\n\r')
        stat_cell = table.add_cell('Status: %s' % status)
        stat_cell.add_attr('nowrap', 'nowrap')
        if status not in [None,'']:
            stat_cell.add_style('background-color: %s;' % my.stat_colors[status])
        stat_cell.add_style('width: 100%')
        long_cell22 = table.add_cell('Client Status: %s' % main_obj.get_value('client_status'))
        long_cell22.add_attr('nowrap', 'nowrap')
        long_cell22.add_style('width: 100%')
        if my.small:
            title_cell.add_style('font-size: 8px;')
            due_cell.add_style('font-size: 8px;')
            pipe_cell.add_style('font-size: 8px;')
            long_cell1.add_style('font-size: 8px;')
            long_cell2.add_style('font-size: 8px;')
            long_cell22.add_style('font-size: 8px;')
            stat_cell.add_style('font-size: 8px;')
        else:
            table.add_row()
            bottom_buttons = Table()
            bottom_buttons.add_row()
            deliverable_count = DeliverableCountWdg(title_code=my.code, order_sk=my.order_sk,
                                                    full_title=full_title_name)
            d_launcher = bottom_buttons.add_cell(deliverable_count)
            d_launcher.add_attr('class', 'deliverable_count_%s' % my.code)
            d_launcher.add_attr('valign', 'bottom')
            bottom_buttons.add_row()
            prereq_count = PreReqCountWdg(sob_code=my.code, sob_st='twog/title', sob_sk=my.sk,
                                          prereq_st='twog/title_prereq',
                                          sob_name='%s %s' % (main_obj.get_value('title'),
                                                              main_obj.get_value('episode')),
                                          pipeline=main_obj.get_value('pipeline_code'), order_sk=my.order_sk)
            prereq_launcher = bottom_buttons.add_cell(prereq_count)
            prereq_launcher.add_attr('class', 'prereq_count_%s' % my.code)
            prereq_launcher.add_attr('valign', 'bottom')

            if not my.is_master and user_is_scheduler:
                in_bigboard = 'Nope'
                if main_obj.get_value('bigboard') in [True, 'true', 't', 'T', 1]:
                    in_bigboard = 'Yep'
                bbo = BigBoardSelectWdg(search_type='twog/title', code=my.code, in_bigboard=in_bigboard)
                bboc = bottom_buttons.add_cell(bbo)
                bboc.add_attr('align', 'right')

                adder = ButtonSmallNewWdg(title="Add A Project", icon=CustomIconWdg.icons.get('ADD'))
                adder.add_behavior(get_multi_add_projs_behavior(my.order_sk, my.sk))
                add = bottom_buttons.add_cell(adder)
                add.add_attr('align', 'right')

            qc_launcher = QCReportLauncherWdg(code=my.code)
            qcl = bottom_buttons.add_cell(qc_launcher)
            qcl.add_attr('align', 'right')

            if user_is_scheduler:
                stop_button = ButtonSmallNewWdg(title='Deactivate Title - Remove from Operator Views',
                                                icon='/context/icons/custom/stopsmall.png')
                stop_button.add_behavior(get_deactivate_behavior(my.code))
                sb = bottom_buttons.add_cell(stop_button)
                sb.add_attr('id', 'stop_button_%s' % my.code)
                sb.add_attr('align', 'right')

                mastering_icon = '/context/icons/custom/mastering_gray.png'
                mastering_text = "Currently Doesn't Require QC Mastering. Change?"
                if main_obj.get('requires_mastering_qc') not in ['False', 'false', '0', None, False]:
                    mastering_icon = '/context/icons/custom/mastering_lilac.png'
                    mastering_text = "Currently Requires QC Mastering. Change?"
                mastering_button = ButtonSmallNewWdg(title=mastering_text, icon=mastering_icon)
                mastering_button.add_behavior(get_set_mastering(main_obj.get_value('code'), my.order_sk))
                mb = bottom_buttons.add_cell(mastering_button)
                mb.add_attr('id', 'mastering_button_%s' % my.code)
                mb.add_attr('align', 'right')

                face_icon = CustomIconWdg.icons.get('GRAY_BOMB')
                face_text = "All is Ok - Set External Rejection?"
                if main_obj.get('is_external_rejection') == 'true':
                    face_icon = CustomIconWdg.icons.get('RED_BOMB')
                    face_text = "This is an External Rejection!!!"

                panic_button = ButtonSmallNewWdg(title=face_text, icon=face_icon)
                panic_button.add_behavior(get_set_external_rejection(main_obj.get_value('code'), my.order_sk))
                pb = bottom_buttons.add_cell(panic_button)
                pb.add_attr('id', 'panic_button_%s' % my.code)
                pb.add_attr('align', 'right')

                redo_icon = '/context/icons/custom/history_gray.png'
                redo_text = "This is not set as a Redo Title"
                if main_obj.get('redo') not in ['False', 'false', '0', None, False]:
                    redo_icon = '/context/icons/custom/history.png'
                    redo_text = "Currently marked as a Redo Title. Change?"

                redo_button = ButtonSmallNewWdg(title=redo_text, icon=redo_icon)
                redo_button.add_behavior(get_set_redo(main_obj.get_value('code'), my.order_sk))
                rb = bottom_buttons.add_cell(redo_button)
                rb.add_attr('id', 'redo_button_%s' % my.code)
                rb.add_attr('align', 'right')

                if main_obj.get('repurpose'):
                    repurpose_button_text = 'Title is set as a &#34;Repurpose&#34;, do you want to remove this?'
                else:
                    repurpose_button_text = 'Set title as a &#34;Repurpose&#34;?'

                repurpose_button = ButtonSmallNewWdg(title=repurpose_button_text,
                                                     icon=CustomIconWdg.icons.get('REPURPOSE'))
                repurpose_button.add_behavior(set_repurpose(main_obj.get_value('code'), my.order_sk,
                                                            main_obj.get_value('repurpose')))
                repurpose_button_cell = bottom_buttons.add_cell(repurpose_button)
                repurpose_button_cell.add_attr('id', 'repurpose_button_{0}'.format(my.code))
                repurpose_button_cell.add_attr('align', 'right')

                if main_obj.get('imf'):
                    imf_button_text = 'Title is set as an IMF order, do you want to remove this?'
                else:
                    imf_button_text = 'Set title as an IMF order?'

                imf_button = ButtonSmallNewWdg(title=imf_button_text,
                                               icon=CustomIconWdg.icons.get('IMF'))
                imf_button.add_behavior(set_imf(main_obj.get_value('code'), my.order_sk,
                                                main_obj.get_value('imf')))

                imf_button_cell = bottom_buttons.add_cell(imf_button)
                imf_button_cell.add_attr('id', 'imf_button_{0}'.format(my.code))
                imf_button_cell.add_attr('align', 'right')

                prio_reset = ButtonSmallNewWdg(title="Reset Dept Priorities", icon=CustomIconWdg.icons.get('UNDO'))
                prio_reset.add_behavior(get_reset_dept_prios(main_obj.get_value('code')))
                pr = bottom_buttons.add_cell(prio_reset)
                pr.add_attr('align', 'right')

                sts_launcher = ButtonSmallNewWdg(title="Set Status Triggers", icon=CustomIconWdg.icons.get('LINK'))
                sts_launcher.add_behavior(get_launch_title_proj_sts_behavior(main_obj.get_value('code')))
                stsl = bottom_buttons.add_cell(sts_launcher)
                stsl.add_attr('align', 'right')

            source_inspector = ButtonSmallNewWdg(title="Inspect Sources", icon=CustomIconWdg.icons.get('SOURCE_PORTAL'))
            source_inspector.add_behavior(get_source_inspector_behavior(my.sk,
                                                                        '%s: %s' % (main_obj.get_value('title'),
                                                                                    main_obj.get_value('episode'))))
            si = bottom_buttons.add_cell(source_inspector)
            si.add_attr('align', 'right')

            upload = ButtonSmallNewWdg(title="Upload", icon=CustomIconWdg.icons.get('PUBLISH'))
            upload.add_behavior(get_upload_behavior(my.sk))
            up = bottom_buttons.add_cell(upload)
            up.add_attr('align', 'right')

            note_adder = ButtonSmallNewWdg(title="Add Note", icon=CustomIconWdg.icons.get('NOTE_ADD'))
            note_adder.add_behavior(get_launch_note_behavior(my.sk, main_obj.get_value('title')))
            nadd = bottom_buttons.add_cell(note_adder)
            nadd.add_attr('align', 'right')
            nadd.add_style('cursor: pointer;')

            if user_is_scheduler or 'onboarding' in my.groups_str:
                pipe_button = ButtonSmallNewWdg(title="Assign Pipeline", icon=CustomIconWdg.icons.get('PIPELINE'))
                pipe_button.add_behavior(get_scratch_pipe_behavior('twog/title', my.search_id, my.parent_sid,
                                                                   my.width, my.height,
                                                                   main_obj.get_value('pipeline_code'),
                                                                   main_obj.get_search_key(), 'TitleRow',
                                                                   '%s: %s' % (main_obj.get_value('title'),
                                                                               main_obj.get_value('episode')),
                                                                   my.order_sk))
                bottom_buttons.add_cell(pipe_button)

                request_pipeline_button = ButtonSmallNewWdg(title="Request a Pipeline",
                                                            icon=CustomIconWdg.icons.get('PROCESS'))
                request_pipeline_button.add_behavior(request_pipeline_behavior(my.sk))
                bottom_buttons.add_cell(request_pipeline_button)

            if my.is_master and (user_is_scheduler or 'onboarding' in my.groups_str):
                templer = ButtonSmallNewWdg(title="Template All", icon=CustomIconWdg.icons.get('TEMPLATE_DOWN'))
                templer.add_behavior(get_template_all_behavior(my.order_sk, my.code, my.is_master_str))
                tem = bottom_buttons.add_cell(templer)
                tem.add_attr('align', 'right')
                tem.add_style('cursor: pointer;')

            long_cell3 = table.add_cell(bottom_buttons)
            long_cell3.add_attr('align', 'right')
            long_cell3.add_attr('valign', 'bottom')
            long_cell3.add_attr('colspan', '3')
            long_cell3.add_style('width: 100%')

            sources = SourcesRow(title_code=my.code, title_sk=my.sk, order_sk=my.order_sk)
            src_row = table.add_row()
            src_row.add_attr('class', 'sources_row')
            src_cell = table.add_cell(sources)
            src_cell.add_attr('colspan', '6')
            src_cell.add_attr('class', 'sources_%s' % my.sk)
            src_cell.add_attr('order_sk', my.order_sk)

        if main_obj.get_value('is_external_rejection') == 'true':
            table.add_row()
            explanation_cell = table.add_cell('<u><b>External Rejection Reason:</b></u> %s' % main_obj.get('external_rejection_reason'))
            explanation_cell.add_attr('colspan', '5')

        bottom = Table()
        bottom.add_attr('width', '100%')
        bottom.add_attr('cellpadding', '0')
        bottom.add_attr('cellspacing', '0')
        for proj in projs:
            proj_sk = proj.get_search_key()
            proj_row = bottom.add_row()
            proj_row.add_attr('class', 'row_%s' % proj_sk)
            proj_obj = ProjRow(sk=proj_sk, parent_sk=my.sk, order_sk=my.order_sk, parent_sid=my.search_id,
                               groups_str=my.groups_str, user=my.user, display_mode=my.disp_mode,
                               is_master=my.is_master_str, main_obj=proj)
            proj_cell = bottom.add_cell(proj_obj)
            proj_cell.add_attr('width', '100%')
            proj_cell.add_attr('sk', proj_sk)
            proj_cell.add_attr('order_sk', my.order_sk)
            proj_cell.add_attr('parent_sk', my.sk)
            proj_cell.add_attr('parent_sid', my.search_id)
            proj_cell.add_attr('call_me', proj.get_value('process'))
            proj_cell.add_attr('my_class', 'ProjRow')
            proj_cell.add_attr('display_mode', my.disp_mode)
            proj_cell.add_attr('class', 'cell_%s' % proj_sk)
        tab2ret = Table()
        tab2ret.add_attr('width', '100%')
        top_row = tab2ret.add_row()
        top_row.add_attr('class', 'top_%s' % my.sk)
        tab2ret.add_cell(table)
        bot_row = tab2ret.add_row()
        bot_row.add_attr('class', 'bot_%s' % my.sk)
        if not open_bottom:
            bot_row.add_style('display: none;')
        else:
            bot_row.add_style('display: table-row;')
        bot = tab2ret.add_cell(bottom)
        bot.add_style('padding-left: 40px;')

        return tab2ret
Exemple #5
0
    def get_display(my):
        my.sk = str(my.kwargs.get('sk'))
        my.code = my.sk.split('code=')[1]
        my.parent_sk = str(my.kwargs.get('parent_sk'))
        my.order_sk = str(my.kwargs.get('order_sk'))
        order_code = my.order_sk.split('code=')[1]
        my.parent_sid = str(my.kwargs.get('parent_sid'))
        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)

        user_is_scheduler = False
        if 'scheduling' in my.groups_str or 'onboarding' in my.groups_str:
            user_is_scheduler = True

        if 'display_mode' in my.kwargs.keys():
            my.disp_mode = str(my.kwargs.get('display_mode'))
        if my.disp_mode == 'Small':
            my.small = True
        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:
            order_search = Search("twog/order")
            order_search.add_filter('code',order_code)
            order = order_search.get_sobject()
            order_classification = order.get_value('classification')
            if order_classification in ['master', 'Master']:
                my.is_master = True
                my.is_master_str = 'true'
        open_bottom = False
        if 'open_bottom' in my.kwargs.keys():
            ob_text = my.kwargs.get('open_bottom')
            if ob_text in [True, 'true', 't', '1', 1]:
                open_bottom = True

        main_obj = None
        if 'main_obj' in my.kwargs.keys():
            main_obj = my.kwargs.get('main_obj')
        else:
            main_search = Search("twog/proj")
            main_search.add_filter('code', my.code)
            main_obj = main_search.get_sobject()
        pipe_disp = main_obj.get_value('pipeline_code')
        if pipe_disp in [None, '', 'twog/proj', 'NOTHINGXsXNOTHING']:
            pipe_disp = "Not Assigned"
            tp_search = Search("twog/title")
            tp_search.add_filter('code', main_obj.get_value('title_code'))
            titl = tp_search.get_sobject()
            title_pipe = titl.get_value('pipeline_code')
            cp_search = Search("twog/client_pipes")
            cp_search.add_filter('process_name', main_obj.get_value('process'))
            cp_search.add_filter('pipeline_code', title_pipe)
            client_pipes = cp_search.get_sobjects()
            if len(client_pipes) > 0:
                client_pipe = client_pipes[0]
                my.server.update(main_obj.get_search_key(), {'pipeline_code': client_pipe.get_value('pipe_to_assign')})
                pipe_disp = client_pipe.get_value('pipe_to_assign')
        my.search_id = main_obj.get_value('id')
        due_date = ''
        task_search = Search("sthpw/task")
        task_search.add_filter('code', main_obj.get_value('task_code'))
        task = task_search.get_sobjects()
        task_sk = ''
        status = ''
        active_status = ''
        if len(task) > 0:
            due_date = task[0].get_value('bid_end_date')
            status = task[0].get_value('status')
            task_sk = task[0].get_search_key()
            active_bool = task[0].get_value('active')
            if active_bool in [True, 'true', 't', 1, '1']:
                active_status = '<font color="#0ff000">Active</font>'
            else:
                active_status = '<font color="#ff0000">Inactive</font>'
        wo_search = Search("twog/work_order")
        wo_search.add_filter('proj_code', my.code)
        wo_search.add_order_by('order_in_pipe')
        wos = wo_search.get_sobjects()
        table = Table()
        table.add_attr('class', 'ProjRow_%s' % my.code)
        table.add_attr('id', main_obj.get_value('code'))
        table.add_attr('cellpadding', '0')
        table.add_attr('cellspacing', '0')
        table.add_style('border-collapse', 'separate')
        table.add_style('border-spacing', '25px 0px')
        table.add_style('color: #1d216a;')
        table.add_style('background-color: %s;' % my.off_color)
        table.add_style('width', '100%')
        table.add_style('border-bottom-right-radius', '10px')
        table.add_style('border-bottom-left-radius', '10px')
        table.add_style('border-top-right-radius', '10px')
        table.add_style('border-top-left-radius', '10px')
        table.add_row()
        proj_cell = table.add_cell('<b><u>Project: %s</u></b>' % main_obj.get_value('process'))
        proj_cell.add_attr('nowrap','nowrap')
        proj_cell.add_style('cursor: pointer;')
        proj_cell.add_behavior(get_panel_change_behavior('twog/proj', my.code, my.sk, my.order_sk, my.title,
                                                         main_obj.get_value('proj_templ_code'),
                                                             'builder/refresh_from_save',
                                                         main_obj.get_value('task_code'),
                                                         my.parent_sk, main_obj.get_value('process'),
                                                         user_is_scheduler))
        stat_tbl = Table()
        stat_tbl.add_row()
        stat_cell = stat_tbl.add_cell('Status: %s' % status)
        stat_cell.add_attr('nowrap','nowrap')
        if status not in [None,'']:
            stat_cell.add_style('background-color: %s;' % my.stat_colors[status])
        s2 = stat_tbl.add_cell(' ')
        s2.add_attr('width', '100%')
        table.add_cell(stat_tbl)
        due_cell = table.add_cell('Due: %s' % fix_date(due_date).split(' ')[0])
        due_cell.add_attr('nowrap', 'nowrap')
        top_buttons = Table()
        top_buttons.add_row()
        if my.small:
            select_check = CustomCheckboxWdg(name='select_%s' % my.code, value_field=my.code, checked='false',
                                             dom_class='ob_selector', parent_table="ProjRow_%s" % my.code,
                                             normal_color=my.off_color, selected_color=my.on_color, code=my.code,
                                             ntype='proj', search_key=my.sk, task_sk=task_sk,
                                             additional_js=get_selected_color_behavior(my.code, 'ProjRow',
                                                                                       my.on_color, my.off_color))
            cb = top_buttons.add_cell(select_check)
        elif user_is_scheduler or 'onboarding' in my.groups_str:
            xb = top_buttons.add_cell(my.x_butt)
            xb.add_attr('align', 'right')
            xb.add_style('cursor: pointer;')
            xb.add_behavior(get_killer_behavior(my.sk, my.parent_sk, 'TitleRow', main_obj.get_value('process'),
                                                my.order_sk, my.is_master))
        long_cell1 = table.add_cell(top_buttons)
        long_cell1.add_attr('align', 'right')
        long_cell1.add_style('width', '100%')
        table.add_row()
        code_cell = table.add_cell('Code: %s' % my.code)
        active_cell = table.add_cell(active_status)
        active_cell.add_attr('align', 'right')
        active_cell.add_attr('colspan', '3')
        active_cell.add_style('width', '100%')
        table.add_row()

        title_fullname = main_obj.get_value('title')
        if main_obj.get_value('episode') not in [None,'']:
            title_fullname = '%s: %s' % (title_fullname, main_obj.get_value('episode'))

        pipe_cell = table.add_cell('Pipeline: %s&nbsp;&nbsp;&nbsp;&nbsp;Title: %s' % (pipe_disp, title_fullname))
        pipe_cell.add_attr('nowrap', 'nowrap')
        long_cell2 = table.add_cell('Priority: ')
        long_cell2.add_attr('align', 'right')
        long_cell2.add_style('width', '100%')
        prio_wdg = TextWdg('barcode_switcher')
        prio_wdg.add_attr('old_prio',main_obj.get_value('priority'))
        prio_wdg.set_value(main_obj.get_value('priority'))
        if user_is_scheduler:
            prio_wdg.add_behavior(get_alter_prio_behavior(main_obj.get_search_key()))
        else:
            prio_wdg.add_attr('disabled', 'disabled')
            prio_wdg.add_attr('readonly', 'readonly')
        long_cell21 = table.add_cell(prio_wdg)
        long_cell21.add_attr('align', 'left')
        long_cell21.add_style('width', '100%')
        if my.small:
            proj_cell.add_style('font-size: 8px;')
            stat_cell.add_style('font-size: 8px;')
            due_cell.add_style('font-size: 8px;')
            long_cell1.add_style('font-size: 8px;')
            code_cell.add_style('font-size: 8px;')
            pipe_cell.add_style('font-size: 8px;')
            long_cell2.add_style('font-size: 8px;')
            long_cell21.add_style('font-size: 8px;')
        else:
            bottom_buttons = Table()
            bottom_buttons.add_row()
            lynk = my.get_parent_context_file_link(my.parent_sid, main_obj.get_value('process'),
                                                   'twog/title?project=twog')
            bottom_buttons.add_cell(lynk)

            if not my.is_master:
                if main_obj.get_value('creation_type') == 'hackup': # and my.user in ['admin','philip.rowe']:
                    hack_edit = ButtonSmallNewWdg(title="Edit Connections", icon=CustomIconWdg.icons.get('HACKUP'))
                    hack_edit.add_behavior(get_edit_hackup_connections(my.code, main_obj.get_value('process')))
                    he = bottom_buttons.add_cell(hack_edit)
                    he.add_attr('align', 'right')
                    he.add_attr('valign', 'bottom')
                if user_is_scheduler:
                    adder = ButtonSmallNewWdg(title="Add A Work Order", icon=CustomIconWdg.icons.get('ADD'))
                    adder.add_behavior(get_multi_add_wos_behavior(my.sk, my.order_sk))
                    add = bottom_buttons.add_cell(adder)
                    add.add_attr('align', 'right')
                    priority = ButtonSmallNewWdg(title="Change Priority", icon=CustomIconWdg.icons.get('PRIORITY'))
                    priority.add_behavior(get_change_priority_behavior(main_obj.get_value('code'),
                                                                       main_obj.get_value('process'),
                                                                       my.order_sk,
                                                                       my.is_master_str))
                    prio = bottom_buttons.add_cell(priority)
                    prio.add_attr('align', 'right')
                    duedate = ButtonSmallNewWdg(title="Change Due Date", icon=CustomIconWdg.icons.get('CALENDAR'))
                    duedate.add_behavior(get_change_due_date_behavior(main_obj.get_value('code'),
                                                                      main_obj.get_value('process'),
                                                                      my.order_sk))
                    due = bottom_buttons.add_cell(duedate)
                    due.add_attr('align', 'right')

            upload = ButtonSmallNewWdg(title="Upload", icon=CustomIconWdg.icons.get('PUBLISH'))
            upload.add_behavior(get_upload_behavior(my.sk))
            up = bottom_buttons.add_cell(upload)
            up.add_attr('align', 'right')

            note_adder = ButtonSmallNewWdg(title="Add Note", icon=CustomIconWdg.icons.get('NOTE_ADD'))
            note_adder.add_behavior(get_launch_note_behavior(my.sk, main_obj.get_value('process')))
            nadd = bottom_buttons.add_cell(note_adder)
            nadd.add_attr('align', 'right')
            nadd.add_style('cursor: pointer;')

            if user_is_scheduler or 'onboarding' in my.groups_str:
                pipe_button = ButtonSmallNewWdg(title="Assign Pipeline", icon=CustomIconWdg.icons.get('PIPELINE'))
                pipe_button.add_behavior(get_scratch_pipe_behavior('twog/proj', my.search_id, my.parent_sid,
                                                                   my.width, my.height,
                                                                   main_obj.get_value('pipeline_code'),
                                                                   main_obj.get_search_key(), 'ProjRow',
                                                                   main_obj.get_value('process'), my.order_sk))
                scratch = bottom_buttons.add_cell(pipe_button)

            if my.is_master:
                if main_obj.get_value('templ_me') == True:
                    templ_icon = CustomIconWdg.icons.get('CHECK')
                else:
                    templ_icon = CustomIconWdg.icons.get('TEMPLATE')
                templ_button = ButtonSmallNewWdg(title="Template Me", icon=templ_icon)
                if main_obj.get_value('templ_me') == False:
                    templ_button.add_behavior(get_templ_proj_behavior(main_obj.get_value('templ_me'),
                                                                      main_obj.get_value('proj_templ_code'),
                                                                      main_obj.get_search_key(),
                                                                      my.order_sk))
                templ_butt = bottom_buttons.add_cell(templ_button)
                templ_butt.add_attr('class', 'templ_butt_%s' % my.sk)

            long_cell3 = table.add_cell(bottom_buttons)
            long_cell3.add_attr('align', 'right')
            long_cell3.add_attr('valign', 'bottom')
            long_cell3.add_style('width', '100%')
        bottom = Table()
        bottom.add_attr('width', '100%')
        bottom.add_attr('cellpadding', '0')
        bottom.add_attr('cellspacing', '0')
        for wo in wos:
            wo_sk = wo.get_search_key()
            wo_row = bottom.add_row()
            wo_row.add_attr('class', 'row_%s' % wo_sk)
            wo_obj = WorkOrderRow(sk=wo_sk, parent_sk=my.sk, order_sk=my.order_sk, parent_sid=my.search_id,
                                  groups_str=my.groups_str, user=my.user, display_mode=my.disp_mode,
                                  is_master=my.is_master_str, main_obj=wo, parent_obj=main_obj)
            wo_cell = bottom.add_cell(wo_obj)
            wo_cell.add_attr('width', '100%')
            wo_cell.add_attr('sk', wo_sk)
            wo_cell.add_attr('order_sk', my.order_sk)
            wo_cell.add_attr('parent_sk', my.sk)
            wo_cell.add_attr('parent_sid', my.search_id)
            wo_cell.add_attr('display_mode', my.disp_mode)
            wo_cell.add_attr('groups_str', my.groups_str)
            wo_cell.add_attr('user', my.user)
            wo_cell.add_attr('call_me', wo.get_value('process'))
            wo_cell.add_attr('my_class', 'WorkOrderRow')
            wo_cell.add_attr('class', 'cell_%s' % wo_sk)
        tab2ret = Table()
        top_row = tab2ret.add_row()
        top_row.add_attr('class', 'top_%s' % my.sk)
        tab2ret.add_attr('width', '100%')
        tab2ret.add_cell(table)
        bot_row = tab2ret.add_row()
        bot_row.add_attr('class', 'bot_%s' % my.sk)
        if not open_bottom:
            bot_row.add_style('display: none;')
        else:
            bot_row.add_style('display: table-row;')
        bot = tab2ret.add_cell(bottom)
        bot.add_style('padding-left: 40px;')

        return tab2ret
Exemple #6
0
    def get_display(my):
        my.work_order_sk = str(my.kwargs.get('work_order_sk'))
        my.work_order_code = str(my.kwargs.get('work_order_code'))
        my.client_code = str(my.kwargs.get('client_code'))
        my.order_sk = str(my.kwargs.get('order_sk'))
        order_code = my.order_sk.split('code=')[1]
        overhead = Table()
        overhead.add_attr('class', 'out_overhead_%s' % my.work_order_code)
        overhead.add_attr('client_code', my.client_code)

        wo_search = Search("twog/work_order")
        wo_search.add_filter('code', my.work_order_code)
        work_order = wo_search.get_sobject()
        delivs_search = Search("twog/work_order_deliverables")
        delivs_search.add_filter('work_order_code', my.work_order_code)
        delivs = delivs_search.get_sobjects()
        inter_search = Search("twog/work_order_intermediate")
        inter_search.add_filter('work_order_code', my.work_order_code)
        inters = inter_search.get_sobjects()

        user_group_names = Environment.get_group_names()
        groups_str = ''
        for mg in user_group_names:
            if groups_str == '':
                groups_str = mg
            else:
                groups_str = '%s,%s' % (groups_str, mg)
        user_is_scheduler = False
        if 'scheduling' in groups_str:
            user_is_scheduler = True

        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:
            order_search = Search("twog/order")
            order_search.add_filter('code',order_code)
            order = order_search.get_sobject()
            order_classification = order.get_value('classification')
            if order_classification in ['master','Master']:
                my.is_master = True
                my.is_master_str = 'true'
        table = Table()
        table.add_row()
        table.add_cell('<font size="4"><b><u>Intermediates</u></b></font>')
        add_inter = table.add_cell('<input type="button" value="Add Intermediate File"/>')
        add_inter.add_attr('nowrap','nowrap')
        add_inter.add_style('cursor: pointer;')
        add_inter.add_behavior(get_add_inter_behavior(my.work_order_code, my.client_code, my.is_master_str,
                                                      my.order_sk))
        inters_tbl = Table()
        for inter1 in inters:
            i_search = Search("twog/intermediate_file")
            i_search.add_filter('code',inter1.get_value('intermediate_file_code'))
            inter = i_search.get_sobject()
            inters_tbl.add_row()
            if user_is_scheduler:
                killer = inters_tbl.add_cell(my.x_butt)
                killer.add_style('cursor: pointer;')
                killer.add_behavior(get_intermediate_killer_behavior(inter1.get_value('code'), inter.get_value('title'),
                                                                     my.work_order_code, my.is_master_str, my.order_sk))
            alabel = inters_tbl.add_cell('Intermediate: ')
            alabel.add_attr('align','center')
            popper = inters_tbl.add_cell('<u>%s</u>' % inter.get_value('title'))
            popper.add_attr('nowrap','nowrap')
            popper.add_style('cursor: pointer;')
            popper.add_behavior(get_open_intermediate_behavior(inter.get_value('code'), my.work_order_code,
                                                               my.client_code, my.order_sk))

            if str(inter1.get_value('satisfied')) == 'True':
                check_val = 'true'
            else:
                check_val = 'false'
            checkbox = CustomCheckboxWdg(name='satisfied_%s' % inter.get_value('code'),
                                         value_field=inter.get_value('code'), checked=check_val,
                                         dom_class='inter_selector', code=inter.get_value('code'),
                                         additional_js=get_change_inter_satisfied_behavior(inter1.get_value('code'),
                                                                                           my.work_order_code,
                                                                                           my.client_code,
                                                                                           str(inter1.get_value('satisfied')),
                                                                                           my.order_sk))

            ck = inters_tbl.add_cell(checkbox)
            ck.add_attr('align','center')
            inters_tbl.add_cell(' &nbsp; ')
            if my.is_master:
                if inter.get_value('intermediate_file_templ_code') in [None,'']:
                    template_button = ButtonSmallNewWdg(title="Template This Intermediate File", icon=CustomIconWdg.icons.get('TEMPLATE'))
                    template_button.add_behavior(get_template_intermediate_behavior(inter.get_value('code'),
                                                                                    my.work_order_code, my.order_sk))
                else:
                    template_button = '<img border="0" style="vertical-align: middle" title="Templated" name="Templated" src="/context/icons/silk/tick.png">'
                tb = inters_tbl.add_cell(template_button)
                tb.add_class('inter_templ_%s' % inter.get_value('code'))
        table.add_row()
        intr = table.add_cell(inters_tbl)
        intr.add_attr('colspan','2')
        table.add_row()
        table.add_cell('<hr/>')
        table.add_row()
        table.add_cell('<font size="4"><b><u>Permanents</u></b></font>')
        add_delv = table.add_cell('<input type="button" value="Add Permanent Element"/>')
        add_delv.add_style('cursor: pointer;')
        add_delv.add_behavior(get_add_deliverable_behavior(my.work_order_code, my.client_code, my.order_sk))
        delv_tbl = Table()
        client_search = Search("twog/client")
        client_search.add_order_by('name desc')
        clients = client_search.get_sobjects()
        client_sel = '<select class="deliver_to_DELIV_CODE"><option value="">--Select--</option>'
        for client in clients:
            client_sel = '%s<option value="%s">%s</option>' % (client_sel, client.get_value('name'),
                                                               client.get_value('name'))
        client_sel = '%s</select>' % client_sel
        for deliv1 in delivs:
            d_search = Search("twog/source")
            d_search.add_filter('code',deliv1.get_value('deliverable_source_code'))
            deliv = d_search.get_sobject()
            deliv_name = '%s, Episode: %s, Type: %s' % (deliv.get_value('title'), deliv.get_value('episode'),
                                                        deliv.get_value('source_type'))
            delv_tbl.add_row()
            if user_is_scheduler:
                killer = delv_tbl.add_cell(my.x_butt)
                killer.add_style('cursor: pointer;')
                killer.add_behavior(get_deliverable_killer_behavior(deliv1.get_value('code'), my.work_order_code,
                                                                    deliv1.get_value('title_code'),
                                                                    deliv.get_value('code'),
                                                                    '%s (%s: %s)' % (deliv1.get_value('name'),
                                                                                     deliv.get_value('title'),
                                                                                     deliv.get_value('episode')),
                                                                    my.is_master_str, my.order_sk))
            alabel = delv_tbl.add_cell('Permanent: ')
            alabel.add_attr('align','center')
            popper = delv_tbl.add_cell('<u>%s</u>' % deliv.get_value('title'))
            popper.add_attr('nowrap','nowrap')
            popper.add_style('cursor: pointer;')
            popper.add_behavior(get_open_deliverable_behavior(deliv.get_value('code'), my.work_order_code,
                                                              deliv1.get_value('title_code'), my.client_code,
                                                              my.order_sk))

            if str(deliv1.get_value('satisfied')) == 'True':
                check_val = 'true'
            else:
                check_val = 'false'
            checkbox = CustomCheckboxWdg(name='satisfied_%s' % deliv.get_value('code'),
                                         value_field=deliv.get_value('code'), checked=check_val,
                                         dom_class='deliv_selector', code=deliv.get_value('code'),
                                         additional_js=get_change_deliverable_satisfied_behavior(deliv1.get_value('code'),
                                                                                                 my.work_order_code,
                                                                                                 deliv1.get_value('title_code'),
                                                                                                 str(deliv1.get_value('satisfied')),
                                                                                                 my.client_code,
                                                                                                 my.order_sk))

            ck = delv_tbl.add_cell(checkbox)
            ck.add_attr('align','center')
            delv_tbl.add_cell(' &nbsp; ')
            if my.is_master:
                if deliv.get_value('templ_code') in [None,'']:
                    template_button = ButtonSmallNewWdg(title="Template This Intermediate File",
                                                        icon=CustomIconWdg.icons.get('TEMPLATE'))
                    template_button.add_behavior(get_template_deliverable_behavior(deliv1.get_value('code'),
                                                                                   work_order.get_value('work_order_templ_code'),
                                                                                   deliv1.get_value('deliverable_source_code'),
                                                                                   my.work_order_code))
                else:
                    template_button = '<img border="0" style="vertical-align: middle" title="Templated" name="Templated" src="/context/icons/silk/tick.png">'
                tb = delv_tbl.add_cell(template_button)
                tb.add_class('deliverable_templ_%s' % deliv1.get_value('code'))
            bot_delv = Table()
            bot_delv.add_row()
            bot_delv.add_cell('Name: ')
            bot_delv.add_cell('<input type="text" class="deliv_name_%s" value="%s"/>' % (deliv1.get_value('code'), deliv1.get_value('name')))
            bot_delv.add_row()
            nw = bot_delv.add_cell('Deliver To: ')
            nw.add_attr('nowrap','nowrap')
            this_client_sel = client_sel.replace('DELIV_CODE',deliv1.get_value('code'))
            this_client_sel = this_client_sel.replace('value="%s"' % deliv1.get_value('deliver_to'), 'value="%s" selected="selected"' % deliv1.get_value('deliver_to'))
            bot_delv.add_cell(this_client_sel)
            bot_delv.add_row()
            bot_delv.add_cell('Attn: ')
            bot_delv.add_cell('<input type="text" class="deliv_attn_%s" value="%s"/>' % (deliv1.get_value('code'), deliv1.get_value('attn')))
            bot_delv.add_row()
            save_cell = bot_delv.add_cell('<input type="button" value="Save Permanent Element Info"/>')
            save_cell.add_behavior(get_save_deliv_info_behavior(deliv1.get_value('code'), my.work_order_code,
                                                                deliv1.get_value('title_code'), my.client_code,
                                                                my.is_master_str, my.order_sk))

            delv_tbl.add_row()
            bot = delv_tbl.add_cell(bot_delv)
            bot.add_attr('colspan','4')
        table.add_row()
        delv = table.add_cell(delv_tbl)
        delv.add_attr('colspan', '2')
        overhead.add_row()
        oh_cell = overhead.add_cell(table)
        oh_cell.add_attr('class','out_list_cell')
        return overhead
Exemple #7
0
    def get_display(my):
        my.sob_code = str(my.kwargs.get("sob_code"))
        my.sob_sk = str(my.kwargs.get("sob_sk"))
        my.sob_st = str(my.kwargs.get("sob_st"))
        my.sob_name = str(my.kwargs.get("sob_name"))
        my.pipeline = str(my.kwargs.get("pipeline"))
        my.order_sk = str(my.kwargs.get("order_sk"))
        order_code = my.order_sk.split("code=")[1]
        if "is_master" in my.kwargs.keys():
            my.is_master = my.kwargs.get("is_master")
        else:
            order_search = Search("twog/order")
            order_search.add_filter("code", order_code)
            order = order_search.get_sobject()
            order_classification = order.get_value("classification")
            if order_classification in ["master", "Master"]:
                my.is_master = True

        if my.sob_st == "twog/title":
            my.prereq_st = "twog/title_prereq"
            my.prereq_field = "title_code"
        elif my.sob_st == "twog/work_order":
            my.prereq_st = "twog/work_order_prereq"
            my.prereq_field = "work_order_code"

        user_group_names = Environment.get_group_names()
        groups_str = ""
        for mg in user_group_names:
            if groups_str == "":
                groups_str = mg
            else:
                groups_str = "%s,%s" % (groups_str, mg)
        user_is_scheduler = False
        if "scheduling" in groups_str:
            user_is_scheduler = True

        prereq_search = Search(my.prereq_st)
        prereq_search.add_filter(my.prereq_field, my.sob_code)
        prereqs = prereq_search.get_sobjects()
        overhead = Table()
        overhead.add_attr("class", "overhead_%s" % my.sob_code)
        table = Table()
        table.add_attr("class", "prereq_adder_%s" % my.sob_code)
        table.add_row()
        if my.sob_st == "twog/work_order" and user_is_scheduler:
            kill_title_pqs_btn = table.add_cell('<input type="button" value="Remove\nTitle PreReqs"/>')
            kill_title_pqs_btn.add_attr("colspan", "2")
            kill_title_pqs_btn.add_behavior(
                get_kill_wos_title_prereqs_behavior(my.sob_sk, my.order_sk, my.sob_name, my.pipeline)
            )
        else:
            table.add_cell(" ")
            table.add_cell(" ")
        table.add_cell(" ")
        table.add_cell(" ")
        sat = table.add_cell("Satisfied?")
        sat.add_attr("align", "center")
        table.add_cell(" ")
        for p in prereqs:
            table.add_row()
            if user_is_scheduler:
                killer = table.add_cell(my.x_butt)
                killer.add_style("cursor: pointer;")
                killer.add_behavior(
                    get_prereq_killer_behavior(
                        p.get_value("code"),
                        my.prereq_st,
                        my.sob_code,
                        my.sob_sk,
                        my.sob_st,
                        my.sob_name,
                        my.pipeline,
                        my.order_sk,
                    )
                )
            prereq_text = "PreReq: "
            if my.sob_st == "twog/work_order":
                if p.get_value("from_title") == True:
                    prereq_text = "Title PreReq: "
            alabel = table.add_cell(prereq_text)
            alabel.add_attr("align", "center")
            table.add_cell(
                '<input type="text" class="prereq_%s" value="%s" style="width: 500px;"/>'
                % (p.get_value("code"), p.get_value("prereq"))
            )
            save_butt = table.add_cell('<input type="button" class="save_%s" value="Save"/>' % (p.get_value("code")))
            save_butt.add_behavior(
                get_save_prereq_behavior(p.get_value("code"), my.prereq_st, my.sob_code, my.pipeline)
            )

            if p.get_value("satisfied") == True:
                check_val = "true"
            else:
                check_val = "false"
            checkbox = CustomCheckboxWdg(
                name="satisfied_%s" % p.get_value("code"),
                value_field=p.get_value("code"),
                checked=check_val,
                dom_class="prereq_selector",
                code=p.get_value("code"),
                additional_js=get_change_satisfied_behavior(
                    p.get_value("code"),
                    my.prereq_st,
                    my.sob_code,
                    p.get_value("satisfied"),
                    my.sob_sk,
                    my.sob_st,
                    my.sob_name,
                    my.pipeline,
                    my.order_sk,
                ),
            )

            ck = table.add_cell(checkbox)
            ck.add_attr("align", "center")
            if my.is_master:
                if my.sob_st == "twog/title":
                    table.add_cell(" &nbsp; ")
                    templ_search = Search("twog/pipeline_prereq")
                    templ_search.add_filter("pipeline_code", my.pipeline)
                    templ_search.add_filter("prereq", p.get_value("prereq"))
                    templ_rez = templ_search.get_sobjects()
                    templ_count = len(templ_rez)
                    if templ_count == 0:
                        template_button = ButtonSmallNewWdg(
                            title="Template This PreReq", icon=CustomIconWdg.icons.get("TEMPLATE")
                        )
                        if my.is_master and user_is_scheduler:
                            template_button.add_behavior(
                                get_template_prereq_behavior(
                                    my.sob_code, my.pipeline, my.prereq_st, p.get_value("code")
                                )
                            )
                    else:
                        template_button = '<img border="0" style="vertical-align: middle" title="Templated" name="Templated" src="/context/icons/silk/tick.png">'
                    tb = table.add_cell(template_button)
                    tb.add_class("prereq_templ_%s" % p.get_value("code"))
                elif my.sob_st == "twog/work_order":
                    table.add_cell(" &nbsp; ")
                    wot_search = Search("twog/work_order")
                    wot_search.add_filter("code", my.sob_code)
                    wot = wot_search.get_sobject()
                    work_order_templ_code = wot.get_value("work_order_templ_code")
                    templ_search = Search("twog/work_order_prereq_templ")
                    templ_search.add_filter("work_order_templ_code", work_order_templ_code)
                    templ_search.add_filter("prereq", p.get_value("prereq"))
                    templ_rez = templ_search.get_sobjects()
                    templ_count = len(templ_rez)
                    if templ_count == 0:
                        template_button = ButtonSmallNewWdg(
                            title="Template This PreReq", icon=CustomIconWdg.icons.get("TEMPLATE")
                        )
                        if my.is_master:
                            template_button.add_behavior(
                                get_template_wo_prereq_behavior(
                                    my.sob_code, my.prereq_st, p.get_value("code"), work_order_templ_code
                                )
                            )
                    else:
                        template_button = '<img border="0" style="vertical-align: middle" title="Templated" name="Templated" src="/context/icons/silk/tick.png">'
                    tb = table.add_cell(template_button)
                    tb.add_class("prereq_templ_%s" % p.get_value("code"))
        table.add_row()
        table.add_cell("<hr/>")
        table.add_row()
        table.add_cell(" &nbsp; ")
        if user_is_scheduler:
            label = table.add_cell("New PreReq: ")
            label.add_attr("nowrap", "nowrap")
            prereq_text_wdg = TextWdg("new_prereq")
            prereq_text_wdg.add_behavior(
                get_create_prereq_change_behavior(
                    my.sob_code, my.prereq_st, my.sob_sk, my.sob_st, my.sob_name, my.pipeline, my.order_sk
                )
            )
            table.add_cell(prereq_text_wdg)
            create_butt = table.add_cell('<input type="button" class="create_prereq" value="Create"/>')
            create_butt.add_behavior(
                get_create_prereq_behavior(
                    my.sob_code, my.prereq_st, my.sob_sk, my.sob_st, my.sob_name, my.pipeline, my.order_sk
                )
            )
        overhead.add_row()
        oh_cell = overhead.add_cell(table)
        oh_cell.add_attr("class", "prereq_adder_cell")

        return overhead
    def get_display(my):
        my.sk = str(my.kwargs.get('sk'))
        my.code = my.sk.split('code=')[1]
        my.parent_sk = str(my.kwargs.get('parent_sk'))
        my.parent_sid = str(my.kwargs.get('parent_sid'))
        my.order_sk = str(my.kwargs.get('order_sk'))
        order_code = my.order_sk.split('code=')[1]
        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,'']:
            group_search = Search("sthpw/login_in_group")
            group_search.add_filter('login',my.user)
            my_groups = group_search.get_sobjects()
            for mg in my_groups:
                if my.groups_str == '':
                    my.groups_str = mg.get_value('login_group')
                else:
                    my.groups_str = '%s,%s' % (my.groups_str, mg.get_value('login_group'))

        user_is_scheduler = False
        if 'scheduling' in my.groups_str or 'onboarding' in my.groups_str:
            user_is_scheduler = True

        if 'display_mode' in my.kwargs.keys():
            my.disp_mode = str(my.kwargs.get('display_mode'))
        if my.disp_mode == 'Small':
            my.small = True
        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:
            order_search = Search("twog/order")
            order_search.add_filter('code',order_code)
            order = order_search.get_sobject()
            order_classification = order.get_value('classification')
            if order_classification in ['master','Master']:
                my.is_master = True
                my.is_master_str = 'true'

        if 'main_obj' in my.kwargs.keys():
            main_obj = my.kwargs.get('main_obj')
        else:
            main_search = Search("twog/equipment_used")
            main_search.add_filter('code',my.code)
            main_obj = main_search.get_sobject()
        eq_length = main_obj.get_value('length')
        table = Table()
        table.add_attr('cellpadding','0')
        table.add_attr('cellspacing','0')
        table.add_attr('class','EquipmentUsedRow_%s' % my.code)
        table.add_style('background-color: %s;' % my.off_color)
        table.add_style('border-collapse', 'separate')
        table.add_style('border-spacing', '25px 3px')
        table.add_style('width: 100%s;' % '%')
        table.add_style('border-bottom-right-radius', '10px')
        table.add_style('border-bottom-left-radius', '10px')
        table.add_style('border-top-right-radius', '10px')
        table.add_style('border-top-left-radius', '10px')
        row1 = table.add_row()
        row1.add_attr('width','100%s' % '%')
        name_to_use = main_obj.get_value('name')
        if eq_length not in [None,'']:
            name_to_use = '%s: %s' % (name_to_use, eq_length)
        eu_cell = table.add_cell('<b><u>%s</u></b>' % name_to_use)
        eu_cell.add_attr('nowrap','nowrap')
        eu_cell.add_style('cursor: pointer;')
        eu_cell.add_behavior(get_panel_change_behavior('twog/equipment_used', my.code, my.sk, my.order_sk, my.title,
                                                       '', 'builder/refresh_from_save', '', my.parent_sk,
                                                       main_obj.get_value('name'), user_is_scheduler))
        top_buttons = Table()
        top_buttons.add_row()
        if my.is_master and not my.small:
            which_icon = CustomIconWdg.icons.get('TEMPLATE')
            which_title = 'Template This Equipment'
            if main_obj.get_value('equipment_used_templ_code') not in ['', None]:
                which_icon = CustomIconWdg.icons.get('CHECK')
                which_title = 'Un-Template This Equipment'
            button = ButtonSmallNewWdg(title=which_title, icon=which_icon)
            eq_templ_code = main_obj.get_value('equipment_used_templ_code')
            if not eq_templ_code:
                eq_templ_code = ''
            button.add_behavior(get_template_single_eu_behavior(my.order_sk, my.is_master_str, my.sk, eq_templ_code))
            top_buttons.add_cell(button)
        if my.small:
            select_check = CustomCheckboxWdg(name='select_%s' % my.code, value_field=my.code, checked='false', dom_class='ob_selector', parent_table="EquipmentUsedRow_%s" % my.code, normal_color=my.off_color, selected_color=my.on_color, code=my.code, ntype='equipment_used', search_key=my.sk, additional_js=get_selected_color_behavior(my.code, 'EquipmentUsedRow', my.on_color, my.off_color))
            cb = top_buttons.add_cell(select_check)
        elif user_is_scheduler:
            xb = top_buttons.add_cell(my.x_butt)
            xb.add_attr('align','right')
            xb.add_style('cursor: pointer;')
            xb.add_behavior(get_killer_behavior(my.sk, my.parent_sk, 'WorkOrderRow', main_obj.get_value('name'),
                                                my.order_sk, my.is_master))
        unit_cell = table.add_cell('UNITS: %s' % main_obj.get_value('units'))
        unit_cell.add_attr('nowrap','nowrap')
        unit_cell.add_style('font-size: 10px;')

        if eq_length in [None,'']:
            if main_obj.get_value('units') in ['gb','tb']:
                second_cell = table.add_cell('EST SIZE: %s' % main_obj.get_value('expected_duration'))
            else:
                second_cell = table.add_cell('EST DUR: %s' % main_obj.get_value('expected_duration'))
        else:
            second_cell = table.add_cell('LEN: %s' % eq_length)
        second_cell.add_style('font-size: 10px;')
        second_cell.add_attr('nowrap','nowrap')
        if main_obj.get_value('units') not in ['gb','tb']:
            third_cell = table.add_cell('QUANT: %s' % main_obj.get_value('expected_quantity'))
            third_cell.add_style('font-size: 10px;')
            third_cell.add_attr('nowrap','nowrap')
            if my.small:
                third_cell.add_style('font-size: 8px;')
            else:
                third_cell.add_style('font-size: 10px;')
        long_cell1 = table.add_cell(top_buttons)
        long_cell1.add_attr('colspan', '4')
        long_cell1.add_attr('align', 'right')
        long_cell1.add_style('width: 100%')
        if my.small:
            eu_cell.add_style('font-size: 8px;')
            unit_cell.add_style('font-size: 8px;')
            second_cell.add_style('font-size: 8px;')
            long_cell1.add_style('font-size: 8px;')
        else:
            eu_cell.add_style('font-size: 10px;')
            unit_cell.add_style('font-size: 10px;')
            second_cell.add_style('font-size: 10px;')
            long_cell1.add_style('font-size: 10px;')
        tab2ret = Table()
        tab2ret.add_attr('width', '100%')
        top_row = tab2ret.add_row()
        top_row.add_attr('class', 'top_%s' % my.sk)
        tab2ret.add_cell(table)

        return table
    def get_display(my):
        my.sk = str(my.kwargs.get('sk'))
        my.code = my.sk.split('code=')[1]
        my.parent_sk = str(my.kwargs.get('parent_sk'))
        my.parent_sid = str(my.kwargs.get('parent_sid'))
        my.order_sk = str(my.kwargs.get('order_sk'))
        order_code = my.order_sk.split('code=')[1]
        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)

        user_is_scheduler = False
        if 'scheduling' in my.groups_str or 'onboarding' in my.groups_str:
            user_is_scheduler = True

        if 'display_mode' in my.kwargs.keys():
            my.disp_mode = str(my.kwargs.get('display_mode'))
        if my.disp_mode == 'Small':
            my.small = True
        if 'is_master' in my.kwargs.keys():
            my.is_master_str = my.kwargs.get('is_master')
            if my.is_master_str in [True, 'true', 't', 1]:
                my.is_master = True
                my.is_master_str = 'true'
        else:
            order_search = Search("twog/order")
            order_search.add_filter('code',order_code)
            order = order_search.get_sobject()
            order_classification = order.get_value('classification')
            if order_classification in ['master', 'Master']:
                my.is_master = True
                my.is_master_str = 'false'
        open_bottom = False
        if 'open_bottom' in my.kwargs.keys():
            ob_text = my.kwargs.get('open_bottom')
            if ob_text in [True, 'true', 't', '1', 1]:
                open_bottom = True

        main_obj = None
        if 'main_obj' in my.kwargs.keys():
            main_obj = my.kwargs.get('main_obj')
        else:
            main_search = Search("twog/work_order")
            main_search.add_filter('code', my.code)
            main_obj = main_search.get_sobject()
        parent_obj = None
        if 'parent_obj' in my.kwargs.keys():
            parent_obj = my.kwargs.get('parent_obj')
        else:
            parent_search = Search("twog/proj")
            parent_search.add_filter('code',main_obj.get_value('proj_code'))
            parent_obj = parent_search.get_sobject()

        eu_search = Search("twog/equipment_used")
        eu_search.add_filter('work_order_code', my.code)
        eus = eu_search.get_sobjects()

        task_search = Search("sthpw/task")
        task_search.add_filter('code',main_obj.get_value('task_code'))
        task = task_search.get_sobjects()

        my.search_id = main_obj.get_value('id')
        due_date = ''
        start_date = ''
        end_date = ''
        status = ''
        assigned = ''
        priority = ''
        task_sk = ''
        active_bool = False
        active_status = ''
        task_exists = False
        if len(task) > 0:
            task = task[0]
            task_exists = True
            due_date = task.get_value('bid_end_date')
            start_date = task.get_value('actual_start_date')
            end_date = task.get_value('actual_end_date')
            status = task.get_value('status')
            assigned = task.get_value('assigned')
            priority = task.get_value('priority')
            task_sk = task.get_search_key()
            active_bool = task.get_value('active')
            if active_bool in [True, 'true', 't', 1, '1']:
                active_status = '<font color="#0ff000">Active</font>'
            else:
                active_status = '<font color="#ff0000">Inactive</font>'
        bgcol = my.off_color
        if main_obj.get_value('work_group') in [None,''] or main_obj.get_value('estimated_work_hours') in [None,'']:
            bgcol = '#FFFFFF'
        if assigned not in [None,'']:
            assigned_s = Search('sthpw/login')
            assigned_s.add_filter('location', 'internal')
            assigned_s.add_filter('login', assigned)
            assigned_o = assigned_s.get_sobject()
            assigned = ''
            if assigned_o:
                assigned = '%s %s' % (assigned_o.get_value('first_name'), assigned_o.get_value('last_name'))

        table = Table()
        table.add_attr('id', main_obj.get_value('code'))
        table.add_attr('cellpadding', '0')
        table.add_attr('cellspacing', '0')
        table.add_attr('class', 'WorkOrderRow_%s' % my.code)
        table.add_attr('width', '100%')
        table.add_style('border-collapse', 'separate')
        table.add_style('border-spacing', '25px 0px')
        table.add_style('color: #373a6a;')
        table.add_style('background-color: %s;' % bgcol)
        table.add_style('width', '100%')
        table.add_style('border-bottom-right-radius', '10px')
        table.add_style('border-bottom-left-radius', '10px')
        table.add_style('border-top-right-radius', '10px')
        table.add_style('border-top-left-radius', '10px')
        row1 = table.add_row()
        row1.add_attr('width', '100%')
        row1.add_style('width: 100%;')
        wo_cell = table.add_cell('<b><u>Work Order: %s</u></b>' % main_obj.get_value('process'))
        wo_cell.add_attr('nowrap', 'nowrap')
        wo_cell.add_style('cursor: pointer;')
        wo_cell.add_behavior(get_panel_change_behavior('twog/work_order', my.code, my.sk, my.order_sk, 'Work Order',
                                                       main_obj.get_value('work_order_templ_code'),
                                                       'builder/refresh_from_save', main_obj.get_value('task_code'),
                                                       my.parent_sk, main_obj.get_value('process'), user_is_scheduler))
        stat_cell = table.add_cell('Status: %s' % status)
        stat_cell.add_attr('nowrap', 'nowrap')
        if status not in [None,'']:
            stat_cell.add_style('background-color: %s;' % my.stat_colors[status])
        priority_cell = table.add_cell('Priority: %s' % priority)
        priority_cell.add_attr('nowrap', 'nowrap')
        assigned_cell = table.add_cell('Assigned to: %s' % assigned)
        assigned_cell.add_attr('nowrap', 'nowrap')
        due_cell = table.add_cell('Due: %s' % fix_date(due_date))
        due_cell.add_attr('nowrap', 'nowrap')
        top_buttons = Table()
        top_buttons.add_row()
        if my.small:
            select_check = CustomCheckboxWdg(name='select_%s' % my.code, value_field=my.code, checked='false',
                                             dom_class='ob_selector', parent_table="WorkOrderRow_%s" % my.code,
                                             process=main_obj.get_value('process'),
                                             work_group=main_obj.get_value('work_group'),
                                             proj_code=main_obj.get_value('proj_code'),
                                             title_code=main_obj.get_value('title_code'), order_code=order_code,
                                             task_code=main_obj.get_value('task_code'), normal_color=my.off_color,
                                             selected_color=my.on_color, code=my.code, ntype='work_order',
                                             search_key=my.sk, task_sk=task_sk,
                                             additional_js=get_selected_color_behavior(my.code, 'WorkOrderRow',
                                                                                       my.on_color, my.off_color))
            cb = top_buttons.add_cell(select_check)
        elif user_is_scheduler:
            xb = top_buttons.add_cell("<img src='/context/icons/common/BtnKill.gif' title='Delete' name='Delete'/>")
            xb.add_attr('align', 'right')
            xb.add_style('cursor: pointer;')
            xb.add_behavior(get_killer_behavior(my.sk, my.parent_sk, 'ProjRow', main_obj.get_value('process'),
                                                my.order_sk, my.is_master))
        long_cell1 = table.add_cell(top_buttons)
        long_cell1.add_attr('align', 'right')
        long_cell1.add_attr('colspan', '1')
        long_cell1.add_style('width: 100%')
        table.add_row()
        ccel = table.add_cell('Code: %s' % my.code)
        ccel.add_attr('nowrap', 'nowrap')
        start_cell = table.add_cell('Start: %s' % fix_date(start_date))
        start_cell.add_attr('nowrap', 'nowrap')
        end_cell = table.add_cell('End: %s' % fix_date(end_date))
        end_cell.add_attr('nowrap', 'nowrap')
        active_cell = table.add_cell(active_status)
        active_cell.add_attr('align', 'right')
        active_cell.add_attr('colspan', '3')
        active_cell.add_style("width: 100%;")
        if my.small:
            wo_cell.add_style('font-size: 8px;')
            stat_cell.add_style('font-size: 8px;')
            priority_cell.add_style('font-size: 8px;')
            assigned_cell.add_style('font-size: 8px;')
            due_cell.add_style('font-size: 8px;')
            long_cell1.add_style('font-size: 8px;')
            ccel.add_style('font-size: 8px;')
            start_cell.add_style('font-size: 8px;')
            end_cell.add_style('font-size: 8px;')
            active_cell.add_style('font-size: 8px;')
        else:
            table.add_row()
            bottom_buttons = Table()
            bottom_buttons.add_row()
            bbl = Table()
            bbl.add_row()
            ins = bbl.add_cell(main_obj.get_value('instructions').replace('<', '&lt;').replace('>', '&gt;'))
            ins.add_attr('align', 'left')
            ins.add_attr('colspan', '5')
            ins.add_attr('width', '100%')
            empt = bbl.add_cell(' ')
            empt.add_attr('width', '100%')
            bbr = Table()
            bbr.add_row()
            prereq_count = PreReqCountWdg(sob_code=my.code, sob_st='twog/work_order', sob_sk=my.sk,
                                          prereq_st='twog/work_order_prereq', sob_name=main_obj.get_value('process'),
                                          pipeline='nothing', order_sk=my.order_sk)
            prereq_launcher = bbr.add_cell(prereq_count)
            prereq_launcher.add_attr('class','prereq_count_%s' % my.code)
            prereq_launcher.add_attr('valign','bottom')
            prereq_launcher.add_attr('colspan','2')

            if main_obj.get_value('creation_type') == 'hackup' and user_is_scheduler:
                hack_edit = ButtonSmallNewWdg(title="Edit Connections", icon=CustomIconWdg.icons.get('HACKUP'))
                hack_edit.add_behavior(get_edit_hackup_connections(my.code, main_obj.get_value('process')))
                he = bbr.add_cell(hack_edit)
                he.add_attr('align','right')
                he.add_attr('valign','bottom')
            else:
                blah = bbr.add_cell('')

            if user_is_scheduler:
                error_edit = ButtonSmallNewWdg(title="Report Error", icon=CustomIconWdg.icons.get('REPORT_ERROR'))
                error_edit.add_behavior(get_add_wo_error_behavior(my.order_sk, my.user, my.code))
                uno = bbr.add_cell('&nbsp;')
                er = bbr.add_cell(error_edit)
                er.add_attr('align', 'right')
                er.add_attr('valign', 'bottom')
                er.add_attr('colspan', '3')
                er.add_attr('width', '100%')

            bbr.add_row()

            if not my.is_master and user_is_scheduler and task_exists:
                indie_button = IndieBigBoardSelectWdg(search_key=task.get_search_key(),
                                                      indie_bigboard=task.get_value('indie_bigboard'),
                                                      title_code=parent_obj.get_value('title_code'),
                                                      lookup_code=my.code)
                indie = bbr.add_cell(indie_button)
                indie.add_attr('align', 'right')
                indie.add_attr('valign', 'bottom')

                big_button = BigBoardSingleWOSelectWdg(search_key=task.get_search_key(),
                                                       bigboard=task.get_value('bigboard'),
                                                       title_code=parent_obj.get_value('title_code'),
                                                       lookup_code=my.code)
                bbw = bbr.add_cell(big_button)
                bbw.add_attr('align', 'right')
                bbw.add_attr('valign', 'bottom')

            print_button = WorkOrderPrintLauncherWdg(work_order_code=my.code)
            prnt = bbr.add_cell(print_button)
            prnt.add_attr('align', 'right')
            prnt.add_attr('valign', 'bottom')

            upload = ButtonSmallNewWdg(title="Upload", icon=CustomIconWdg.icons.get('PUBLISH'))
            upload.add_behavior(get_upload_behavior(my.sk))
            up = bbr.add_cell(upload)
            up.add_attr('align', 'right')
            up.add_attr('valign', 'bottom')

            note_adder = ButtonSmallNewWdg(title="Add Note", icon=CustomIconWdg.icons.get('NOTE_ADD'))
            note_adder.add_behavior(get_launch_note_behavior(my.parent_sk, parent_obj.get_value('process')))
            nadd = bbr.add_cell(note_adder)
            nadd.add_attr('align', 'right')
            nadd.add_attr('valign', 'bottom')
            nadd.add_style('cursor: pointer;')

            if user_is_scheduler:
                add_eq_used_butt = ButtonSmallNewWdg(title="Add Equipment",
                                                     icon=CustomIconWdg.icons.get('EQUIPMENT_ADD'))
                add_eq_used_butt.add_behavior(get_eu_add_behavior(main_obj.get_value('process'),
                                                                  main_obj.get_search_key(),
                                                                  main_obj.get_value('code'),
                                                                  my.order_sk))
                eu_adder = bbr.add_cell(add_eq_used_butt)
                eu_adder.add_attr('width','100%')
                eu_adder.add_attr('align', 'right')
                eu_adder.add_attr('valign', 'bottom')
                eu_adder.add_style('cursor: pointer;')

                source_portal = ButtonSmallNewWdg(title="Passed in Result(s) or Source(s)",
                                                  icon=CustomIconWdg.icons.get('SOURCE_PORTAL'))
                source_portal.add_behavior(get_launch_source_portal_behavior(main_obj.get_value('process'),
                                                                             main_obj.get_search_key(),
                                                                             main_obj.get_value('code'),
                                                                             parent_obj.get_value('pipeline_code'),
                                                                             my.is_master_str,
                                                                             my.order_sk))
                sp = bbr.add_cell(source_portal)
                sp.add_attr('align', 'right')
                sp.add_attr('valign', 'bottom')

                file_add = ButtonSmallNewWdg(title="Intermediate File(s) or Permanent Element(s)", icon=CustomIconWdg.icons.get('FILE_ADD'))
                file_add.add_behavior(get_launch_out_files_behavior(main_obj.get_value('process'),
                                                                    main_obj.get_search_key(),
                                                                    main_obj.get_value('code'),
                                                                    my.order_sk))
                fa = bbr.add_cell(file_add)
                fa.add_attr('align', 'right')
                fa.add_attr('valign', 'bottom')

            if my.is_master:
                if main_obj.get_value('templ_me') == True:
                    templ_icon = CustomIconWdg.icons.get('CHECK')
                    templ_title = "This is the Templating Work Order"
                else:
                    templ_icon = CustomIconWdg.icons.get('TEMPLATE')
                    templ_title = "Use This as Template for Parent Pipeline"
                templ_button = ButtonSmallNewWdg(title=templ_title, icon=templ_icon)
                if main_obj.get_value('templ_me') == False:
                    templ_button.add_behavior(get_templ_wo_behavior(main_obj.get_value('templ_me'),
                                                                    main_obj.get_value('work_order_templ_code'),
                                                                    main_obj.get_search_key(),
                                                                    my.order_sk))
                templ_butt = bbr.add_cell(templ_button)
                templ_butt.add_attr('class', 'templ_butt_%s' % my.sk)
                templ_butt.add_attr('width', '100%')
                templ_butt.add_attr('align', 'right')
                templ_butt.add_attr('valign', 'bottom')
            bl = bottom_buttons.add_cell(bbl)
            bl.add_attr('valign', 'bottom')
            bl.add_attr('align', 'left')
            bl.add_attr('width', '100%')
            br = bottom_buttons.add_cell(bbr)
            br.add_attr('valign', 'bottom')

            bbs = table.add_cell(bottom_buttons)
            bbs.add_attr('width', '100%')
            bbs.add_attr('align', 'left')
            bbs.add_attr('valign', 'bottom')

            if user_is_scheduler:
                src_row = table.add_row()
                src_row.add_attr('class', 'wo_sources_row')
                wos = WorkOrderSourcesRow(work_order_code=my.code, work_order_sk=my.sk, order_sk=my.order_sk)
                wos_cell = table.add_cell(wos)
                wos_cell.add_attr('colspan', '4')
                wos_cell.add_attr('class', 'wo_sources_%s' % my.sk)

        bottom = Table()
        bottom.add_attr('width', '100%')
        bottom.add_attr('cellpadding', '0')
        bottom.add_attr('cellspacing', '0')
        for eu in eus:
            eu_sk = eu.get_search_key()
            if eu.get_value('client_code') in [None,'']:
                my.server.update(eu_sk, {'client_code': main_obj.get_value('client_code')}, triggers=False)
            eu_row = bottom.add_row()
            eu_row.add_attr('class', 'EquipmentUsedRowRow row_%s' % eu_sk)
            eu_obj = EquipmentUsedRow(sk=eu_sk, parent_sk=my.sk, order_sk=my.order_sk, parent_sid=my.search_id,
                                      groups_str=my.groups_str, user=my.user, display_mode=my.disp_mode,
                                      is_master=my.is_master_str, main_obj=eu)
            eu_cell = bottom.add_cell(eu_obj)
            eu_cell.add_attr('width', '100%')
            eu_cell.add_attr('sk', eu_sk)
            eu_cell.add_attr('order_sk', my.order_sk)
            eu_cell.add_attr('parent_sk', my.sk)
            eu_cell.add_attr('parent_sid', my.search_id)
            eu_cell.add_attr('call_me', eu.get_value('name'))
            eu_cell.add_attr('wot_code', main_obj.get_value('work_order_templ_code'))
            eu_cell.add_attr('my_class', 'EquipmentUsedRow')
            eu_cell.add_attr('class', 'cell_%s' % eu_sk)
        tab2ret = Table()
        tab2ret.add_attr('width', '100%')
        top_row = tab2ret.add_row()
        top_row.add_attr('class', 'top_%s' % my.sk)
        tab2ret.add_cell(table)
        bot_row = tab2ret.add_row()
        if not open_bottom:
            bot_row.add_style('display: none;')
        else:
            bot_row.add_style('display: table-row;')
        bot_row.add_attr('class', 'bot_%s' % my.sk)
        bot = tab2ret.add_cell(bottom)
        bot.add_style('padding-left: 40px;')

        return tab2ret
    def get_display(my):
        import common_tools.utils as ctu
        from common_tools.copy_url_button import CopyUrlButton

        my.sk = str(my.kwargs.get('sk'))
        my.sid = str(my.kwargs.get('search_id'))
        allowed_search_titles = ''
        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)
        user_is_scheduler = False
        if 'scheduling' in my.groups_str or 'onboarding' in my.groups_str:
            user_is_scheduler = True
        if 'display_mode' in my.kwargs.keys():
            my.disp_mode = my.kwargs.get('display_mode')
        if my.disp_mode == 'Small':
            my.small = True
        my.code = my.sk.split('code=')[1]
        if 'allowed_titles' in my.kwargs.keys():
            my.allowed_titles_str = str(my.kwargs.get('allowed_titles'))
            split_allow = my.allowed_titles_str.split('|')
            for sa in split_allow:
                if allowed_search_titles == '':
                    allowed_search_titles = "('%s'" % sa
                else:
                    allowed_search_titles = "%s,'%s'" % (allowed_search_titles, sa)
            if allowed_search_titles != '':
                allowed_search_titles = '%s)' % allowed_search_titles
        if my.allowed_titles_str == '':
            my.allowed_titles_str = 'NOTHING|NOTHING'
        main_search = Search("twog/order")
        main_search.add_filter('code', my.code)
        main_obj = main_search.get_sobject()
        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:
            if main_obj.get_value('classification') in ['master', 'Master']:
                my.is_master = True
                my.is_master_str = 'true'
        sched_full_name = ''
        if main_obj.get_value('login') not in [None,'']:
            sched_s = Search('sthpw/login')
            sched_s.add_filter('location', 'internal')
            sched_s.add_filter('login', main_obj.get_value('login'))
            sched = sched_s.get_sobject()
            if sched:
                sched_full_name = '%s %s' % (sched.get_value('first_name'), sched.get_value('last_name'))

        sales_full_name = ''
        if main_obj.get_value('sales_rep') not in [None,'']:
            sales_s = Search('sthpw/login')
            sales_s.add_filter('location', 'internal')
            sales_s.add_filter('login', main_obj.get_value('sales_rep'))
            sales = sales_s.get_sobject()
            if sales:
                sales_full_name = '%s %s' % (sales.get_value('first_name'), sales.get_value('last_name'))

        title_search = Search("twog/title")
        title_search.add_filter('order_code', main_obj.get_value('code'))
        if allowed_search_titles != '':
            title_search.add_where("\"code\" in %s" % allowed_search_titles)
        titles = title_search.get_sobjects()
        table = Table()
        table.add_attr('I_AM', 'ORDER TABLE')
        if user_is_scheduler:
            table.add_attr('SOY', 'ORDER-O TABLE-O')

        table.add_attr('cellpadding', '0')
        table.add_attr('cellspacing', '0')
        table.add_style('border-collapse', 'separate')
        table.add_style('border-spacing', '25px 0px')
        table.add_style('color: #00033a;')
        table.add_style('background-color: #d9edf7;')
        table.add_style('width: 100%;')
        table.add_style('border-bottom-right-radius', '10px')
        table.add_style('border-bottom-left-radius', '10px')
        table.add_style('border-top-right-radius', '10px')
        table.add_style('border-top-left-radius', '10px')
        order_name_row = table.add_row()
        full_o_name = main_obj.get('name')
        if main_obj.get('details') not in [None,'']:
            full_o_name = '%s - %s' % (full_o_name, main_obj.get('details'))
        order_name_cell = table.add_cell('<b><u>Order: %s</u><b>' % full_o_name)
        order_name_cell.add_attr('nowrap','nowrap')
        order_name_cell.add_style('cursor: pointer;')
        order_name_cell.add_behavior(get_panel_change_behavior('twog/order', my.code, my.sk, my.sk, my.title, '',
                                                               'builder/refresh_from_save', '', my.sk,
                                                               main_obj.get_value('name'), user_is_scheduler))
        order_due_cell = table.add_cell("Due: %s" % fix_date(main_obj.get_value('due_date')).split(' ')[0])
        order_due_cell.add_attr('nowrap', 'nowrap')
        long_cell1 = table.add_cell('Scheduler: %s' % sched_full_name)
        long_cell1.add_style('width: 100%')
        order_sales_row = table.add_row()
        order_po_cell = table.add_cell("Code: %s &nbsp; &nbsp; PO Number: %s" % (my.code,
                                                                                 main_obj.get_value('po_number')))
        order_po_cell.add_attr('nowrap', 'nowrap')
        order_sales_cell = table.add_cell('Sales Rep: %s' % sales_full_name)
        order_sales_cell.add_attr('nowrap', 'nowrap')
        bottom_buttons = Table()
        bottom_buttons.add_row()

        order_builder_url = ctu.get_order_builder_url(my.code)
        copy_url_button = CopyUrlButton(title='Copy URL to Clipboard', url=order_builder_url)
        copy_url_cell = bottom_buttons.add_cell(copy_url_button)
        copy_url_cell.add_attr('align', 'right')

        instructions_button = FullInstructionsLauncherWdg(title='View Instructions', search_key=my.sk)
        instructions_cell = bottom_buttons.add_cell(instructions_button)
        instructions_cell.add_attr('align', 'right')

        if user_is_scheduler:
            tcloner = ButtonSmallNewWdg(title="Title Cloner", icon=CustomIconWdg.icons.get('STAR'))
            tcloner.add_behavior(get_launch_title_cloner_behavior(my.sk, main_obj.get_value('name'), my.user))
            dcl = bottom_buttons.add_cell(tcloner)
            dcl.add_attr('align', 'right')

            tchanger = ButtonSmallNewWdg(title="Title Changer", icon=CustomIconWdg.icons.get('CALENDAR'))
            tchanger.add_behavior(get_launch_title_changer_behavior(my.sk, main_obj.get_value('name'), my.user))
            dcal = bottom_buttons.add_cell(tchanger)
            dcal.add_attr('align', 'right')

            tdeletor = ButtonSmallNewWdg(title="Title Deletor", icon=CustomIconWdg.icons.get('TABLE_ROW_DELETE'))
            tdeletor.add_behavior(get_launch_title_deletor_behavior(my.sk, main_obj.get_value('name'), my.user))
            dfilt = bottom_buttons.add_cell(tdeletor)
            dfilt.add_attr('align', 'right')

        tfilter = ButtonSmallNewWdg(title="Filter Titles", icon=CustomIconWdg.icons.get('CONTENTS'))
        tfilter.add_behavior(get_launch_title_filter_behavior(my.sk, main_obj.get_value('name'), my.user))
        filt = bottom_buttons.add_cell(tfilter)
        filt.add_attr('align', 'right')

        upload = ButtonSmallNewWdg(title="Upload", icon=CustomIconWdg.icons.get('PUBLISH'))
        upload.add_behavior(get_upload_behavior(my.sk))
        up = bottom_buttons.add_cell(upload)
        up.add_attr('align', 'right')

        note_adder = ButtonSmallNewWdg(title="Add Note", icon=CustomIconWdg.icons.get('NOTE_ADD'))
        note_adder.add_behavior(get_launch_note_behavior(my.sk, main_obj.get_value('name')))
        nadd = bottom_buttons.add_cell(note_adder)
        nadd.add_attr('align', 'right')
        nadd.add_style('cursor: pointer;')

        if user_is_scheduler or 'onboarding' in my.groups_str:
            title_adder = ButtonSmallNewWdg(title="Add Titles", icon=CustomIconWdg.icons.get('INSERT_MULTI'))
            title_adder.add_behavior(get_title_add_behavior(my.sk, my.sid, main_obj.get_value('client_code'),
                                                            main_obj.get_value('name')))
            tadd = bottom_buttons.add_cell(title_adder)
            tadd.add_attr('align', 'right')
            tadd.add_style('cursor: pointer;')

        long_cell2 = table.add_cell(bottom_buttons)
        long_cell2.add_attr('align', 'right')
        long_cell2.add_attr('valign', 'bottom')
        long_cell2.add_style('width: 100%')
        bottom = Table()
        bottom.add_attr('width', '100%')
        bottom.add_attr('cellpadding', '0')
        bottom.add_attr('cellspacing', '0')
        for title in titles:
            title_sk = title.get_search_key()
            title_row = bottom.add_row()
            title_row.add_attr('width', '100%')
            title_row.add_attr('class', 'row_%s' % title_sk)
            title_obj = TitleRow(sk=title_sk, parent_sk=my.sk, parent_sid=my.sid, groups_str=my.groups_str,
                                 user=my.user, display_mode=my.disp_mode, is_master=my.is_master_str, main_obj=title)
            content_cell = bottom.add_cell(title_obj)
            content_cell.add_attr('width', '100%')
            content_cell.add_attr('sk', title_sk)
            content_cell.add_attr('order_sk', my.sk)
            content_cell.add_attr('parent_sk', my.sk)
            content_cell.add_attr('parent_sid', my.sid)
            content_cell.add_attr('call_me', title.get_value('title'))
            content_cell.add_attr('episode', title.get_value('episode'))
            content_cell.add_attr('my_class', 'TitleRow')
            content_cell.add_attr('client_code', title.get_value('client_code'))
            content_cell.add_attr('class', 'cell_%s' % title_sk)
        tab2ret = Table()
        tab2ret.add_attr('width', '100%')
        tab2ret.add_row()
        tab2ret.add_cell(table)
        tab2ret.add_row()
        bot = tab2ret.add_cell(bottom)
        bot.add_style('padding-left: 40px;')

        return tab2ret
    def get_display(my):
        from scraper import *
        my.order_sk = my.kwargs.get('order_sk')
        order_code = my.order_sk.split('code=')[1]
        my.groups_str = my.kwargs.get('groups_str')
        main_obj = 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'
        user_is_scheduler = False
        if 'scheduling' in my.groups_str or 'onboarding' in my.groups_str:
            user_is_scheduler = True
        if main_obj in [None, '']:
            server = TacticServerStub.get()
            main_obj = server.eval("@SOBJECT(twog/order['code','%s'])" % order_code)[0]
        table = Table()
        table.add_attr('cellspacing', '3')
        table.add_attr('cellpadding', '3')
        table.add_attr('height', '100%')
        table.add_attr('bgcolor', '#e4e6f0')
        table.add_style('border-bottom-right-radius', '10px')
        table.add_style('border-bottom-left-radius', '10px')
        table.add_style('border-top-right-radius', '10px')
        table.add_style('border-top-left-radius', '10px')

        # NEW START
        table.add_row()
        title = table.add_cell(' &nbsp;&nbsp;&nbsp;<i><b>2G Order Builder</b></i> ')
        title.add_attr('nowrap', 'nowrap')
        title.add_style('font-size: 120%;')
        selected_obj = table.add_cell('')
        selected_obj.add_attr('class', 'selected_sobject')
        selected_obj.add_attr('width', '100%')

        associator_launcher = OrderAssociatorLauncherWdg(code=order_code, search_on_load='false')
        associator = table.add_cell(associator_launcher)
        associator.add_attr('align', 'right')

        if main_obj.get('imdb_url') not in [None, '', 'none']:
            lnk = table.add_cell('<a href="%s" target="_blank">Link</a>' % main_obj.get('imdb_url'))
        else:
            lnk = table.add_cell("No Link")
        lnk.add_attr('align', 'left')
        lnk.add_attr('nowrap', 'nowrap')
        table.add_cell('&nbsp;&nbsp;&nbsp;&nbsp;')

        refresher = ButtonSmallNewWdg(title="Refresh", icon=CustomIconWdg.icons.get('REFRESH'))
        refresher.add_behavior(get_refresh_behavior(my.order_sk, my.user))
        refr = table.add_cell(refresher)
        refr.add_attr('align', 'right')

        checker_launcher = OrderCheckerLauncherWdg(order_code=order_code)
        checker = table.add_cell(checker_launcher)
        checker.add_attr('align', 'right')

        if user_is_scheduler:
            global_replacer = ButtonSmallNewWdg(title="Global Replacer", icon=CustomIconWdg.icons.get('DEPENDENCY'))
            global_replacer.add_behavior(get_global_replacer_wdg(my.order_sk, my.user))
            globalr = table.add_cell(global_replacer)
            globalr.add_attr('align', 'right')

            if my.small:
                normal_edit = ButtonSmallNewWdg(title="Normal Edit", icon=CustomIconWdg.icons.get('NORMAL_EDIT'))
                normal_edit.add_behavior(get_quick_edit_behavior(my.order_sk, my.user))
                normr = table.add_cell(normal_edit)
                normr.add_attr('align', 'right')
            else:
                quick_edit = ButtonSmallNewWdg(title="Quick Edit", icon=CustomIconWdg.icons.get('QUICK_EDIT'))
                quick_edit.add_behavior(get_quick_edit_behavior(my.order_sk, my.user))
                quickr = table.add_cell(quick_edit)
                quickr.add_attr('align', 'right')

            clear_cache = ButtonSmallNewWdg(title="Clear Cache", icon=CustomIconWdg.icons.get('TRASH'))
            clear_cache.add_behavior(get_clear_cache_behavior(my.order_sk, my.user))
            clearc = table.add_cell(clear_cache)
            clearc.add_attr('align', 'right')

            source_adder = ButtonSmallNewWdg(title="Create New Source", icon=CustomIconWdg.icons.get('SOURCE_ADD_TAPE'))
            source_adder.add_behavior(get_create_source_behavior(my.order_sk))
            sexa = table.add_cell(source_adder)
            sexa.add_attr('align', 'right')

        eq_exp = ButtonSmallNewWdg(title="Show Equipment", icon=CustomIconWdg.icons.get('ARROW_OUT_EQUIPMENT'))
        eq_exp.add_behavior(get_equipment_expander_behavior(my.order_sk))
        eqb = table.add_cell(eq_exp)
        eqb.add_attr('align', 'right')

        eq_coll = ButtonSmallNewWdg(title="Hide Equipment", icon=CustomIconWdg.icons.get('ARROW_UP_EQUIPMENT'))
        eq_coll.add_behavior(get_equipment_collapser_behavior(my.order_sk))
        eqlb = table.add_cell(eq_coll)
        eqlb.add_attr('align', 'right')

        source_exp = ButtonSmallNewWdg(title="Show Sources", icon=CustomIconWdg.icons.get('ARROW_OUT_SOURCE'))
        source_exp.add_behavior(get_source_expander_behavior(my.order_sk))
        sexb = table.add_cell(source_exp)
        sexb.add_attr('align', 'right')

        source_coll = ButtonSmallNewWdg(title="Hide Sources", icon=CustomIconWdg.icons.get('ARROW_UP_SOURCE'))
        source_coll.add_behavior(get_source_collapser_behavior(my.order_sk))
        sclb = table.add_cell(source_coll)
        sclb.add_attr('align', 'right')

        expander_button = ButtonSmallNewWdg(title="Expand All", icon=CustomIconWdg.icons.get('ARROW_OUT'))
        expander_button.add_behavior(get_expander_behavior(my.order_sk))
        exb = table.add_cell(expander_button)
        exb.add_attr('align', 'right')

        collapser_button = ButtonSmallNewWdg(title="Collapse All", icon=CustomIconWdg.icons.get('ARROW_UP_GREEN'))
        collapser_button.add_behavior(get_collapser_behavior(my.order_sk))
        clb = table.add_cell(collapser_button)
        clb.add_attr('align', 'right')

        space = table.add_cell(' ')
        space.add_attr('width', '100%')

        return table