def get_display(my):
        user_name = my.kwargs.get('user')
        code = my.kwargs.get('code')
        sk = my.kwargs.get('sk')

        t_search = Search("twog/title")
        t_search.add_filter('order_code',code)
        titles = t_search.get_sobjects()
        widget = DivWdg()
        table = Table()
        table.add_attr('cellpadding','10')
        table.add_attr('class','change_titles_selector')
        # Turn all checkboxes on or off
        toggle_behavior = {'css_class': 'clickme', 'type': 'click_up', 'cbjs_action': '''
                        try{
                            var checked_img = '<img src="%s"/>'
                            var not_checked_img = '<img src="%s"/>'
                            var top_el = spt.api.get_parent(bvr.src_el, '.change_titles_selector');
                            inputs = top_el.getElementsByClassName('change_title_selector');
                            var curr_val = bvr.src_el.getAttribute('checked');
                            image = '';
                            if(curr_val == 'false'){
                                curr_val = false;
                                image = not_checked_img;
                            }else if(curr_val == 'true'){
                                curr_val = true;
                                image = checked_img;
                            }
                            for(var r = 0; r < inputs.length; r++){
                                inputs[r].setAttribute('checked',curr_val);
                                inputs[r].innerHTML = image;
                            }
                }
                catch(err){
                          spt.app_busy.hide();
                          spt.alert(spt.exception.handler(err));
                }
        ''' % (my.checked, my.unchecked)}
        # No need for toggler if there are less than 2 titles
        if len(titles) > 1:
            toggler = CustomCheckboxWdg(name='chk_change_toggler',additional_js=toggle_behavior,value_field='toggler',id='selection_toggler',checked='false',checked_img=my.checked,unchecked_img=my.unchecked)

            table.add_row()
            cs = table.add_cell('<b>BigBoard Select/Deselect ALL -></b>')
            cs.add_attr('colspan','6')
            cs.add_attr('align','right')
            table.add_cell(toggler)
            dupe = CustomCheckboxWdg(name='duplicate_bigboard_wos',value_field='duplicate_bigboard_wos',id='duplicate_bigboard_wos',checked='false')
            cs2 = table.add_cell('<b>Work Order Bigboarding Duplication</b>')
            cs2.add_attr('align','right')
            table.add_cell(dupe)

        # display the column heads
        if len(titles) > 0:
            table.add_row()
            table.add_cell('<b>Code</b>')
            table.add_cell('<b>Name</b>')
            sd = table.add_cell('<b>Start Date</b>')
            sd.add_attr('nowrap','nowrap')
            dd = table.add_cell('<b>Due Date</b>')
            dd.add_attr('nowrap','nowrap')
            edd = table.add_cell('<b>Expected Delivery Date</b>')
            edd.add_attr('nowrap','nowrap')
            table.add_cell('<b>Priority</b>')
            table.add_cell('<b>BigBoard</b>')
        # Display the list of titles and values that can be changed
        for title in titles:
            table.add_row()
            tisk = title.get_search_key()
            tname = title.get_value('title')
            if title.get_value('episode') not in [None,'']:
                tname = '%s: %s' % (tname, title.get_value('episode'))

            cc = table.add_cell(title.get_code())

            name = table.add_cell(tname)
            name.add_attr('nowrap','nowrap')

            start = CalendarInputWdg('start_dateFORMRSK%s' % tisk)
            start.set_option('show_time', 'true')
            start.set_option('show_activator', 'true')
            start.set_option('display_format', 'MM/DD/YYYY HH:MM')
            start.set_option('time_input_default','5:00 PM')
            sd_fixed = fix_date(title.get_value('start_date'))
            if title.get_value('start_date') not in [None,'']:
                start.set_option('default', sd_fixed)

            due = CalendarInputWdg('due_dateFORMRSK%s' % tisk)
            due.set_option('show_time', 'true')
            due.set_option('show_activator', 'true')
            due.set_option('display_format', 'MM/DD/YYYY HH:MM')
            due.set_option('time_input_default','5:00 PM')
            dd_fixed = fix_date(title.get_value('due_date'))
            if title.get_value('due_date') not in [None,'']:
                due.set_option('default', dd_fixed)

            expected_delivery = CalendarInputWdg('expected_delivery_dateFORMRSK%s' % tisk)
            expected_delivery.set_option('show_time', 'true')
            expected_delivery.set_option('show_activator', 'true')
            expected_delivery.set_option('display_format', 'MM/DD/YYYY HH:MM')
            expected_delivery.set_option('time_input_default', '5:00 PM')
            ed_fixed = fix_date(title.get_value('expected_delivery_date'))
            if title.get_value('expected_delivery_date') not in [None,'']:
                expected_delivery.set_option('default', ed_fixed)

            d1 = table.add_cell(start)
            d1.add_attr('valign', 'top')
            d2 = table.add_cell(due)
            d2.add_attr('valign', 'top')
            d3 = table.add_cell(expected_delivery)
            d3.add_attr('valign', 'top')

            pr = table.add_cell('<input type="text" value="%s" current_val="%s" name="priorityFORMRSK%s" class="priority"/>' % (title.get_value('priority'), title.get_value('priority'), title.get_search_key()))
            pr.add_attr('valign', 'top')

            check_val = 'false'
            if title.get_value('bigboard') in [True,'1','t','true','yes','Yes']:
                check_val = 'true'
            else:
                check_val = 'false'
            # Want to remove all Checkboxes from Order Builder, since they query the database and make everything a little slower
            checkbox = CustomCheckboxWdg(name='bigboard_title_%s' % tisk,alert_name=tname,value_field=title.get_code(),checked=check_val,dom_class='change_title_selector',checked_img=my.checked,unchecked_img=my.unchecked)
            ck = table.add_cell(checkbox)
            ck.add_attr('valign','top')

        if len(titles) < 1:
            table.add_row()
            table.add_cell('There are no titles in this Order')

        table.add_row()
        go_butt = ''
        if len(titles) > 0:
            nada = table.add_cell(' ')
            nada.add_attr('colspan','6')
            go_butt = table.add_cell('<input type="button" class="change_titles" value="Apply Changes"/>')
            go_butt.add_attr('sk',sk)
            go_butt.add_attr('search_type','twog/order')
            go_butt.add_attr('user',user_name)
            behavior = {'css_class': 'clickme', 'type': 'click_up', 'cbjs_action': '''
                            function oc(a){
                                var o = {};
                                for(var i=0;i<a.length;i++){
                                    o[a[i]]='';
                                }
                                return o;
                            }
                            try{
                              var my_sk = '%s';
                              var my_user = '******';
                              var my_code = my_sk.split('code=')[1];
                              var class_name = 'nighttime_hotlist.nighttime_hotlist.BigBoardWOSelectWdg';
                              if(confirm("Do You Really Want To Change These Title Values?")){
                                  var server = TacticServerStub.get();
                                  var top_el = spt.api.get_parent(bvr.src_el, '.change_titles_selector');
                                  proceed = true;
                                  titles_to_bb = [];
                                  titles_to_unbb = [];
                                  title_names = [];
                                  title_changes = {};
                                  tca = [];
                                  if(proceed){
                                      var inputs = top_el.getElementsByTagName('input');
                                      for(var r = 0; r < inputs.length; r++){
                                          if(inputs[r].name != 'chk_change_toggler' && inputs[r].type != 'button'){
                                              //get the name of the field and the value, save for the update
                                              name = inputs[r].getAttribute('name');
                                              current_val = inputs[r].getAttribute('current_val');
                                              type = name.split('FORMRSK')[0];
                                              sk = name.split('FORMRSK')[1];
                                              value = inputs[r].value;
                                              if(value == null){
                                                  value = '';
                                              }
                                              if(value != current_val){
                                                  //Create a dict (array) of the title values if not already there
                                                  //If it already exitst, just add to the entry
                                                  if(!(sk in oc(tca))){
                                                      tca.push(sk)
                                                      title_changes[sk] = {}
                                                  }else{
                                                      title_changes[sk][type] = value;
                                                  }
                                                  inputs[r].setAttribute('current_val',value);
                                              }
                                          }
                                      }
                                      checks = top_el.getElementsByClassName('change_title_selector');
                                      for(var r = 0; r < checks.length; r++){
                                          //see which titles will be bigboarded, and which ones will not
                                          title_code = checks[r].getAttribute('value_field');
                                          if(checks[r].getAttribute('checked') == 'true'){
                                              title_name = checks[r].getAttribute('alert_name');
                                              titles_to_bb.push(title_code)
                                              title_names.push(title_name);
                                          }else{
                                              titles_to_unbb.push(title_code)
                                          }
                                      }
                                      duplicate_bigboard_wos_el = top_el.getElementById('duplicate_bigboard_wos');
                                      duplicate_bigboard_wos = duplicate_bigboard_wos_el.getAttribute('checked');
                                      if(duplicate_bigboard_wos == 'true'){
                                          class_name = 'nighttime_hotlist.nighttime_hotlist2.BigBoardWOSelect4MultiTitlesWdg2';
                                      }
                                      //Submit the changes
                                      for(var r= 0; r < tca.length; r++){
                                          server.update(tca[r], title_changes[tca[r]]);
                                      }
                                      apply_to_all = false;
                                      copy_title_code = '';
                                      copy_names = [];
                                      copy_names_str = '';
                                      copy_names_no = [];
                                      copy_names_no_str = '';
                                      //Make sure the titles that shouldn't be bigboarded now (per user's selection), are not bigboarded
                                      for(var r = 0; r < titles_to_unbb.length; r++){
                                          server.update(server.build_search_key('twog/title', titles_to_unbb[r]), {'bigboard': 'false'});
                                      }
                                      if(duplicate_bigboard_wos != 'true'){
                                          //If the Title is going to be bigboarded, load the list of work orders per title to select for the bigboard
                                          for(var r = 0; r < titles_to_bb.length; r++){
                                              this_title_code = titles_to_bb[r];
                                              this_title_sk = server.build_search_key('twog/title',this_title_code);
                                              server.update(this_title_sk, {'bigboard': 'true'});
                                              if(!apply_to_all){
                                                  kwargs = {
                                                      'sk': this_title_sk
                                                  };
                                                  spt.panel.load_popup('Select Big Board Work Orders for ' + title_names[r], class_name, kwargs);
                                              }else{
                                                  //This section looks stupid and needs to be fixed
                                                  if(copy_names.length == 0){
                                                      tasks_w_bb = server.eval("@SOBJECT(sthpw/task['title_code','" + copy_title_code + "']['bigboard','True'])");
                                                      for(var x = 0; x < tasks_w_bb.length; x++){
                                                          copy_names.push(tasks_w_bb[x].process);
                                                          if(copy_names_str == ''){
                                                              copy_names_str = tasks_w_bb[x].process;
                                                          }else{
                                                              copy_names_str = copy_names_str + '|' + tasks_w_bb[x].process;
                                                          }
                                                      }
                                                      tasks_wo_bb = server.eval("@SOBJECT(sthpw/task['title_code','" + copy_title_code + "']['bigboard','not in','True'])");
                                                      for(var x = 0; x < tasks_wo_bb.length; x++){
                                                          copy_names_no.push(tasks_wo_bb[x].process);
                                                          if(copy_names_no_str == ''){
                                                              copy_names_no_str = tasks_wo_bb[x].process;
                                                          }else{
                                                              copy_names_no_str = copy_names_no_str + '|' + tasks_wo_bb[x].process;
                                                          }
                                                      }

                                                  }
                                                  //This will update all of the tasks to be bigboarded, if in copy names str
                                                  this_tt = server.eval("@SOBJECT(sthpw/task['title_code','" + this_title_code + "']['search_type','twog/proj?project=twog']['process','" + copy_names_str + "'])");
                                                  for(var w = 0; w < this_tt.length; w++){
                                                      server.update(this_tt[w].__search_key__, {'bigboard': 'true'});
                                                  }
                                                  //This will update all of the tasks to be un-bigboarded, if in copy_names_no_str
                                                  this_tt = server.eval("@SOBJECT(sthpw/task['title_code','" + this_title_code + "']['search_type','twog/proj?project=twog']['process','" + copy_names_no_str + "'])");
                                                  for(var w = 0; w < this_tt.length; w++){
                                                      server.update(this_tt[w].__search_key__, {'bigboard': 'false'});
                                                  }
                                              }
                                          }
                                      }else{
                                          title_codes = titles_to_bb.join();
                                          if(title_codes != '' && title_codes != ','){
                                              kwargs = {
                                                  'title_codes': title_codes
                                              };
                                              spt.panel.load_popup('Select Big Board Work Orders for the Selected Titles', class_name, kwargs);
                                          }
                                      }
                                      spt.popup.close(spt.popup.get_popup(bvr.src_el));
                                  }
                              }
                    }
                    catch(err){
                              spt.app_busy.hide();
                              spt.alert(spt.exception.handler(err));
                              //alert(err);
                    }
             ''' % (sk, user_name)}
            go_butt.add_behavior(behavior)
        widget.add(table)
        return widget
    def get_display(self):
        pyclass_dict = {
            'twog/title': 'TitleRow',
            'twog/order': 'OrderTable',
            'twog/proj': 'ProjRow',
            'twog/work_order': 'WorkOrderRow',
            'twog/equipment_used': 'EquipmentUsedRow'
        }

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

        if 'scheduling' in groups_str:
            user_is_scheduler = True
        else:
            user_is_scheduler = False

        table = Table()
        table.add_attr('class', 'task_table')
        table.add_attr('width', '100%')
        if self.task_code in ['', None]:
            table.add_row()
            table.add_cell('')
        else:
            self.parent_pyclass = pyclass_dict[self.parent_sk.split('?')[0]]
            table.add_style('background-color: 90a0b5;')
            task_search = Search("sthpw/task")
            task_search.add_filter('code', self.task_code)
            tasks_found = task_search.get_sobjects()
            if len(tasks_found) > 0:
                task = tasks_found[0]
                hours_search = Search('sthpw/work_hour')
                hours_search.add_filter('task_code', task.get_code())
                hours = hours_search.get_sobjects()
                hours_added = 0
                for hour in hours:
                    hour_num = hour.get_value('straight_time')
                    if hour_num in [None, '']:
                        hour_num = 0
                    hour_num = float(hour_num)
                    hours_added = float(hours_added) + hour_num
                pipe_code = task.get_value('pipeline_code')
                if 'task' not in pipe_code:
                    pipe_code = 'task'
                task_select = self.get_statuses_select_from_task_pipe(task.get_value('status'),
                                                                      pipe_code,
                                                                      'sthpw/pipeline',
                                                                      task.get_search_key(),
                                                                      user_is_scheduler)
                worker_select = self.get_assigned_select(task.get_value('assigned'))
                group_select = self.get_assigned_group_select(task.get_value('assigned_login_group'))
                table.add_row()
                top = table.add_cell('<b>Assignment Information<b>')
                top.add_attr('colspan', '4')
                top.add_attr('align', 'center')
                top.add_style('background-color: #6789b7;')
                table.add_row()
                table.add_cell('Status: ')
                table.add_cell(task_select)
                table.add_cell('Assigned: ')
                table.add_cell(worker_select)
                table.add_row()
                table.add_cell('Hours Added:')
                table.add_cell(hours_added)
                table.add_cell('Add Hours:')
                table.add_cell('<input type="text" class="hour_adder" value=""/>')
                table.add_row()
                table.add_cell('Priority: ')
                table.add_cell('<input type="text" class="priority_setter" value="%s"/>' % task.get_value('priority'))
                table.add_cell('Assigned Group: ')
                table.add_cell(group_select)
                bid_start = CalendarInputWdg(name='task_bid_start')  # 4.2
                bid_start.set_option('show_time', 'true')
                bid_start.set_option('show_activator', 'true')
                bid_start.set_option('display_format', 'MM/DD/YYYY HH:MM')
                bid_start.set_option('time_input_default', '5:00 PM')
                if task.get_value('bid_start_date') not in ['', None]:
                    bid_start.set_option('default', fix_date(task.get_value('bid_start_date')))
                bid_end = CalendarInputWdg(name='task_bid_end')  # 4.2
                bid_end.set_option('show_time', 'true')
                bid_end.set_option('show_activator', 'true')
                bid_end.set_option('display_format', 'MM/DD/YYYY HH:MM')
                bid_end.set_option('time_input_default', '5:00 PM')
                if task.get_value('bid_end_date') not in ['', None]:
                    bid_end.set_option('default', fix_date(task.get_value('bid_end_date')))
                table.add_row()
                bs = table.add_cell('Bid Start: ')
                bs.add_attr('nowrap', 'nowrap')
                table.add_cell(bid_start)
                be = table.add_cell('Due Date: ')
                be.add_attr('nowrap', 'nowrap')
                table.add_cell(bid_end)
                table.add_row()
                acs = table.add_cell('Actual Start: ')
                acs.add_attr('nowrap', 'nowrap')
                acsv = fix_date(task.get_value('actual_start_date'))
                if acsv in ['', None]:
                    acsv = 'Has not begun'
                table.add_cell(acsv)
                ace = table.add_cell('Actual End: ')
                acev = fix_date(task.get_value('actual_end_date'))
                if acev in ['', None]:
                    acev = 'Has not ended'
                ace.add_attr('nowrap', 'nowrap')
                table.add_cell(acev)
                table.add_row()

                doubl = table.add_cell('<input type="button" value="Save"/>')
                doubl.add_attr('colspan', '4')
                doubl.add_attr('align', 'center')
                doubl.add_behavior(get_save_task_info_behavior(task.get_search_key(), self.parent_sk,
                                                               self.parent_pyclass, self.order_sk, 'false', self.user))
            else:
                table.add_row()
                table.add_cell('')

        return table
Beispiel #3
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
Beispiel #4
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
Beispiel #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.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
Beispiel #6
0
    def get_display(my):
        login = Environment.get_login()
        this_user = login.get_login()
        groups = Environment.get_group_names()
        my.get_stub()
        show_save = False
        for g in groups:
            if 'qc' in g or 'edeliveries' in g:
                show_save = True
        if this_user == 'admin':
            show_save = True
        this_timestamp = str(datetime.datetime.now()).split('.')[0]
        code = my.kwargs.get('code')
        original_code = code

        widget = DivWdg()

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

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

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

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

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

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

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

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

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

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

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

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

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

        dtbl.add_cell(d2tbl)

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

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


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

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

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

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

        widget.add(table)

        return widget
    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):
        my.client_code = str(my.kwargs.get('client_code'))
        my.order_sk = str(my.kwargs.get('order_sk'))
        my.order_sid = str(my.kwargs.get('order_sid'))
        order_code = my.order_sk.split('code=')[1]
        order_search = Search("twog/order")
        order_search.add_filter('code',order_code)
        the_order = order_search.get_sobject()

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        return table