示例#1
0
def get_due_date_widget(outer_div):
    due_date_wdg = CalendarInputWdg('Due Date')
    due_date_wdg.add_class('due_date')
    due_date_wdg.set_name('due_date')

    outer_div.add(get_label_widget('Due Date'))
    outer_div.add(due_date_wdg)
def get_date_calendar_wdg():
    date_calendar_wdg = CalendarInputWdg("due_date")
    date_calendar_wdg.set_option('show_activator', 'true')
    date_calendar_wdg.set_option('show_time', 'false')
    date_calendar_wdg.set_option('width', '300px')
    date_calendar_wdg.set_option('id', 'due_date')
    date_calendar_wdg.set_option('display_format', 'MM/DD/YYYY')

    return date_calendar_wdg
示例#3
0
def get_datetime_calendar_wdg():
    """
    Get a CalendarInputWdg that displays the time.

    :return: CalendarInputWdg
    """
    date_calendar_wdg = CalendarInputWdg("datetime_calendar")
    date_calendar_wdg.set_option('show_activator', 'true')
    date_calendar_wdg.set_option('show_time', 'true')
    date_calendar_wdg.set_option('width', '300px')
    date_calendar_wdg.set_option('id', 'datetime_calendar')

    return date_calendar_wdg
def get_datetime_calendar_wdg():
    """
    Get a CalendarInputWdg that displays the time.

    :return: CalendarInputWdg
    """
    date_calendar_wdg = CalendarInputWdg("datetime_calendar")
    date_calendar_wdg.set_option('show_activator', 'true')
    date_calendar_wdg.set_option('show_time', 'true')
    date_calendar_wdg.set_option('width', '300px')
    date_calendar_wdg.set_option('id', 'datetime_calendar')

    return date_calendar_wdg
示例#5
0
def get_due_date_time_widget(outer_div):
    due_date_wdg = CalendarInputWdg('due_date')
    due_date_wdg.set_option('show_time', True)
    due_date_wdg.add_class('due_date')
    due_date_wdg.set_name('due_date')

    outer_div.add(get_label_widget('Due Date'))
    outer_div.add(due_date_wdg)
示例#6
0
    def get_display(self):
        div_wdg = DivWdg()
        div_wdg.set_id('change-order-expected-completion-date')

        calendar_wdg = CalendarInputWdg(
            name='change-expected-completion-date-calendar', width='120px')
        time_wdg = TimeInputWdg(name='change-expected-completion-date-time')

        div_wdg.add(get_label_widget('Date'))
        div_wdg.add(calendar_wdg)
        div_wdg.add(get_label_widget('Time'))
        div_wdg.add(time_wdg)

        submit_button = SubmitWdg('Submit')
        submit_button.add_behavior(self.submit_button_behavior())
        div_wdg.add(submit_button)

        return div_wdg
示例#7
0
    def get_date_calendar_wdg(self):
        date_calendar_wdg = CalendarInputWdg("date")
        date_calendar_wdg.set_option('show_activator', 'true')
        date_calendar_wdg.set_option('show_time', 'false')
        date_calendar_wdg.set_option('width', '300px')
        date_calendar_wdg.set_option('id', 'date')
        date_calendar_wdg.set_option('display_format', 'MM/DD/YYYY')

        try:
            date = self.date
            date_calendar_wdg.set_value(date)
        except AttributeError:
            pass

        return date_calendar_wdg
    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
示例#9
0
    def get_display(my):
        table = Table()

        tbl_id = "manual_proj_adder_top_%s" % my.order_sk

        table.add_attr("id", tbl_id)
        table.add_attr("search_type", "twog/proj")
        table.add_attr("order_sk", my.order_sk)
        table.add_attr("parent_sk", my.parent_sk)
        table.add_attr("title_code", my.title_code)
        table.add_attr("user_name", Environment.get_user_name())

        ctbl = Table()
        ctbl.add_row()
        c1 = ctbl.add_cell("Project Names (Comma Delimited)")
        c1.add_attr("nowrap", "nowrap")
        ctbl.add_row()
        ctbl.add_cell('<textarea cols="100" rows="5" id="comma_names" order_sk="%s"></textarea>' % my.order_sk)

        table.add_row()
        table.add_cell(ctbl)
        table.add_row()
        mid = table.add_cell("-- OR --")
        mid.add_attr("align", "center")

        ntbl = Table()
        ntbl.add_row()
        ntbl.add_cell("Name: ")
        ntbl.add_cell('<input type="text" id="primary_name" style="width: 200px;"/>')
        n1 = ntbl.add_cell(" &nbsp;From Number: ")
        n1.add_attr("nowrap", "nowrap")
        ntbl.add_cell('<input type="text" id="from_number" style="width: 50px;"/>')
        n2 = ntbl.add_cell(" &nbsp;To Number: ")
        n2.add_attr("nowrap", "nowrap")
        ntbl.add_cell('<input type="text" id="to_number" style="width: 50px;"/>')

        table.add_row()
        table.add_cell(ntbl)

        ptbl = Table()

        start_date = CalendarInputWdg("start_date")
        start_date.set_option("show_time", "true")
        start_date.set_option("show_activator", "true")
        start_date.set_option("display_format", "MM/DD/YYYY HH:MM")
        start_date.set_option("time_input_default", "5:00 PM")
        ptbl.add_row()
        ptbl.add_cell("Start Date: ")
        ptbl.add_cell(start_date)

        due_date = CalendarInputWdg("due_date")
        due_date.set_option("show_time", "true")
        due_date.set_option("show_activator", "true")
        due_date.set_option("display_format", "MM/DD/YYYY HH:MM")
        due_date.set_option("time_input_default", "5:00 PM")
        ptbl.add_row()
        ptbl.add_cell("Due Date: ")
        ptbl.add_cell(due_date)

        btbl = Table()
        etbl = Table()

        platform_search = Search("twog/platform")
        platform_search.add_order_by("name desc")
        platforms = platform_search.get_sobjects()
        plat_sel = SelectWdg("platform")
        plat_sel.add_attr("id", "platform")
        plat_sel.append_option("--Select--", "")
        for p in platforms:
            plat_sel.append_option(p.get_value("name"), p.get_value("name"))
        ptbl.add_row()
        ptbl.add_cell("Priority: ")
        ptbl.add_cell('<input type="text" id="priority" style="width: 50px;"/>')
        ptbl.add_row()
        ptbl.add_cell("Platform: ")
        ptbl.add_cell(plat_sel)
        proj_search = Search("twog/proj")
        proj_search.add_filter("title_code", my.parent_code)
        proj_search.add_order_by("order_in_pipe")
        projs = proj_search.get_sobjects()
        btbl.add_row()
        p1 = btbl.add_cell("<u>First Proj Comes After</u>")
        p1.add_attr("nowrap", "nowrap")
        p2 = btbl.add_cell("<u>Last Proj Leads To</u>")
        p2.add_attr("nowrap", "nowrap")
        fromtbl = Table()
        for p in projs:
            fromtbl.add_row()

            checker = CustomCheckboxWdg(
                name="from_check",
                value_field=p.get_value("code"),
                id=p.get_value("code"),
                checked="false",
                dom_class="from_check",
                code=p.get_value("code"),
            )

            fromtbl.add_cell(checker)
            fromtbl.add_cell("%s (%s)" % (p.get_value("process"), p.get_value("code")))
        totbl = Table()
        for p in projs:
            totbl.add_row()

            checker = CustomCheckboxWdg(
                name="to_check",
                value_field=p.get_value("code"),
                checked="false",
                id=p.get_value("code"),
                dom_class="to_check",
                code=p.get_value("code"),
            )

            totbl.add_cell(checker)
            totbl.add_cell("%s (%s)" % (p.get_value("process"), p.get_value("code")))
        btbl.add_row()
        btbl.add_cell(fromtbl)
        btbl.add_cell(totbl)

        table.add_row()
        table.add_cell(ptbl)
        table.add_row()
        table.add_cell(btbl)
        table.add_row()
        table.add_cell(etbl)
        table.add_row()

        stbl = Table()
        stbl.add_row()
        s1 = stbl.add_cell("&nbsp;")
        s1.add_attr("width", "40%")
        saction = stbl.add_cell('<input type="button" value="Create Projects"/>')
        saction.add_behavior(my.get_save())
        s2 = stbl.add_cell("&nbsp;")
        s2.add_attr("width", "40%")

        ss = table.add_cell(stbl)
        ss.add_attr("colspan", "2")
        ss.add_attr("align", "center")

        widget = DivWdg()
        widget.add(table)
        return widget
    def get_date_calendar_wdg(self):
        date_calendar_wdg = CalendarInputWdg("date")
        date_calendar_wdg.set_option('show_activator', 'true')
        date_calendar_wdg.set_option('show_time', 'false')
        date_calendar_wdg.set_option('width', '300px')
        date_calendar_wdg.set_option('id', 'date')
        date_calendar_wdg.set_option('display_format', 'MM/DD/YYYY')

        try:
            date = self.date
            date_calendar_wdg.set_value(date)
        except AttributeError:
            pass

        return date_calendar_wdg
示例#11
0
    def get_display(self):


        from tactic.ui.report import MMSUtility
        import datetime
        date = datetime.datetime.now()
        start_wday, end_wday =  MMSUtility.get_week_range(date)

        self.prefix = 'week'
        top = DivWdg()
        top.add_class("spt_table_search")
        self.set_as_panel(top)

        from tactic.ui.container import RoundedCornerDivWdg
        inner = RoundedCornerDivWdg(corner_size=10, hex_color_code='949494')
        inner.set_dimensions(width_str="95%", content_height_str='95%', height_str="100%")
        inner.add_style("margin: 20px")
        top.add(inner)


        hidden = HiddenWdg("prefix", self.prefix)
        top.add(hidden)



        filter_data = FilterData.get()
        values = filter_data.get_values_by_index("week", 0)
        date_string = values.get("calendar")
        if not date_string:
            date_string = WebContainer.get_web().get_form_value("calendar")

        if date_string:
            date = parser.parse(date_string)
        else:
            date = datetime.datetime.now()

        week = 1


        table = Table()
        table.add_style("color: black")
        table.add_style("width: 600px")
        table.add_row()
        inner.add(table)


        #inner.add("Range: %s - %s<br/><br/>" % (start_wday, end_wday))


        table.add_cell("Week Of Date: <br/>")
        calendar = CalendarInputWdg('calendar')

        day_cbk = '''
        var top = spt.get_parent(bvr.src_el, '.spt_table_search');
        var week_el = top.getElement('.spt_calendar_week');
        var input_el = top.getElement('.spt_calendar_input');
        var value = input_el.value;
        var week = spt.date_util.ymd.get_week( value )
        week_el.innerHTML = week + '';
        '''
        calendar.add_day_cbk(day_cbk)


        #calendar.set_option("first_day_of_week", 4)
        calendar.set_value(date.strftime("%Y-%m-%d"))
        # TODO: set default
        table.add_cell( calendar )

        week = int(date.strftime("%W")) + 1

        table.add_cell("Week: ")
        #select = SelectWdg("week")
        #select.add_class("action inputfield")
        #select.set_option("values", range(1,53) )
        #select.set_value(week)
        #select.set_option( "size", "2" )
        text = DivWdg()
        text.add_class("spt_calendar_week")
        text.add_style("width", "25px")
        text.add(week)
        table.add_cell(text)

        table.add_cell( self.get_search_wdg() )

        return top
示例#12
0
    def get_display(my):
        widget = DivWdg()
        table = Table()
        table.add_attr('class','client_deliverable_wdg')
        table.add_row()
        table2 = Table()
        table2.add_style('border-spacing: 5px;')
        table2.add_style('border-collapse: separate;')
        table2.add_row()

        c1 = table2.add_cell('Order Code:')
        c1.add_attr('nowrap','nowrap')
        tb1 = TextWdg('order_code')
        tb1.add_attr('id','order_code')
        tb1.add_attr('disabled','disabled')
        tb1.set_value(my.sob['order_code'])
        table2.add_cell(tb1)

        c1 = table2.add_cell('PO Number:')
        c1.add_attr('nowrap','nowrap')
        tb1 = TextWdg('po_number')
        tb1.add_attr('id','po_number')
        tb1.add_attr('disabled','disabled')
        tb1.set_value(my.sob['po_number'])
        table2.add_cell(tb1)

        c1 = table2.add_cell('Title Code:')
        c1.add_attr('nowrap','nowrap')
        tb1 = TextWdg('title_code')
        tb1.add_attr('id','title_code')
        tb1.add_attr('disabled','disabled')
        tb1.set_value(my.sob['title_code'])
        table2.add_cell(tb1)

        c1 = table2.add_cell('Platform:')
        c1.add_attr('nowrap','nowrap')
        tb1 = TextWdg('platform')
        tb1.add_attr('id','platform')
        tb1.add_attr('disabled','disabled')
        tb1.set_value(my.sob['platform'])
        table2.add_cell(tb1)

        c1 = table2.add_cell('Client:')
        c1.add_attr('nowrap','nowrap')
        tb1 = TextWdg('client_name')
        tb1.add_attr('id','client_name')
        tb1.add_attr('disabled','disabled')
        tb1.set_value(my.sob['client_name'])
        table2.add_cell(tb1)

        table2.add_row()
        table2.add_cell(table2.hr())
        table2.add_row()

        c1 = table2.add_cell('Title Source(s):')
        c1.add_attr('nowrap','nowrap')
        tb1 = TextWdg('original_source_code')
        tb1.add_attr('id','original_source_code')
        tb1.add_attr('disabled','disabled')
        tb1.add_style('width','200px')
        tb1.set_value(my.sob['original_source_code'])
        c2 = table2.add_cell(tb1)
        c2.add_attr('colspan','2')

        c1 = table2.add_cell('Title Source Barcodes(s):')
        c1.add_attr('nowrap','nowrap')
        tb1 = TextWdg('original_source_barcode')
        tb1.add_attr('id','original_source_barcode')
        tb1.add_attr('disabled','disabled')
        tb1.add_style('width','200px')
        tb1.set_value(my.sob['original_source_barcode'])
        c2 = table2.add_cell(tb1)
        c2.add_attr('colspan','2')

        c1 = table2.add_cell('Ancestors:')
        c1.add_attr('nowrap','nowrap')
        tb1 = TextWdg('ancestors')
        tb1.add_attr('id','ancestors')
        tb1.add_attr('disabled','disabled')
        tb1.add_style('width','300px')
        tb1.set_value(my.sob['ancestors'])
        c2 = table2.add_cell(tb1)
        c2.add_attr('colspan','3')

        table2.add_row()
        table2.add_cell(table2.hr())
        table2.add_row()

        c1 = table2.add_cell('Destination:')
        c1.add_attr('nowrap','nowrap')
        destination_sel = SelectWdg('destination')
        destination_sel.add_attr('id','destination')
        destination_sel.append_option('--Select--','')
        for c in my.all_clients:
            destination_sel.append_option(c.get('name'),c.get('name'))
        if my.sob.get('destination') == None:
            my.sob['destination'] = ''
        destination_sel.set_value(my.sob.get('destination'))
        table2.add_cell(destination_sel)


        if my.sob.get('record_id') in [None,'']:
            next_id_sob = my.server.eval("@SOBJECT(twog/global_resource['name','sony_next_unique_id'])")[0]
            next_id = int(next_id_sob.get('description'))
            my.sob['record_id'] = next_id
            my.server.update(next_id_sob.get('__search_key__'), {'description': next_id + 1}, triggers=False)
        c1 = table2.add_cell('Record ID:')
        c1.add_attr('nowrap','nowrap')
        tb1 = TextWdg('record_id')
        tb1.add_attr('id','record_id')
        tb1.set_value(my.sob['record_id'])
        table2.add_cell(tb1)

        c1 = table2.add_cell('Alpha ID:')
        c1.add_attr('nowrap','nowrap')
        tb1 = TextWdg('alpha_id')
        tb1.add_attr('id','alpha_id')
        tb1.set_value(my.sob['alpha_id'])
        table2.add_cell(tb1)

        c1 = table2.add_cell('Client Barcode:')
        c1.add_attr('nowrap','nowrap')
        tb1 = TextWdg('client_barcode')
        tb1.add_attr('id','client_barcode')
        tb1.set_value(my.sob['client_barcode'])
        table2.add_cell(tb1)

        c1 = table2.add_cell('Release Number:')
        c1.add_attr('nowrap','nowrap')
        tb1 = TextWdg('release_number')
        tb1.add_attr('id','release_number')
        tb1.set_value(my.sob['release_number'])
        table2.add_cell(tb1)

        table2.add_row()

        c1 = table2.add_cell('Title ID:')
        c1.add_attr('nowrap','nowrap')
        tb1 = TextWdg('title_id')
        tb1.add_attr('id','title_id')
        tb1.set_value(my.sob['title_id'])
        table2.add_cell(tb1)

        c1 = table2.add_cell('Title Name:')
        c1.add_attr('nowrap','nowrap')
        tb1 = TextWdg('title_name')
        tb1.add_attr('id','title_name')
        tb1.set_value(my.sob['title_name'])
        table2.add_cell(tb1)

        c1 = table2.add_cell('Title Type:')
        c1.add_attr('nowrap','nowrap')
        title_type_sel = SelectWdg('title_type')
        title_type_sel.add_attr('id','title_type')
        title_type_sel.append_option('--Select--','')
        for type in my.title_types:
            title_type_sel.append_option(type,type)
        if my.sob.get('title_type') == None:
            my.sob['title_type'] = ''
        title_type_sel.set_value(my.sob.get('title_type'))
        table2.add_cell(title_type_sel)

        c1 = table2.add_cell('Title Comment:')
        c1.add_attr('nowrap','nowrap')
        tb1 = TextWdg('title_comment')
        tb1.add_attr('id','title_comment')
        tb1.add_style('width','300px')
        tb1.set_value(my.sob['title_comment'])
        c2 = table2.add_cell(tb1)
        c2.add_attr('colspan','3')

        table2.add_row()

        c1 = table2.add_cell('Clip Id:')
        c1.add_attr('nowrap','nowrap')
        tb1 = TextWdg('clip_id')
        tb1.add_attr('id','clip_id')
        tb1.set_value(my.sob['clip_id'])
        table2.add_cell(tb1)

        table2.add_row()
        table2.add_cell(table2.hr())
        table2.add_row()

        c1 = table2.add_cell('Trailer Number:')
        c1.add_attr('nowrap','nowrap')
        trailer_number_sel = SelectWdg('trailer_number')
        trailer_number_sel.add_attr('id','trailer_number')
        trailer_number_sel.append_option('--Select--','')
        for number in my.trailer_numbers:
            trailer_number_sel.append_option(number,number)
        if my.sob.get('trailer_number') == None:
            my.sob['trailer_number'] = ''
        trailer_number_sel.set_value(my.sob.get('trailer_number'))
        table2.add_cell(trailer_number_sel)

        c1 = table2.add_cell('Trailer Rev Number:')
        c1.add_attr('nowrap','nowrap')
        tb1 = TextWdg('trailer_rev_number')
        tb1.add_attr('id','trailer_rev_number')
        tb1.set_value(my.sob['trailer_rev_number'])
        table2.add_cell(tb1)

        c1 = table2.add_cell('Trailer Type:')
        c1.add_attr('nowrap','nowrap')
        trailer_type_sel = SelectWdg('trailer_type')
        trailer_type_sel.add_attr('id','trailer_type')
        trailer_type_sel.append_option('--Select--','')
        for type in my.trailer_types:
            trailer_type_sel.append_option(type,type)
        if my.sob.get('trailer_type') == None:
            my.sob['trailer_type'] = ''
        trailer_type_sel.set_value(my.sob.get('trailer_type'))
        table2.add_cell(trailer_type_sel)

        c1 = table2.add_cell('Trailer Version:')
        c1.add_attr('nowrap','nowrap')
        trailer_version_sel = SelectWdg('trailer_version')
        trailer_version_sel.add_attr('id','trailer_version')
        trailer_version_sel.append_option('--Select--','')
        for version in my.trailer_versions:
            trailer_version_sel.append_option(version,version)
        if my.sob.get('trailer_version') == None:
            my.sob['trailer_version'] = ''
        trailer_version_sel.set_value(my.sob.get('trailer_version'))
        table2.add_cell(trailer_version_sel)

        table2.add_row()
        table2.add_cell(table2.hr())
        table2.add_row()

        c1 = table2.add_cell('Language Audio:')
        c1.add_attr('nowrap','nowrap')
        language_audio_sel = SelectWdg('language_audio')
        language_audio_sel.append_option('--Select--','')
        for language in my.audio_languages:
            language_audio_sel.append_option(language,language)
        if my.sob.get('language_audio') == None:
            my.sob['language_audio'] = ''
        language_audio_sel.set_value(my.sob.get('language_audio'))
        table2.add_cell(language_audio_sel)

        c1 = table2.add_cell('Language Subtitled:')
        c1.add_attr('nowrap','nowrap')
        language_subtitled_sel = SelectWdg('language_subtitled')
        language_subtitled_sel.add_attr('id','language_subtitled')
        language_subtitled_sel.append_option('--Select--','')
        for language in my.subtitle_languages:
            language_subtitled_sel.append_option(language,language)
        if my.sob.get('language_subtitled') == None:
            my.sob['language_subtitled'] = ''
        language_subtitled_sel.set_value(my.sob.get('language_subtitled'))
        table2.add_cell(language_subtitled_sel)

        c1 = table2.add_cell('Language Text:')
        c1.add_attr('nowrap','nowrap')
        language_text_sel = SelectWdg('language_text')
        language_text_sel.add_attr('id','language_text')
        language_text_sel.append_option('--Select--','')
        for language in my.text_languages:
            language_text_sel.append_option(language,language)
        if my.sob.get('language_text') == None:
            my.sob['language_text'] = ''
        language_text_sel.set_value(my.sob.get('language_text'))
        table2.add_cell(language_text_sel)

        c1 = table2.add_cell('Original Language:')
        c1.add_attr('nowrap','nowrap')
        original_language_sel = SelectWdg('original_language')
        original_language_sel.add_attr('id','original_language')
        original_language_sel.append_option('--Select--','')
        for language in my.original_languages:
            original_language_sel.append_option(language,language)
        if my.sob.get('original_language') == None:
            my.sob['original_language'] = ''
        original_language_sel.set_value(my.sob.get('original_language'))
        table2.add_cell(original_language_sel)

        table2.add_row()
        table2.add_cell(table2.hr())
        table2.add_row()

        c1 = table2.add_cell('Source:')
        c1.add_attr('nowrap','nowrap')
        source_sel = SelectWdg('source')
        source_sel.add_attr('id','source')
        source_sel.append_option('--Select--','')
        for s in my.sources:
            source_sel.append_option(s,s)
        if my.sob.get('source') == None:
            my.sob['source'] = ''
        source_sel.set_value(my.sob.get('source'))
        table2.add_cell(source_sel)

        c1 = table2.add_cell('Audio Config:')
        c1.add_attr('nowrap','nowrap')
        audio_config_sel = SelectWdg('audio_config')
        audio_config_sel.add_attr('id','audio_config')
        audio_config_sel.append_option('--Select--','')
        for a in my.audio_configs:
            audio_config_sel.append_option(a,a)
        if my.sob.get('audio_config') == None:
            my.sob['audio_config'] = ''
        audio_config_sel.set_value(my.sob.get('audio_config'))
        table2.add_cell(audio_config_sel)

        c1 = table2.add_cell('Master Audio Config:')
        c1.add_attr('nowrap','nowrap')
        master_audio_config_sel = SelectWdg('master_audio_config')
        master_audio_config_sel.add_attr('id','master_audio_config')
        master_audio_config_sel.append_option('--Select--','')
        for a in my.audio_configs:
            master_audio_config_sel.append_option(a,a)
        if my.sob.get('master_audio_config') == None:
            my.sob['master_audio_config'] = ''
        master_audio_config_sel.set_value(my.sob.get('master_audio_config'))
        table2.add_cell(master_audio_config_sel)
         
        c1 = table2.add_cell('Run Time Calc:')
        c1.add_attr('nowrap','nowrap')
        tb1 = TextWdg('run_time_calc')
        tb1.add_attr('id','run_time_calc')
        tb1.set_value(my.sob['run_time_calc'])
        #Might want to add the : timestamp js here -- from qc reports
        table2.add_cell(tb1)
   
        table2.add_row()
        table2.add_cell(table2.hr())
        table2.add_row()

        c1 = table2.add_cell('Narrative:')
        c1.add_attr('nowrap','nowrap')
        narrative_sel = SelectWdg('narrative')
        narrative_sel.add_attr('id','narrative')
        narrative_sel.append_option('--Select--','')
        for n in my.narratives:
            narrative_sel.append_option(n,n)
        if my.sob.get('narrative') == None:
            my.sob['narrative'] = ''
        narrative_sel.set_value(my.sob.get('narrative'))
        table2.add_cell(narrative_sel)

        c1 = table2.add_cell('Texted/Textless:')
        c1.add_attr('nowrap','nowrap')
        tt_sel = SelectWdg('texted_textless')
        tt_sel.add_attr('id','texted_textless')
        tt_sel.append_option('--Select--','')
        for t in my.texted_textless:
            tt_sel.append_option(t,t)
        if my.sob.get('texted_textless') == None:
            my.sob['texted_textless'] = ''
        tt_sel.set_value(my.sob.get('texted_textless'))
        table2.add_cell(tt_sel)

        c1 = table2.add_cell('Aspect Ratio:')
        c1.add_attr('nowrap','nowrap')
        aspect_ratio_sel = SelectWdg('aspect_ratio')
        aspect_ratio_sel.add_attr('id','aspect_ratio')
        aspect_ratio_sel.append_option('--Select--','')
        for a in my.aspect_ratios:
            aspect_ratio_sel.append_option(a,a)
        if my.sob.get('aspect_ratio') == None:
            my.sob['aspect_ratio'] = ''
        aspect_ratio_sel.set_value(my.sob.get('aspect_ratio'))
        table2.add_cell(aspect_ratio_sel)

        c1 = table2.add_cell('Standard:')
        c1.add_attr('nowrap','nowrap')
        standard_sel = SelectWdg('standard')
        standard_sel.add_attr('id','standard')
        standard_sel.append_option('--Select--','')
        for s in my.standards:
            standard_sel.append_option(s,s)
        if my.sob.get('standard') == None:
            my.sob['standard'] = ''
        standard_sel.set_value(my.sob.get('standard'))
        table2.add_cell(standard_sel)

        table2.add_row()
        table2.add_cell(table2.hr())
        table2.add_row()

        c1 = table2.add_cell('HD:')
        c1.add_attr('nowrap','nowrap')
        hd_sel = SelectWdg('hd')
        hd_sel.add_attr('id','hd')
        hd_sel.append_option('--Select--','')
        for s in my.hd:
            hd_sel.append_option(s,s)
        if my.sob.get('hd') == None:
            my.sob['hd'] = ''
        hd_sel.set_value(my.sob.get('hd'))
        table2.add_cell(hd_sel)

#        c1 = table2.add_cell('Genre:')
#        c1.add_attr('nowrap','nowrap')
#        tb1 = TextWdg('genre')
#        tb1.add_attr('id','genre')
#        tb1.set_value(my.sob['genre'])
#        table2.add_cell(tb1)

        c1 = table2.add_cell('MPAA:')
        c1.add_attr('nowrap','nowrap')
        mpaa_sel = SelectWdg('mpaa')
        mpaa_sel.add_attr('id','mpaa')
        mpaa_sel.append_option('--Select--','')
        for s in my.mpaa:
            mpaa_sel.append_option(s,s)
        if my.sob.get('mpaa') == None:
            my.sob['mpaa'] = ''
        mpaa_sel.set_value(my.sob.get('mpaa'))
        table2.add_cell(mpaa_sel)

        c1 = table2.add_cell('MPAA Ratings:')
        c1.add_attr('nowrap','nowrap')
        mpaa_ratings_sel = SelectWdg('mpaa_ratings')
        mpaa_ratings_sel.add_attr('id','mpaa_ratings')
        mpaa_ratings_sel.append_option('--Select--','')
        for s in my.mpaa_ratings:
            mpaa_ratings_sel.append_option(s,s)
        if my.sob.get('mpaa_ratings') == None:
            my.sob['mpaa_ratings'] = ''
        mpaa_ratings_sel.set_value(my.sob.get('mpaa_ratings'))
        table2.add_cell(mpaa_ratings_sel)

        table2.add_row()
        table2.add_cell(table2.hr())
#        table2.add_row()
#
#        c1 = table2.add_cell('UK Ratings:')
#        c1.add_attr('nowrap','nowrap')
#        uk_ratings_sel = SelectWdg('uk_ratings')
#        uk_ratings_sel.add_attr('id','uk_ratings')
#        uk_ratings_sel.append_option('--Select--','')
#        for s in my.uk_ratings:
#            uk_ratings_sel.append_option(s,s)
#        if my.sob.get('uk_ratings') == None:
#            my.sob['uk_ratings'] = ''
#        uk_ratings_sel.set_value(my.sob.get('uk_ratings'))
#        table2.add_cell(uk_ratings_sel)
#
#        c1 = table2.add_cell('Australia Ratings:')
#        c1.add_attr('nowrap','nowrap')
#        australia_ratings_sel = SelectWdg('australia_ratings')
#        australia_ratings_sel.add_attr('id','australia_ratings')
#        australia_ratings_sel.append_option('--Select--','')
#        for s in my.australia_ratings:
#            australia_ratings_sel.append_option(s,s)
#        if my.sob.get('australia_ratings') == None:
#            my.sob['australia_ratings'] = ''
#        australia_ratings_sel.set_value(my.sob.get('australia_ratings'))
#        table2.add_cell(australia_ratings_sel)
#
#        c1 = table2.add_cell('Germany Ratings:')
#        c1.add_attr('nowrap','nowrap')
#        germany_ratings_sel = SelectWdg('germany_ratings')
#        germany_ratings_sel.add_attr('id','germany_ratings')
#        germany_ratings_sel.append_option('--Select--','')
#        for s in my.germany_ratings:
#            germany_ratings_sel.append_option(s,s)
#        if my.sob.get('germany_ratings') == None:
#            my.sob['germany_ratings'] = ''
#        germany_ratings_sel.set_value(my.sob.get('germany_ratings'))
#        table2.add_cell(germany_ratings_sel)
#
#        table2.add_row()
#        table2.add_cell(table2.hr())
        table2.add_row()

        c1 = table2.add_cell('Legal Rights:')
        c1.add_attr('nowrap','nowrap')
        legal_rights_sel = SelectWdg('legal_right')
        legal_rights_sel.add_attr('id','legal_right')
        legal_rights_sel.append_option('--Select--','')
        for s in my.legal_rights:
            legal_rights_sel.append_option(s,s)
        if my.sob.get('legal_right') == None:
            my.sob['legal_right'] = ''
        legal_rights_sel.set_value(my.sob.get('legal_right'))
        table2.add_cell(legal_rights_sel)
        

        from tactic.ui.widget import CalendarInputWdg, ActionButtonWdg
        ld = table2.add_cell('Legal Date: ')
        ld.add_attr('nowrap','nowrap')
        legal_date = CalendarInputWdg("legal_date")
        if my.sob.get('legal_date') not in [None,'']:
            legal_date.set_option('default', my.fix_date(my.sob.get('legal_date')))
        legal_date.set_option('show_activator', True)
        legal_date.set_option('show_confirm', False)
        #legal_date.set_option('show_text', True)
        legal_date.set_option('show_today', False)
        #legal_date.set_option('read_only', False)    
        legal_date.add_attr('id','legal_date')
        table2.add_cell(legal_date)

        c1 = table2.add_cell('Legal Comment:')
        c1.add_attr('nowrap','nowrap')
        tb1 = TextWdg('legal_comment')
        tb1.add_attr('id','legal_comment')
        tb1.add_style('width','300px')
        tb1.set_value(my.sob['legal_comment'])
        c2 = table2.add_cell(tb1)
        c2.add_attr('colspan','3')

        table2.add_row()
        table2.add_cell(table2.hr())
        table2.add_row()

        c1 = table2.add_cell('HE Creative Comment:')
        c1.add_attr('nowrap','nowrap')
        tb1 = TextWdg('he_creative_comment')
        tb1.add_attr('id','he_creative_comment')
        tb1.add_style('width','300px')
        tb1.set_value(my.sob['he_creative_comment'])
        c2 = table2.add_cell(tb1)
        c2.add_attr('colspan','3')

        table2.add_row()
        table2.add_cell(table2.hr())
        table2.add_row()

        c1 = table2.add_cell('URL:')
        c1.add_attr('nowrap','nowrap')
        tb1 = TextWdg('url')
        tb1.add_attr('id','url')
        tb1.add_style('width','300px')
        tb1.set_value(my.sob['url'])
        c2 = table2.add_cell(tb1)
        c2.add_attr('colspan','3')

        table2.add_row()
        table2.add_cell(table2.hr())
        table2.add_row()
        
        #ta1 = table2.add_cell('Cast Info:')
        #table2.add_row() 
        #ta1 = table2.add_cell('<textarea cols="90" rows="10" class="spt_input" name="cast_info" id="cast_info">%s</textarea>' % my.sob.get('cast_info'))

        #table2.add_row()
        submit = table2.add_cell('<input type="button" value="Submit"/>')
        sk = ''
        if not my.is_insert:
            sk = my.sob.get('__search_key__')
        submit.add_behavior(my.get_submit(sk))
        if not my.is_insert:
            xml = table2.add_cell('<input type="button" value="Generate XML"/>')
            xml.add_behavior(my.get_xml(sk))

         


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        table.add_row()

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

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

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

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

        table.add_row()

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

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

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

        # This is where the scheduler can enter production errors. It is hidden until "Document Errors" is clicked
        errors_row = table.add_row()
        errors_row.add_attr('class', 'qe_errors_row_%s' % my.order_sk)
        errors_row.add_style('display: none;')
        errors_wdg = ErrorEntryWdg(order_sk=my.order_sk, code='NOCODE', user=my.user, groups_str=my.groups_str,
                                   display_mode=my.disp_mode)
        errors_cell = table.add_cell(errors_wdg)
        errors_cell.add_attr('colspan', '10')
        return table
示例#14
0
    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
示例#15
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
示例#16
0
    def get_date_calendar_wdg(self):
        date_calendar_wdg = CalendarInputWdg("date")
        date_calendar_wdg.set_option('show_activator', 'true')
        date_calendar_wdg.set_option('show_time', 'false')
        date_calendar_wdg.set_option('width', '300px')
        date_calendar_wdg.set_option('id', 'date')
        date_calendar_wdg.set_option('display_format', 'MM/DD/YYYY')

        if self.prequal_eval_sobject:
            date_calendar_wdg.set_value(self.prequal_eval_sobject.get_value('date'))

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

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

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

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

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

        table.add_attr("id", tbl_id)
        table.add_attr('search_type', 'twog/work_order')
        table.add_attr('order_sk', my.order_sk)
        table.add_attr('parent_sk', my.parent_sk)
        table.add_attr('title_code', my.title_code)
        table.add_attr('user_name', Environment.get_user_name())

        ctbl = Table()
        ctbl.add_row()
        c1 = ctbl.add_cell('Work Order Names (Comma Delimited)')
        c1.add_attr('nowrap', 'nowrap')
        ctbl.add_row()
        ctbl.add_cell('<textarea cols="100" rows="5" id="comma_names" order_sk="%s"></textarea>' % my.order_sk)

        table.add_row()
        table.add_cell(ctbl)
        table.add_row()
        mid = table.add_cell('-- OR --')
        mid.add_attr('align', 'center')

        ntbl = Table()
        ntbl.add_row()
        ntbl.add_cell('Name: ')
        ntbl.add_cell('<input type="text" id="primary_name" style="width: 200px;"/>')
        n1 = ntbl.add_cell(' &nbsp;From Number: ')
        n1.add_attr('nowrap', 'nowrap')
        ntbl.add_cell('<input type="text" id="from_number" style="width: 50px;"/>')
        n2 = ntbl.add_cell(' &nbsp;To Number: ')
        n2.add_attr('nowrap', 'nowrap')
        ntbl.add_cell('<input type="text" id="to_number" style="width: 50px;"/>')

        table.add_row()
        table.add_cell(ntbl)

        ptbl = Table()

        start_date = CalendarInputWdg('start_date')
        start_date.set_option('show_time', 'true')
        start_date.set_option('show_activator', 'true')
        start_date.set_option('display_format', 'MM/DD/YYYY HH:MM')
        start_date.set_option('time_input_default', '5:00 PM')
        ptbl.add_row()
        ptbl.add_cell("Start Date: ")
        ptbl.add_cell(start_date)

        due_date = CalendarInputWdg('due_date')
        due_date.set_option('show_time', 'true')
        due_date.set_option('show_activator', 'true')
        due_date.set_option('display_format', 'MM/DD/YYYY HH:MM')
        due_date.set_option('time_input_default', '5:00 PM')
        ptbl.add_row()
        ptbl.add_cell("Due Date: ")
        ptbl.add_cell(due_date)

        btbl = Table()
        etbl = Table()

        g_search = Search("sthpw/login_group")
        g_search.add_where("\"login_group\" not in ('user','client')")
        g_search.add_order_by('login_group')
        groups = g_search.get_sobjects()
        group_sel = SelectWdg('assigned_login_group')
        group_sel.add_attr('id', 'assigned_login_group')
        group_sel.append_option('--Select--', '')
        for group in groups:
            group_sel.append_option(group.get_value('login_group'), group.get_value('login_group'))
        user_search = Search("sthpw/login")
        user_search.add_filter('location', 'internal')
        user_search.add_filter('license_type', 'user')
        user_search.add_order_by('login')
        users = user_search.get_sobjects()
        user_sel = SelectWdg("assigned")
        user_sel.add_attr('id', 'assigned')
        user_sel.append_option('--Select--', '')
        for u in users:
            user_sel.append_option(u.get_value('login'), u.get_value('login'))
        ptbl.add_row()
        p1 = ptbl.add_cell('Work Group: ')
        p1.add_attr('nowrap', 'nowrap')
        ptbl.add_cell(group_sel)
        ptbl.add_row()
        ptbl.add_cell('Assigned: ')
        ptbl.add_cell(user_sel)
        ptbl.add_row()
        p2 = ptbl.add_cell('Title Id Number: ')
        p2.add_attr('nowrap', 'nowrap')
        ptbl.add_cell('<input type="text" id="title_id_num" style="width: 200px;"/>')
        ptbl.add_row()
        p3 = ptbl.add_cell('Estimated Work Hours: ')
        p3.add_attr('nowrap', 'nowrap')
        ptbl.add_cell('<input type="text" id="estimated_work_hours" style="width: 50px;"/>')
        ptbl.add_row()
        p4 = ptbl.add_cell('Instructions: ')
        p4.add_attr('valign', 'top')
        ptbl.add_cell('<textarea cols="100" rows="20" id="instructions"></textarea>')
        wo_search = Search("twog/work_order")
        wo_search.add_filter('proj_code', my.parent_code)
        wo_search.add_order_by('order_in_pipe')
        wos = wo_search.get_sobjects()

        btbl.add_row()
        p5 = btbl.add_cell('<u>First WO Comes After</u>')
        p5.add_attr('nowrap', 'nowrap')
        p6 = btbl.add_cell('<u>Last WO Leads To</u>')
        p6.add_attr('nowrap', 'nowrap')
        fromtbl = Table()
        for p in wos:
            fromtbl.add_row()

            checker = CustomCheckboxWdg(name='from_check', value_field=p.get_value('code'), id=p.get_value('code'),
                                        checked='false', dom_class='from_check', code=p.get_value('code'))

            fromtbl.add_cell(checker)
            f1 = fromtbl.add_cell("%s (%s)" % (p.get_value('process'), p.get_value('code')))
            f1.add_attr('nowrap', 'nowrap')
        totbl = Table()
        for p in wos:
            totbl.add_row()

            checker = CustomCheckboxWdg(name='to_check', value_field=p.get_value('code'), checked='false',
                                        id=p.get_value('code'), dom_class='to_check', code=p.get_value('code'))

            totbl.add_cell(checker)
            t1 = totbl.add_cell("%s (%s)" % (p.get_value('process'), p.get_value('code')))
            t1.add_attr('nowrap', 'nowrap')
        btbl.add_row()
        btbl.add_cell(fromtbl)
        btbl.add_cell(totbl)

        table.add_row()
        table.add_cell(ptbl)
        table.add_row()
        table.add_cell(btbl)
        table.add_row()
        table.add_cell(etbl)
        table.add_row()

        stbl = Table()
        stbl.add_row()
        s1 = stbl.add_cell('&nbsp;')
        s1.add_attr('width', '40%')
        saction = stbl.add_cell('<input type="button" value="Create Work Orders"/>')
        saction.add_behavior(my.get_save())
        s2 = stbl.add_cell('&nbsp;')
        s2.add_attr('width', '40%')

        ss = table.add_cell(stbl)
        ss.add_attr('colspan', '2')
        ss.add_attr('align', 'center')

        widget = DivWdg()
        widget.add(table)
        return widget
示例#19
0
    def get_record_date_calendar_wdg(self):
        record_date_calendar_wdg = CalendarInputWdg("record_date")
        record_date_calendar_wdg.set_option('show_activator', 'true')
        record_date_calendar_wdg.set_option('show_time', 'false')
        record_date_calendar_wdg.set_option('width', '300px')
        record_date_calendar_wdg.set_option('id', 'record_date')
        record_date_calendar_wdg.set_option('display_format', 'MM/DD/YYYY')

        if hasattr(self, 'record_date'):
            record_date_calendar_wdg.set_value(self.record_date)

        return record_date_calendar_wdg
示例#20
0
    def get_display(self):

        from tactic.ui.report import MMSUtility
        import datetime
        date = datetime.datetime.now()
        start_wday, end_wday = MMSUtility.get_week_range(date)

        self.prefix = 'week'
        top = DivWdg()
        top.add_class("spt_table_search")
        self.set_as_panel(top)

        from tactic.ui.container import RoundedCornerDivWdg
        inner = RoundedCornerDivWdg(corner_size=10, hex_color_code='949494')
        inner.set_dimensions(width_str="95%",
                             content_height_str='95%',
                             height_str="100%")
        inner.add_style("margin: 20px")
        top.add(inner)

        hidden = HiddenWdg("prefix", self.prefix)
        top.add(hidden)

        filter_data = FilterData.get()
        values = filter_data.get_values_by_index("week", 0)
        date_string = values.get("calendar")
        if not date_string:
            date_string = WebContainer.get_web().get_form_value("calendar")

        if date_string:
            date = parser.parse(date_string)
        else:
            date = datetime.datetime.now()

        week = 1

        table = Table()
        table.add_style("color: black")
        table.add_style("width: 600px")
        table.add_row()
        inner.add(table)

        #inner.add("Range: %s - %s<br/><br/>" % (start_wday, end_wday))

        table.add_cell("Week Of Date: <br/>")
        calendar = CalendarInputWdg('calendar')

        day_cbk = '''
        var top = spt.get_parent(bvr.src_el, '.spt_table_search');
        var week_el = top.getElement('.spt_calendar_week');
        var input_el = top.getElement('.spt_calendar_input');
        var value = input_el.value;
        var week = spt.date_util.ymd.get_week( value )
        week_el.innerHTML = week + '';
        '''
        calendar.add_day_cbk(day_cbk)

        #calendar.set_option("first_day_of_week", 4)
        calendar.set_value(date.strftime("%Y-%m-%d"))
        # TODO: set default
        table.add_cell(calendar)

        week = int(date.strftime("%W")) + 1

        table.add_cell("Week: ")
        #select = SelectWdg("week")
        #select.add_class("action inputfield")
        #select.set_option("values", range(1,53) )
        #select.set_value(week)
        #select.set_option( "size", "2" )
        text = DivWdg()
        text.add_class("spt_calendar_week")
        text.add_style("width", "25px")
        text.add(week)
        table.add_cell(text)

        table.add_cell(self.get_search_wdg())

        return top
示例#21
0
    def get_default_display_wdg(cls, element_name, display_options, element_type, kbd_handler=False):

        from pyasm.widget import TextAreaWdg, CheckboxWdg, SelectWdg, TextWdg
        if element_type in ["integer", "smallint", "bigint", "int"]:
            behavior = {
                'type': 'keyboard',
                'kbd_handler_name': 'DgTableIntegerTextEdit'
            }
            input = TextWdg("main")
            input.set_options(display_options)
            if kbd_handler:
                input.add_behavior(behavior)

        elif element_type in ["float"]:
            behavior = {
                'type': 'keyboard',
                'kbd_handler_name': 'DgTableFloatTextEdit'
            }
            input = TextAreaWdg("main")
            input.set_options(display_options)
            if kbd_handler:
                input.add_behavior(behavior)

        elif element_type in ["string", "link", "varchar", "character", "timecode"]:
            behavior = {
                'type': 'keyboard',
                'kbd_handler_name': 'DgTableMultiLineTextEdit'
            }
            input = TextWdg('main')
            input.set_options(display_options)
            if kbd_handler:
                input.add_behavior(behavior)


        elif element_type in ["text"]:
            behavior = {
                'type': 'keyboard',
                'kbd_handler_name': 'DgTableMultiLineTextEdit'
            }
            input = TextAreaWdg('main')
            input.set_options(display_options)
            if kbd_handler:
                input.add_behavior(behavior)

        elif element_type == "boolean":
            input = CheckboxWdg('main')
            input.set_options(display_options)
            input.add_behavior(
             {"type" : "click_up",
                    'propagate_evt': True})

        elif element_type in  ["timestamp", "date", "time", "datetime2"]:
            from tactic.ui.widget import CalendarInputWdg, CalendarWdg, TimeInputWdg
            # FIXME: take wild guess for the time
            if element_name.endswith("_time"):
                #input = TimeInputWdg()
                behavior = {
                    'type': 'keyboard',
                    'kbd_handler_name': 'DgTableMultiLineTextEdit'
                }
                input = TextWdg('main')
                input.set_options(display_options)
                if kbd_handler:
                    input.add_behavior(behavior)

            else:
                #input = CalendarWdg()
                input = CalendarInputWdg()
                input.set_option('show_activator', False)
            #input.set_options(display_options)

        elif element_type == 'datetime':
            from tactic.ui.widget import CalendarInputWdg
            input = CalendarInputWdg()
            input.set_option('show_time', 'true')

        elif element_type == "color":
            from tactic.ui.widget import ColorInputWdg
            input = ColorInputWdg()
            input.set_options(display_options)

        elif element_type =="sqlserver_timestamp":
            # NoneType Exception is prevented in WidgetConfig already
            input = None
        else:
            # else try to instantiate it as a class
            print "WARNING: EditWdg handles type [%s] as default TextWdg" %element_type
            input = TextWdg()
            input.add("No input defined")

        return input 
示例#22
0
    def get_display(my):
        my.client_code = str(my.kwargs.get('client_code'))
        my.order_sk = str(my.kwargs.get('order_sk'))
        my.order_sid = str(my.kwargs.get('order_sid'))
        order_code = my.order_sk.split('code=')[1]
        order_search = Search("twog/order")
        order_search.add_filter('code',order_code)
        the_order = order_search.get_sobject()

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        return table