コード例 #1
0
ファイル: sobject_group_wdg.py プロジェクト: 0-T-0/TACTIC
 def get_display(my): 
     #my.init()
     item_table = Table(css='minimal')
     item_table.add_style('margin-left','30px')
    
     for item in my.items:
         item_table.add_row()
         space_td = item_table.add_blank_cell()
         
         item_td = item_table.add_cell(item.get_description())
         item_td.set_attr("nowrap", "1")
         
         delete = IconSubmitWdg("Remove from group", \
             "stock_stop-16.png",add_hidden=False)
         delete.add_event("onclick","document.form.remove_cmd.value=\
             '%s|%s';document.form.submit();" \
             % (my.group.get_primary_key_value(), item.get_primary_key_value()) )
         del_span = SpanWdg(css='med')
         del_span.add(delete)
         item_table.add_cell(del_span)
     if not my.items:
         item_table.add_blank_cell()
    
     my.add(item_table)
     return super(ItemInContainerWdg, my).get_display()
コード例 #2
0
ファイル: error_viewer.py プロジェクト: Smurgledwerf/custom
 def make_check_table(my, dictoid, arr, sob, my_name, color, is_external_rejection=False):
     table = Table()
     table.add_style('background-color: %s;' % color)
     max_width = 3
     table.add_row()
     top_cell = table.add_cell('<b><u>%s</u></b>' % my_name)
     top_cell.add_attr('colspan',max_width)
     top_cell.add_attr('align','center')
     count = 0
     for entry in arr:
         if count % max_width == 0:
             table.add_row()
         checker = CheckboxWdg('check_%s' % dictoid[entry])
         checker.add_attr('code', sob.get('code'))
         checker.add_attr('field', dictoid[entry])
         #checker.set_persistence()
         if sob.get(dictoid[entry]):
             checker.set_value(True)
         else:
             checker.set_value(False)
         if not is_external_rejection:
             checker.add_behavior(my.get_reason_check_behavior(dictoid[entry]))
         check_hold = table.add_cell(checker)
         check_hold.add_attr('code', sob.get('code'))
         check_hold.add_attr('field', dictoid[entry])
         label = table.add_cell(entry)
         label.add_attr('nowrap','nowrap')
         label.add_attr('width','190px')
         count = count + 1 
     return table
コード例 #3
0
    def get_section_two_bottom_table(self):
        table = Table()
        table.add_style('margin', '10px')
        table.add_row()

        table.add_header('')
        table.add_header('Feature')
        table.add_header('Audio Bundle')
        table.add_header('Trailer/Preview')

        label_value_pairs = (
            ('Audio configuration verified (stereo or mono/mapping is correct)?', 'audio_configuration_verified'),
            ('Audio is in sync with video (checked in 3 random spots and head/tail)?', 'audio_in_sync_with_video'),
            ('Audio is tagged correctly?', 'audio_tagged_correctly'),
            ('No audio is cut off (at beginning or end)?', 'no_audio_cut_off'),
            ('TRT of audio equals TRT of the video?', 'trt_audio_equals_trt_video'),
            ('Correct language is present (on applicable channels)?', 'correct_language_present')
        )

        for label_value_pair in label_value_pairs:
            table.add_row()
            table.add_cell(label_value_pair[0])

            for section in ('feature', 'audio', 'preview'):
                table.add_cell(self.get_true_false_select_wdg(label_value_pair[1] + '_' + section))

        return table
コード例 #4
0
    def get_delivery_snapshot_section(self):
        label_value_pairs = (('Feature', 'feature_delivery_snapshot'),
                             ('Trailer', 'trailer_delivery_snapshot'),
                             ('Alt Audio', 'alt_audio_delivery_snapshot'),
                             ('Subtitle', 'subtitle_delivery_snapshot'),
                             ('CC', 'cc_delivery_snapshot'),
                             ('Vendor Notes',
                              'vendor_notes_delivery_snapshot'),
                             ('Poster Art', 'poster_art_delivery_snapshot'),
                             ('Dub Card', 'dub_card_delivery_snapshot'))

        table = Table()
        table.add_style('float', 'left')

        table.add_row()
        table.add_header('Delivery Snapshot')

        for label_value_pair in label_value_pairs:
            label, value = label_value_pair

            table.add_row()
            table.add_cell(label)
            table.add_cell(self.get_true_false_select_wdg(value))

        section_div = DivWdg()
        section_div.add(table)

        return section_div
コード例 #5
0
ファイル: error_viewer.py プロジェクト: Smurgledwerf/custom
 def make_login_table(my, sob):
     table = Table()
     table.add_style('background-color: #fffff1;')
     max_width = 4
     table.add_row()
     top_cell = table.add_cell('<b><u>Responsible</u></b>')
     top_cell.add_attr('colspan',max_width)
     top_cell.add_attr('align','center')
     count = 0
     users = my.server.eval("@SOBJECT(sthpw/login['location','internal']['license_type','user']['@ORDER_BY','login'])")
     for u in users:
         if count % max_width == 0:
             table.add_row()
         checker = CheckboxWdg('responsible_%s' % u.get('login'))
         checker.add_attr('login',u.get('login'))
         checker.add_attr('code',sob.get('code'))
         checker.add_attr('current_list', sob.get('responsible_users'))
         #checker.set_persistence()
         if sob.get('responsible_users') not in [None,'']:
             if u.get('login') in sob.get('responsible_users'):
                 checker.set_value(True)
             else:
                 checker.set_value(False)
         else:
             checker.set_value(False)
         checker.add_behavior(my.get_make_responsible_behavior())
         table.add_cell(checker)
         label = table.add_cell(u.get('login'))
         label.add_attr('nowrap','nowrap')
         label.add_attr('width','137px')
         count = count + 1
     return table
コード例 #6
0
    def get_section_two_bottom_table(self):
        table = Table()
        table.add_style('margin', '10px')
        table.add_row()

        table.add_header('')
        table.add_header('Feature')
        table.add_header('Audio Bundle')
        table.add_header('Trailer/Preview')

        label_value_pairs = ((
            'Audio configuration verified (stereo or mono/mapping is correct)?',
            'audio_configuration_verified'
        ), ('Audio is in sync with video (checked in 3 random spots and head/tail)?',
            'audio_in_sync_with_video'), (
                'Audio is tagged correctly?', 'audio_tagged_correctly'
            ), ('No audio is cut off (at beginning or end)?',
                'no_audio_cut_off'), (
                    'TRT of audio equals TRT of the video?',
                    'trt_audio_equals_trt_video'
                ), ('Correct language is present (on applicable channels)?',
                    'correct_language_present'))

        for label_value_pair in label_value_pairs:
            table.add_row()
            table.add_cell(label_value_pair[0])

            for section in ('feature', 'audio', 'preview'):
                table.add_cell(
                    self.get_true_false_select_wdg(label_value_pair[1] + '_' +
                                                   section))

        return table
コード例 #7
0
    def handle_python_script_test(self, top):
        top.add(DivWdg('Python Script Test', css='spt_info_title'))
        table = Table(css='script')
        table.add_color("color", "color")
        table.add_style("margin: 10px")
        table.add_style("width: 100%")
        top.add(table)
        table.add_row()
        td = table.add_cell("Script Path: ")
        td.add_style("width: 150px")
        text = TextWdg('script_path')
        td = table.add_cell(text)
        button = ActionButtonWdg(title='Run')
        table.add_cell(button)
        button.add_style("float: right")
        button.add_behavior({
            'type':
            'click_up',
            'cbjs_action':
            '''
             var s = TacticServerStub.get();
             try {
                var path =  bvr.src_el.getParent('.script').getElement('.spt_input').value;
                if (! path)
                    throw('Please enter a valid script path');
                s.execute_cmd('tactic.command.PythonCmd', {script_path: path});
             } catch(e) {
                spt.alert(spt.exception.handler(e));
             }

        '''
        })
コード例 #8
0
    def get_display(my):
        sobject = None
        code = ''
        show_checks = False
        if 'source_code' in my.kwargs.keys():
            code = str(my.kwargs.get('source_code'))    
        else:
            sobject = my.get_current_sobject()
            code = sobject.get_code()
        if sobject.get_value('high_security') in [True,'T','t','1']:
            show_checks = True
        widget = DivWdg()
        table = Table()
        table.add_attr('width', '50px')
        if show_checks:
            table.add_style('background-color: #ff0000;')
            login = Environment.get_login()
            user_name = login.get_login()
            table.add_row()
            cell1 =  table.add_cell('<img border="0" style="vertical-align: middle" title="Security Checklist" name="Security Checklist" src="/context/icons/32x32/lock_32_01.png">')
            cell1.add_attr('user', user_name)
            launch_behavior = my.get_launch_behavior(code,user_name)
            cell1.add_style('cursor: pointer;')
            cell1.add_behavior(launch_behavior)
        widget.add(table)

        return widget
コード例 #9
0
    def get_delivery_snapshot_section(self):
        label_value_pairs = (
            ('Feature', 'feature_delivery_snapshot'),
            ('Trailer', 'trailer_delivery_snapshot'),
            ('Alt Audio', 'alt_audio_delivery_snapshot'),
            ('Subtitle', 'subtitle_delivery_snapshot'),
            ('CC', 'cc_delivery_snapshot'),
            ('Vendor Notes', 'vendor_notes_delivery_snapshot'),
            ('Poster Art', 'poster_art_delivery_snapshot'),
            ('Dub Card', 'dub_card_delivery_snapshot')
        )

        table = Table()
        table.add_style('float', 'left')

        table.add_row()
        table.add_header('Delivery Snapshot')

        for label_value_pair in label_value_pairs:
            label, value = label_value_pair

            table.add_row()
            table.add_cell(label)
            table.add_cell(self.get_true_false_select_wdg(value))

        section_div = DivWdg()
        section_div.add(table)

        return section_div
コード例 #10
0
 def handle_sidebar_clear(self, top):
     top.add(DivWdg('Clear Side Bar Cache ', css='spt_info_title'))
     table = Table()
     table.add_color("color", "color")
     table.add_style("margin: 10px")
     top.add(table)
     table.add_row()
     td = table.add_cell("Clear the Side Bar Cache for all users")
     td.add_style("width: 250px")
     button = ActionButtonWdg(title='Run')
     table.add_cell(button)
     button.add_behavior({
         'type':
         'click_up',
         'cbjs_action':
         '''
         try {
         var s = TacticServerStub.get();
         s.execute_cmd('tactic.ui.app.ClearSideBarCache');
         
         } catch(e) {
             spt.alert(spt.exception.handler(e));
         }
         spt.info('Side Bar cache cleared.')
     '''
     })
コード例 #11
0
    def get_display(self):
        #self.init()
        item_table = Table(css='minimal')
        item_table.add_style('margin-left', '30px')

        for item in self.items:
            item_table.add_row()
            space_td = item_table.add_blank_cell()

            item_td = item_table.add_cell(item.get_description())
            item_td.set_attr("nowrap", "1")

            delete = IconSubmitWdg("Remove from group", \
                "stock_stop-16.png",add_hidden=False)
            delete.add_event("onclick","document.form.remove_cmd.value=\
                '%s|%s';document.form.submit();" \
                % (self.group.get_primary_key_value(), item.get_primary_key_value()) )
            del_span = SpanWdg(css='med')
            del_span.add(delete)
            item_table.add_cell(del_span)
        if not self.items:
            item_table.add_blank_cell()

        self.add(item_table)
        return super(ItemInContainerWdg, self).get_display()
コード例 #12
0
    def _get_target_span(self):
        # get the target span
        search = Search(self.container_cls)
        self._order_search(search)
        groups = search.get_sobjects()
        if groups:
            self.container_sobj = groups[0]

        target_span = SpanWdg(css='med')
        group_table = Table(self.GROUP_TABLE_NAME, css='table')
        group_table.add_style('width', '30em')
        group_table.add_col(css='small')
        group_table.add_col(css='small')
        group_table.add_col()

        target_span.add(group_table)
        group_table.add_row_cell(search.get_search_type_obj()\
            .get_description(), "heading")
        checkbox = CheckboxWdg()
        checkbox.set_option("onclick", \
            "a=new Elements('container_ids');a.toggle_all(this);")
        group_table.add_row()
        group_table.add_cell(checkbox)
        col_name = group_table.get_next_col_name()

        toggle_control = HiddenRowToggleWdg(col_name=col_name,
                                            is_control=True,
                                            auto_index=True)

        group_table.add_cell(toggle_control)
        group_table.add_cell('MASTER CONTROL')

        remove_cmd = HiddenWdg(SObjectGroupCmd.REMOVE_CMD)
        self.add(remove_cmd)
        for group in groups:
            group_table.add_row()
            checkbox = CheckboxWdg("container_ids")
            checkbox.set_option("value", group.get_primary_key_value())

            toggle = HiddenRowToggleWdg(col_name, auto_index=True)
            toggle.store_event()

            group_details = ItemInContainerWdg(group, self.item_sobj,
                                               self.item_cls,
                                               self.grouping_cls)

            # set the target content of the toggle
            toggle.set_static_content(group_details)

            group_table.add_cell(checkbox)
            group_table.add_cell(toggle, add_hidden_wdg=True)
            group_table.add_cell(group.get_description())
            num_items = group_details.get_num_items()
            if num_items:
                td = group_table.add_cell("( %s )" % num_items, 'no_wrap')
                td.add_color(color)
            else:
                group_table.add_blank_cell()

        return target_span
コード例 #13
0
 def make_check_table(my, dictoid, arr, sob, sk, my_name, color):
     #Makes a table of checklisted items
     table = Table()
     table.add_style('background-color: %s;' % color)
     #The maximum width across (max number of columns of checkboxes)
     max_width = 3
     table.add_row()
     top_cell = table.add_cell('<b><u>%s</u></b>' % my_name)
     top_cell.add_attr('colspan',max_width)
     top_cell.add_attr('align','center')
     count = 0
     for entry in arr:
         #If it has hit the max width for the row, create a new row
         if count % max_width == 0:
             table.add_row()
         #Create textbox
         check_bool = 'false'
         if sob:
             if sob.get(dictoid[entry]):
                 check_bool = 'true'
             else:
                 check_bool = 'false'
         else:
             check_bool = 'false'
         checker = CustomCheckboxWdg(name='errcheck_%s_%s' % (dictoid[entry], sk),value_field=dictoid[entry],checked=check_bool,dom_class='check_table_selector',field=dictoid[entry])
         check_hold = table.add_cell(checker)
         check_hold.add_attr('field', dictoid[entry])
         label = table.add_cell(entry)
         label.add_attr('nowrap','nowrap')
         label.add_attr('width','190px')
         count = count + 1
     return table
コード例 #14
0
ファイル: system_info_wdg.py プロジェクト: mincau/TACTIC
    def handle_python_script_test(self, top):
        top.add(DivWdg('Python Script Test', css='spt_info_title'))
        table = Table(css='script')
        table.add_color("color", "color")
        table.add_style("margin: 10px")
        table.add_style("width: 100%")
        top.add(table)
        table.add_row()
        td = table.add_cell("Script Path: ")
        td.add_style("width: 150px")
        text = TextWdg('script_path')
        td = table.add_cell(text)
        button = ActionButtonWdg(title='Run')
        table.add_cell(button)
        button.add_style("float: right")
        button.add_behavior( {
        'type': 'click_up',
        'cbjs_action': '''
             var s = TacticServerStub.get();
             try {
                var path =  bvr.src_el.getParent('.script').getElement('.spt_input').value;
                if (! path)
                    throw('Please enter a valid script path');
                s.execute_cmd('tactic.command.PythonCmd', {script_path: path});
             } catch(e) {
                spt.alert(spt.exception.handler(e));
             }

        '''
        })
コード例 #15
0
ファイル: system_info_wdg.py プロジェクト: mincau/TACTIC
    def handle_load_balancing(self, top):
        # deal with asset directories
        top.add(DivWdg('Load Balancing', css='spt_info_title'))
        table = Table()
        table.add_class("spt_loadbalance")
        table.add_color("color", "color")
        table.add_style("margin: 10px")
        top.add(table)
        table.add_row()
        td = table.add_cell("Load Balancing: ")
        td.add_style("width: 150px")

        button = ActionButtonWdg(title='Test')
        td = table.add_cell(button)
        message_div = DivWdg()
        message_div.add_class("spt_loadbalance_message")
        table.add_cell(message_div)
        button.add_behavior( {
        'type': 'click_up',
        'cbjs_action': '''
        var server = TacticServerStub.get()
        var ports = {};
        var count = 0;
        for (var i = 0; i < 50; i++) {
          var info = server.get_connection_info();
          var port = info.port;
          var num = ports[port];
          if (!num) {
            ports[port] = 1;
            count += 1;
          }
          else {
            ports[port] += 1;
          }
          // if there are 10 requests and still only one, then break
          if (i == 10 && count == 1)
            break;
        }


        // build the ports string
        x = [];
        for (i in ports) {
            x.push(i);
        }
        x.sort();
        x = x.join(", ");

        var loadbalance_el = bvr.src_el.getParent(".spt_loadbalance");
        var message_el = loadbalance_el.getElement(".spt_loadbalance_message");
        if (count > 1) {
            var message = "Yes (found " + count + " ports: "+x+")";
        }
        else {
            var message = "<blink style='background: red; padding: 3px'>Not enabled (found only port " + x + ")</blink>";
        }
        message_el.innerHTML = message
        '''
        } )
コード例 #16
0
    def get_info_wdg(my):

        div = DivWdg()

        div.add("<b>Create a share</b>")
        div.add("<br/>" * 2)

        table = Table()
        div.add(table)
        table.add_style("margin-left: 15px")

        table.add_row()
        td = table.add_cell("Share Code: ")
        td.add_style("vertical-align: top")
        text = TextWdg("code")
        table.add_cell(text)
        text.add_behavior({
            'type':
            'change',
            'cbjs_action':
            '''
            var value = bvr.src_el.value;
            if (!value) {
                return;
            }
            var server = TacticServerStub.get();
            var expr = "@SOBJECT(sthpw/sync_server['code','"+value+"'])";
            var test = server.eval(expr);
            if (test.length > 0) {
                spt.alert("Share ["+value+"] already exists.");
                bvr.src_el.value = "";
                bvr.src_el.focus();
            }
            '''
        })
        tr, td = table.add_row_cell()
        msg_div = DivWdg()
        td.add(msg_div)
        msg_div.add(
            "The share code is used as a prefix for all transactions and allows TACTIC to separate transactions from each location.  By convention, these codes should be a short initial (ie: ABC)."
        )
        msg_div.add_style("margin: 10px 20px 20px 20px")

        table.add_row()
        table.add_row_cell("&nbsp;")

        table.add_row()
        td = table.add_cell("Description: ")
        td.add_style("vertical-align: top")
        text = TextAreaWdg("description")
        td = table.add_cell(text)

        #table.add_row()
        #table.add_cell("Auth Ticket: ")
        #text = TextWdg("ticket")
        #table.add_cell(text)

        return div
コード例 #17
0
ファイル: sobject_group_wdg.py プロジェクト: 0-T-0/TACTIC
 def _get_target_span(my):
     # get the target span
     search = Search(my.container_cls)
     my._order_search(search)
     groups = search.get_sobjects()
     if groups:
         my.container_sobj = groups[0]
     
     target_span = SpanWdg(css='med')
     group_table = Table(my.GROUP_TABLE_NAME, css='table')
     group_table.add_style('width','30em')
     group_table.add_col(css='small')
     group_table.add_col(css='small')    
     group_table.add_col()    
         
     target_span.add(group_table)
     group_table.add_row_cell(search.get_search_type_obj()\
         .get_description(), "heading")
     checkbox = CheckboxWdg()
     checkbox.set_option("onclick", \
         "a=new Elements('container_ids');a.toggle_all(this);")
     group_table.add_row()
     group_table.add_cell(checkbox)
     col_name = group_table.get_next_col_name() 
     
     toggle_control = HiddenRowToggleWdg(col_name=col_name, is_control=True, auto_index=True)
   
     group_table.add_cell(toggle_control)
     group_table.add_cell('MASTER CONTROL')
     
     remove_cmd = HiddenWdg(SObjectGroupCmd.REMOVE_CMD)
     my.add(remove_cmd)
     for group in groups:
         group_table.add_row()
         checkbox = CheckboxWdg("container_ids")
         checkbox.set_option("value", group.get_primary_key_value() )
         
         toggle = HiddenRowToggleWdg(col_name, auto_index=True)
         toggle.store_event()
      
         group_details = ItemInContainerWdg( group, my.item_sobj, my.item_cls, my.grouping_cls )
        
         # set the target content of the toggle
         toggle.set_static_content(group_details)
        
         group_table.add_cell( checkbox )
         group_table.add_cell( toggle, add_hidden_wdg=True )
         group_table.add_cell( group.get_description())
         num_items = group_details.get_num_items()
         if num_items:
             td = group_table.add_cell( "( %s )" % num_items, 'no_wrap')
             td.add_color(color)
         else:
             group_table.add_blank_cell()
    
     
     return target_span
コード例 #18
0
ファイル: tool_layout_wdg.py プロジェクト: mincau/TACTIC
    def get_info_wdg(self, sobject):

        div = DivWdg()
        div.add_style("margin: 10px 20px 20px 20px")
        div.add_style("padding: 0px 20px")
        #div.add_color("background", "background", -3)
        #div.add_border()
        #div.add_color("color", "color3")
        #div.set_round_corners(5)

        div.add_style("height", "100%")
        div.add_style("position: relative")

        element_names = self.element_names
        config = self.config


        table = Table()
        table.add_style("height", "100%")
        div.add(table)
        for element_name in element_names:
            table.add_row()
            title = Common.get_display_title(element_name)
            td = table.add_cell("%s: " % title)
            td.add_style("width: 200px")
            td.add_style("padding: 5px")


            element = config.get_display_widget(element_name)

            if self.first:
                try:
                    element.handle_layout_behaviors(self.layout_wdg)
                except Exception as e:
                    print "e :", e
                    pass


            element.set_sobject(sobject)
            element.preprocess()
            td = table.add_cell(element)
            td.add_style("padding: 5px")
            #value = sobject.get_value(element_name, no_exception=True) or "N/A"
            #table.add_cell(value)


        show_notes = self.kwargs.get("show_notes")
       
        if show_notes in [True, 'true']:
            div.add("<br/>")
            from tactic.ui.widget import DiscussionWdg
            search_key = sobject.get_search_key()
            notes_wdg = DiscussionWdg(search_key=search_key)
            notes_wdg.set_sobject(sobject)
            div.add(notes_wdg)

        return div
コード例 #19
0
ファイル: db_config_wdg.py プロジェクト: 0-T-0/TACTIC
    def configure_category(my, title, category, options, options_type = {}):
        div = DivWdg()

        title_wdg = DivWdg()
        div.add(title_wdg)

        #from tactic.ui.widget.swap_display_wdg import SwapDisplayWdg
        #swap = SwapDisplayWdg()
        #div.add(swap)

        title_wdg.add("<b>%s</b>" % title)


        table = Table()
        div.add(table)
        #table.add_color("color", "color")
        table.add_style("color: #000")
        table.add_style("margin: 20px")

        for option in options:
            table.add_row()
            display_title = Common.get_display_title(option)
            td = table.add_cell("%s: " % display_title)
            td.add_style("width: 150px")

            option_type = options_type.get(option)
            validation_scheme = ""

            #add selectWdg for those options whose type is bool
            if option_type == 'bool':
                text = SelectWdg(name="%s/%s" % (category, option))
                text.set_option('values','true|false')
                text.set_option('empty','true')
                text.add_style("margin-left: 0px")

                        
            elif option.endswith('password'):
                text = PasswordInputWdg(name="%s/%s" % (category, option))

            # dealing with options whose type is number   
            else:
                if option_type == 'number':
                    validation_scheme = 'INTEGER'
                    
                else:
                    validation_scheme = ""

                text = TextInputWdg(name="%s/%s" % (category, option), validation_scheme=validation_scheme, read_only="false")
                

            value = Config.get_value(category, option)
            if value:
                text.set_value(value)

            table.add_cell(text)

        return div
コード例 #20
0
    def configure_category(my, title, category, options, options_type={}):
        div = DivWdg()

        title_wdg = DivWdg()
        div.add(title_wdg)

        #from tactic.ui.widget.swap_display_wdg import SwapDisplayWdg
        #swap = SwapDisplayWdg()
        #div.add(swap)

        title_wdg.add("<b>%s</b>" % title)

        table = Table()
        div.add(table)
        #table.add_color("color", "color")
        table.add_style("color: #000")
        table.add_style("margin: 20px")

        for option in options:
            table.add_row()
            display_title = Common.get_display_title(option)
            td = table.add_cell("%s: " % display_title)
            td.add_style("width: 150px")

            option_type = options_type.get(option)
            validation_scheme = ""

            #add selectWdg for those options whose type is bool
            if option_type == 'bool':
                text = SelectWdg(name="%s/%s" % (category, option))
                text.set_option('values', 'true|false')
                text.set_option('empty', 'true')
                text.add_style("margin-left: 0px")

            elif option.endswith('password'):
                text = PasswordInputWdg(name="%s/%s" % (category, option))

            # dealing with options whose type is number
            else:
                if option_type == 'number':
                    validation_scheme = 'INTEGER'

                else:
                    validation_scheme = ""

                text = TextInputWdg(name="%s/%s" % (category, option),
                                    validation_scheme=validation_scheme,
                                    read_only="false")

            value = Config.get_value(category, option)
            if value:
                text.set_value(value)

            table.add_cell(text)

        return div
コード例 #21
0
ファイル: tool_layout_wdg.py プロジェクト: nuxping/TACTIC
    def get_info_wdg(my, sobject):

        div = DivWdg()
        div.add_style("margin: 10px 20px 20px 20px")
        div.add_style("padding: 20px")
        div.add_color("background", "background", -3)
        div.add_border()
        div.add_color("color", "color3")
        div.set_round_corners(5)

        div.add_style("height", "100%")
        div.add_style("position: relative")

        element_names = my.kwargs.get("element_names")
        if not element_names:
            element_names = [
                "code",
                "name",
                "description",
            ]
        else:
            element_names = element_names.split(",")

        view = "table"

        from pyasm.widget import WidgetConfigView
        search_type = sobject.get_search_type()
        config = WidgetConfigView.get_by_search_type(search_type, view)

        table = Table()
        table.add_style("height", "100%")
        div.add(table)
        for element_name in element_names:
            table.add_row()
            title = Common.get_display_title(element_name)
            td = table.add_cell("%s: " % title)
            td.add_style("width: 200px")
            td.add_style("padding: 5px")

            element = config.get_display_widget(element_name)
            element.set_sobject(sobject)
            element.preprocess()
            td = table.add_cell(element)
            td.add_style("padding: 5px")
            #value = sobject.get_value(element_name, no_exception=True) or "N/A"
            #table.add_cell(value)

        div.add("<br/>")
        from tactic.ui.widget import DiscussionWdg
        search_key = sobject.get_search_key()
        notes_wdg = DiscussionWdg(search_key=search_key)
        notes_wdg.set_sobject(sobject)
        div.add(notes_wdg)

        return div
コード例 #22
0
ファイル: tool_layout_wdg.py プロジェクト: nuxping/TACTIC
    def get_info_wdg(my, sobject):

        div = DivWdg()
        div.add_style("margin: 10px 20px 20px 20px")
        div.add_style("padding: 20px")
        div.add_color("background", "background", -3)
        div.add_border()
        div.add_color("color", "color3")
        div.set_round_corners(5)

        div.add_style("height", "100%")
        div.add_style("position: relative")

        element_names = my.kwargs.get("element_names")
        if not element_names:
            element_names = ["code","name","description",]
        else:
            element_names = element_names.split(",")


        view = "table"

        from pyasm.widget import WidgetConfigView
        search_type = sobject.get_search_type()
        config = WidgetConfigView.get_by_search_type(search_type, view)


        table = Table()
        table.add_style("height", "100%")
        div.add(table)
        for element_name in element_names:
            table.add_row()
            title = Common.get_display_title(element_name)
            td = table.add_cell("%s: " % title)
            td.add_style("width: 200px")
            td.add_style("padding: 5px")


            element = config.get_display_widget(element_name)
            element.set_sobject(sobject)
            element.preprocess()
            td = table.add_cell(element)
            td.add_style("padding: 5px")
            #value = sobject.get_value(element_name, no_exception=True) or "N/A"
            #table.add_cell(value)

        div.add("<br/>")
        from tactic.ui.widget import DiscussionWdg
        search_key = sobject.get_search_key()
        notes_wdg = DiscussionWdg(search_key=search_key)
        notes_wdg.set_sobject(sobject)
        div.add(notes_wdg)

        return div
コード例 #23
0
    def get_row_wdg_new(my, buttons, show_title=False):

        div = DivWdg()
        """
        div.set_round_corners(8)
        div.add_border()
        div.add_style("padding-top: 1px")
        div.add_style("padding-left: 5px")
        div.add_style("padding-right: 5px")
        div.add_gradient("background", "background", 5, -30)
        """

        div = DivWdg()
        div.set_round_corners(3)
        #div.add_border()
        div.add_style("padding-top: 1px")
        div.add_style("padding-left: 5px")
        div.add_style("padding-right: 5px")
        #div.add_gradient("background", "background", -5, -10)

        web = WebContainer.get_web()
        browser = web.get_browser()

        table = Table()
        div.add(table)
        div.add_style("overflow: hidden")

        table.add_attr("cellspacing", "0px")
        table.add_attr("cellpadding", "0px")
        table.add_row()

        if browser == "Mozilla":
            table.add_style("margin-top: -5px")
            div.add_style("height: 30px")
        else:
            table.add_style("margin-top: -5px")

        base = "%s/%s" % (BASE, my.top.get_theme())

        for count, button in enumerate(buttons):
            td = table.add_cell()
            td.add(button)

            if button.get_show_arrow_menu():
                spacer = DivWdg()
                table.add_cell(spacer)
                spacer.add_style("width: 6px")

            if count < len(buttons) - 1:
                spacer = DivWdg()
                table.add_cell(spacer)
                spacer.add_style("width: 6px")

        return div
コード例 #24
0
ファイル: source_issues.py プロジェクト: Smurgledwerf/custom
    def make_intermediate_unit(my, in_link, work_order_code, in_or_out, type_str):
        inlink_st = in_link.get('__search_key__').split('?')[0]
        if inlink_st == 'twog/work_order_intermediate':
            lookmeup = in_link.get('intermediate_file_code')
        elif inlink_st == 'twog/work_order_passin':
            lookmeup = in_link.get('intermediate_file_code')
        sob = my.server.eval("@SOBJECT(twog/intermediate_file['code','%s'])" % lookmeup)[0]
        table = Table()
        name = sob.get('name')
        description = sob.get('description')
        table.add_attr('width','100%s' % '%')
        table.add_attr('border','1')
        table.add_style('background-color: %s;' % my.color_lookup[in_or_out])
        table.add_row()
        table_src = Table()
        type_cell = table_src.add_cell(type_str)
        type_cell.add_attr('width', '25%s' % '%')
        table_src.add_row()
        checkbox = CheckboxWdg('src_disp_chk_%s' % sob.get('code'))
        checkbox.add_attr('code',sob.get('code'))
        checkbox.add_attr('special_name',name)
        checkbox.add_attr('location',sob.get('location'))
        checkbox.set_value(False)
        #checkbox.set_persistence()
        table_src.add_cell(checkbox)
        table.add_cell(table_src)

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

        long_cell = table.add_cell(info_tbl)
        long_cell.add_attr('width','75%s' % '%')
        table.add_row()
        loc_cell1 = table.add_cell('&nbsp;&nbsp;<u>Location:</u>')
        loc_cell1.add_style('cursor: pointer;')
        loc_cell1.add_behavior(my.location_changer(sob.get('__search_key__')))
        loc_cell2 = table.add_cell(sob.get('location'))
        loc_cell2.add_attr('class', 'sd_location_%s' % sob.get('code'))
        loc_cell2.add_attr('colspan','2')
        return table
コード例 #25
0
ファイル: tool_layout_wdg.py プロジェクト: zieglerm/TACTIC
    def get_info_wdg(self, sobject):

        div = DivWdg()
        div.add_style("margin: 10px 20px 20px 20px")
        div.add_style("padding: 0px 20px")
        #div.add_color("background", "background", -3)
        #div.add_border()
        #div.add_color("color", "color3")
        #div.set_round_corners(5)

        div.add_style("height", "100%")
        div.add_style("position: relative")

        element_names = self.element_names
        config = self.config

        table = Table()
        table.add_style("height", "100%")
        div.add(table)
        for element_name in element_names:
            table.add_row()
            title = Common.get_display_title(element_name)
            td = table.add_cell("%s: " % title)
            td.add_style("width: 200px")
            td.add_style("padding: 5px")

            element = config.get_display_widget(element_name)

            if self.first:
                try:
                    element.handle_layout_behaviors(self.layout_wdg)
                except Exception as e:
                    print "e :", e
                    pass

            element.set_sobject(sobject)
            element.preprocess()
            td = table.add_cell(element)
            td.add_style("padding: 5px")
            #value = sobject.get_value(element_name, no_exception=True) or "N/A"
            #table.add_cell(value)

        show_notes = self.kwargs.get("show_notes")

        if show_notes in [True, 'true']:
            div.add("<br/>")
            from tactic.ui.widget import DiscussionWdg
            search_key = sobject.get_search_key()
            notes_wdg = DiscussionWdg(search_key=search_key)
            notes_wdg.set_sobject(sobject)
            div.add(notes_wdg)

        return div
コード例 #26
0
ファイル: hottoday.py プロジェクト: 2gDigitalPost/custom
    def set_dates_table(self, parent_table, client_deliver_by_date, expected_due_date):
        """
        Sets a table showing the Client Deliver By and Expected Due Date. Both rows have a color depending on whether
        or not the title is past due, due today, or neither. Dates are displayed in a more human readable format.

        :param parent_table: The table containing the date table
        :param client_deliver_by_date: Timestamp in '%Y-%m-%d %H:%M:%S' format
        :param expected_due_date: Timestamp in '%Y-%m-%d %H:%M:%S' format
        :return: None
        """

        date_row = parent_table.add_row()

        date_table = Table()
        date_table.add_style('margin', '2px 0px')

        client_deliver_by_date_status = get_date_status(client_deliver_by_date)
        expected_due_date_status = get_date_status(expected_due_date)

        # Get the color statuses of each date. Set to black if no status found
        client_deliver_by_date_status_color = self.DATE_STATUS_COLOR.get(client_deliver_by_date_status, '#000000')
        expected_due_date_status_color = self.DATE_STATUS_COLOR.get(expected_due_date_status, '#000000')

        # The tr's for our td's in the table
        expected_due_date_row = date_table.add_row()
        client_deliver_by_row = date_table.add_row()

        # Set the row's color
        client_deliver_by_row.add_style('color', client_deliver_by_date_status_color)
        expected_due_date_row.add_style('color', expected_due_date_status_color)

        # Both rows will have the following styles
        for each_row in [client_deliver_by_row, expected_due_date_row]:
            each_row.add_style('font-size', '14px')
            each_row.add_style('font-weight', 'bold')
            each_row.add_style('text-shadow', '1px 1px #000000')

        # Set the td's for Client Deliver By row, get the second cell for the padding-left function below
        date_table.add_cell(data='Client Deliver By:', row=expected_due_date_row)
        expected_due_date_cell = date_table.add_cell(data=expected_due_date.strftime('%m-%d-%Y %I:%M %p'),
                                                     row=expected_due_date_row)

        # Set the td's for Expected Due Date row, get the second cell for the padding-left function below
        date_table.add_cell(data='Expected Due Date:', row=client_deliver_by_row)
        client_deliver_by_cell = date_table.add_cell(data=client_deliver_by_date.strftime('%m-%d-%Y %I:%M %p'),
                                                     row=client_deliver_by_row)

        # Add left side padding to each of the td's with the dates (looks a little better when rendered)
        map(lambda x: x.add_style('padding-left', '5px'), [client_deliver_by_cell, expected_due_date_cell])

        # Append the date table to the parent table and we're done
        parent_table.add_cell(data=date_table, row=date_row)
コード例 #27
0
    def get_display(self):
        audio_configuration_table = Table()
        audio_configuration_table.set_id('audio_configuration_table')
        audio_configuration_table.add_style('margin', '10px')

        if self.lines:
            audio_configuration_table.add_row()
            audio_configuration_table.add_header('Audio Configuration')

            audio_configuration_table.add_row()
            audio_configuration_table.add_header('Channel')
            audio_configuration_table.add_header('Content')
            audio_configuration_table.add_header('Tone')
            audio_configuration_table.add_header('Peak')

            for iterator, line in enumerate(self.lines):
                current_row = audio_configuration_table.add_row()

                audio_configuration_table.add_cell(
                    self.get_text_input_wdg_for_audio_config(
                        'channel-{0}'.format(iterator), 150,
                        line.get_value('channel')))
                audio_configuration_table.add_cell(
                    self.get_text_input_wdg_for_audio_config(
                        'content-{0}'.format(iterator), 150,
                        line.get_value('content')))
                audio_configuration_table.add_cell(
                    self.get_text_input_wdg_for_audio_config(
                        'tone-{0}'.format(iterator), 150,
                        line.get_value('tone')))
                audio_configuration_table.add_cell(
                    self.get_text_input_wdg_for_audio_config(
                        'peak-{0}'.format(iterator), 150,
                        line.get_value('peak')))
                audio_configuration_table.add_cell(
                    HiddenWdg('audio-line-code-{0}'.format(iterator),
                              line.get_code()))
                audio_configuration_table.add_cell(
                    self.get_remove_row_button(line.get_code()))
        else:
            audio_configuration_table.add(
                "No Audio Configuration lines exist yet. Add one?")

        audio_configuration_table.add(self.get_add_row_button())

        main_div = DivWdg()
        main_div.set_id('audio_config_lines_div')
        main_div.add_style('margin', '10px')
        main_div.add(audio_configuration_table)

        return main_div
コード例 #28
0
    def get_header_wdg(my):
        outer = DivWdg()

        div = DivWdg()
        outer.add(div)
        div.add_color("background", "background3")
        div.add_style("padding: 5px")
        div.add_border()

        table = Table()
        table.add_style("margin-left: auto")
        table.add_style("margin-right: auto")
        table.add_color("color", "color")
        table.add_style("font-size: 1.5em")
        table.add_style("font-weight: bold")

        table.add_row()

        # add the month navigators
        date_str = "%s, %s" % (my.MONTHS[my.month - 1], my.year)
        month_wdg = DivWdg()
        month_wdg.add_style("width: 150px")
        month_wdg.add(date_str)

        prev_month_wdg = my.get_prev_month_wdg()
        next_month_wdg = my.get_next_month_wdg()

        table.add_cell(prev_month_wdg)
        td = table.add_cell(month_wdg)
        td.add_style("text-align: center")
        table.add_cell(next_month_wdg)

        div.add(table)

        return outer
コード例 #29
0
ファイル: inbox_wdg.py プロジェクト: 2gDigitalPost/custom
 def get_display(my):   
     from tactic.ui.widget import SObjectCheckinHistoryWdg
     from pyasm.web import DivWdg, HtmlElement, Table, Html, Widget
     new_number = 0
     if 'number' in my.kwargs.keys():
         new_number = int(my.kwargs.get('number'))
     table = Table()
     table.add_behavior(my.get_updater_behavior())
     table.add_style('width: 100%s;' % '%')
     table.add_row()
     mr_cell = table.add_cell('Inbox (%s)' % new_number)
     mr_cell.add_attr('class','inbox_counter')
     #mr_cell.add_behavior(my.get_updater_behavior())
     return table
コード例 #30
0
    def get_header_wdg(self):
        outer = DivWdg()

        div = DivWdg()
        outer.add(div)
        div.add_color("background", "background", -3)
        div.add_style("padding: 5px")
        div.add_border()

        table = Table()
        table.add_style("margin-left: auto")
        table.add_style("margin-right: auto")
        table.add_color("color", "color")
        table.add_style("font-size: 1.5em")
        table.add_style("font-weight: bold")

        table.add_row()

        # add the month navigators
        date_str = "%s, %s" % (self.MONTHS[self.month - 1], self.year)
        month_wdg = DivWdg()
        month_wdg.add_style("width: 150px")
        month_wdg.add(date_str)

        prev_month_wdg = self.get_prev_month_wdg()
        next_month_wdg = self.get_next_month_wdg()

        table.add_cell(prev_month_wdg)
        td = table.add_cell(month_wdg)
        td.add_style("text-align: center")
        table.add_cell(next_month_wdg)

        div.add(table)

        return outer
コード例 #31
0
ファイル: project_wdg.py プロジェクト: mincau/TACTIC
    def get_display(self):

        widget = Widget()

        project = self.get_current_sobject()

        table = Table()
        widget.add(table)
        table.add_style("width: 140px")

        table.add_row()
        table.add_cell("Exists: ")
        table.add_cell("&nbsp;")


        try:
            exists = project.database_exists()
        except:
            #print "Error checking if database exists for project [%s]" % project.get_code()
            exists = False

        if exists:
            table.add_cell( IconWdg("database", IconWdg.DOT_GREEN) )
        else:
            table.add_cell( IconWdg("database", IconWdg.DOT_RED) )


        table.add_row()
        table.add_cell("Version: ")
        last_version_update = project.get_value("last_version_update")
        table.add_cell( last_version_update)
        if last_version_update >= self.version:
            table.add_cell( IconWdg("database", IconWdg.DOT_GREEN) )
        else:
            table.add_cell( IconWdg("database", IconWdg.DOT_RED) )

        widget.add("<br/>")
 
        """
        widget.add("Schema: ")
        widget.add("<br/>")

        widget.add("Context: ")
        widget.add("<br/>")

        widget.add("Data: ")
        widget.add("<br/>")
        """

        return widget
コード例 #32
0
    def get_section_one_table_two(self, label_value_pairs):
        table = Table()
        table.add_style('float', 'left')

        table.add_row()
        table.add_header('Confirm the build of the feature')

        for label_value_pair in label_value_pairs:
            label, value = label_value_pair

            table.add_row()
            table.add_cell(label)
            table.add_cell(self.get_true_false_select_wdg(value))

        return table
コード例 #33
0
    def get_section_one_table_two(self, label_value_pairs):
        table = Table()
        table.add_style('float', 'left')

        table.add_row()
        table.add_header('Confirm the build of the feature')

        for label_value_pair in label_value_pairs:
            label, value = label_value_pair

            table.add_row()
            table.add_cell(label)
            table.add_cell(self.get_true_false_select_wdg(value))

        return table
コード例 #34
0
    def get_section_four_table_one(self, label_value_pairs):
        table = Table()
        table.add_style('float', 'left')

        table.add_row()
        table.add_header('Chapter Thumbnails')

        for label_value_pair in label_value_pairs:
            label, value = label_value_pair

            table.add_row()
            table.add_cell(label)
            table.add_cell(self.get_true_false_select_wdg(value))

        return table
コード例 #35
0
    def get_section_four_table_one(self, label_value_pairs):
        table = Table()
        table.add_style('float', 'left')

        table.add_row()
        table.add_header('Chapter Thumbnails')

        for label_value_pair in label_value_pairs:
            label, value = label_value_pair

            table.add_row()
            table.add_cell(label)
            table.add_cell(self.get_true_false_select_wdg(value))

        return table
コード例 #36
0
    def get_display(self):
        outer_div = DivWdg()
        outer_div.set_id('link_components_to_packages_div')

        table = Table()
        table.add_attr('id', 'link_components_to_packages_table')
        table.add_style('width', '100%')
        table.add_border(style='solid', color='#F2F2F2', size='1px')

        order_code = self.order_sobject.get_code()

        components = get_component_sobjects_from_order_code(order_code)
        packages = get_package_sobjects_from_order_code(order_code)

        existing_component_package_links = self.get_existing_entries(
            components, packages)

        package_row = table.add_row()
        table.add_cell(row=package_row)

        for package in packages:
            table.add_cell(package.get('name'), row=package_row)

        for component in components:
            component_row = table.add_row()
            component_row.set_id(component.get_code())

            table.add_cell(component.get('name'), row=component_row)

            for package in packages:
                checkbox = CheckboxWdg(name='{0}_{1}'.format(
                    component.get_code(), package.get_code()))

                if self.component_package_link_exists(
                        component, package, existing_component_package_links):
                    checkbox.set_checked()

                checkbox_cell = table.add_cell(checkbox)
                checkbox_cell.add_style('text-align', 'center')

        outer_div.add(table)

        submit_button = SubmitWdg('Submit')
        submit_button.add_behavior(self.get_submit_button_behavior())

        outer_div.add(submit_button)

        return outer_div
コード例 #37
0
ファイル: button_new_wdg.py プロジェクト: 0-T-0/TACTIC
    def get_row_wdg(my, buttons, show_title=False):

        table = Table()
        table.set_round_corners(20)
        table.add_style("margin-top: -3px")
        table.add_attr("cellspacing", "0px")
        table.add_attr("cellpadding", "0px")
        table.add_row()

        base = "%s/%s" % (BASE, my.top.get_theme() )

        img = "<img src='%s/MainButtonSlices_left.png'/>" % base
        left = DivWdg(img)
        left.add_style("opacity", ALPHA)
        table.add_cell(left)

        td = table.add_cell()
        td.add_style("border-size: 0")
        for count, button in enumerate(buttons):
            button.add_style("float: left")
            td.add(button)

            if button.get_show_arrow_menu():
                spacer = DivWdg()
                spacer.add_style("float: left")
                td.add(spacer)
                img = "<img src='%s/MainButtonSlices_between.png'/>" % base
                spacer.add(img)
                spacer.add_style("opacity", ALPHA)



            if count < len(buttons)-1:
                spacer = DivWdg()
                spacer.add_style("float: left")
                td.add(spacer)
                img = "<img src='%s/MainButtonSlices_between.png'/>" % base
                spacer.add(img)
                spacer.add_style("opacity", ALPHA)


        img = "<img src='%s/MainButtonSlices_right.png'/>" % base
        right = DivWdg(img)
        right.add_style("opacity", ALPHA)
        table.add_cell(right)

        return table
コード例 #38
0
ファイル: collection_wdg.py プロジェクト: asmboom/TACTIC
    def get_content_wdg(my):

        my.search_type = my.kwargs.get("search_type")
        my.collection_key = my.kwargs.get("collection_key")

        top = DivWdg()
        top.add_class("spt_collection_top")

        if not SearchType.column_exists(my.search_type, "_is_collection"):
            msg_div = DivWdg()
            top.add(msg_div)
            msg_div.add("Search Type [%s] does not support collections" % my.search_type)
            msg_div.add_style("padding: 40px")
            msg_div.add_style("width: 300px")
            msg_div.add_style("margin: 100px auto")
            msg_div.add_border()

            return top


        top.add_style("margin: 5px 20px")


        table = Table()
        top.add(table)
        table.add_row()
        table.add_style("width: 100%")

        #tr, header = table.add_row_cell()
        #header.add_style("height: 40px")

        table.add_row()
        left = table.add_cell()
        left.add_style("vertical-align: top")
        left.add_style("width: 300px")
        left.add_style("max-width: 300px")
        left.add_style("height: auto")

        right = table.add_cell()
        right.add_style("vertical-align: top")
        right.add_style("width: auto")
        right.add_style("height: auto")

        left.add(my.get_collection_wdg())
        right.add(my.get_right_content_wdg())

        return top
コード例 #39
0
ファイル: project_wdg.py プロジェクト: rajubuddha/TACTIC
    def get_display(my):

        widget = Widget()

        project = my.get_current_sobject()

        table = Table()
        widget.add(table)
        table.add_style("width: 140px")

        table.add_row()
        table.add_cell("Exists: ")
        table.add_cell("&nbsp;")

        try:
            exists = project.database_exists()
        except:
            #print "Error checking if database exists for project [%s]" % project.get_code()
            exists = False

        if exists:
            table.add_cell(IconWdg("database", IconWdg.DOT_GREEN))
        else:
            table.add_cell(IconWdg("database", IconWdg.DOT_RED))

        table.add_row()
        table.add_cell("Version: ")
        last_version_update = project.get_value("last_version_update")
        table.add_cell(last_version_update)
        if last_version_update >= my.version:
            table.add_cell(IconWdg("database", IconWdg.DOT_GREEN))
        else:
            table.add_cell(IconWdg("database", IconWdg.DOT_RED))

        widget.add("<br/>")
        """
        widget.add("Schema: ")
        widget.add("<br/>")

        widget.add("Context: ")
        widget.add("<br/>")

        widget.add("Data: ")
        widget.add("<br/>")
        """

        return widget
コード例 #40
0
    def get_display(self):
        audio_configuration_table = Table()
        audio_configuration_table.set_id('audio_configuration_table')
        audio_configuration_table.add_style('margin', '10px')

        if self.lines:
            audio_configuration_table.add_row()
            audio_configuration_table.add_header('Audio Configuration')

            audio_configuration_table.add_row()
            audio_configuration_table.add_header('Channel')
            audio_configuration_table.add_header('Content')
            audio_configuration_table.add_header('Tone')
            audio_configuration_table.add_header('Peak')

            for iterator, line in enumerate(self.lines):
                current_row = audio_configuration_table.add_row()

                audio_configuration_table.add_cell(
                    self.get_text_input_wdg_for_audio_config('channel-{0}'.format(iterator), 150, line.get_value('channel'))
                )
                audio_configuration_table.add_cell(
                    self.get_text_input_wdg_for_audio_config('content-{0}'.format(iterator), 150, line.get_value('content'))
                )
                audio_configuration_table.add_cell(
                    self.get_text_input_wdg_for_audio_config('tone-{0}'.format(iterator), 150, line.get_value('tone'))
                )
                audio_configuration_table.add_cell(
                    self.get_text_input_wdg_for_audio_config('peak-{0}'.format(iterator), 150, line.get_value('peak'))
                )
                audio_configuration_table.add_cell(
                    HiddenWdg('audio-line-code-{0}'.format(iterator), line.get_code())
                )
                audio_configuration_table.add_cell(
                    self.get_remove_row_button(line.get_code())
                )
        else:
            audio_configuration_table.add("No Audio Configuration lines exist yet. Add one?")

        audio_configuration_table.add(self.get_add_row_button())

        main_div = DivWdg()
        main_div.set_id('audio_config_lines_div')
        main_div.add_style('margin', '10px')
        main_div.add(audio_configuration_table)

        return main_div
コード例 #41
0
    def get_content_wdg(my):

        my.search_type = my.kwargs.get("search_type")
        my.collection_key = my.kwargs.get("collection_key")

        top = DivWdg()
        top.add_class("spt_collection_top")

        if not SearchType.column_exists(my.search_type, "_is_collection"):
            msg_div = DivWdg()
            top.add(msg_div)
            msg_div.add("Search Type [%s] does not support collections" %
                        my.search_type)
            msg_div.add_style("padding: 40px")
            msg_div.add_style("width: 300px")
            msg_div.add_style("margin: 100px auto")
            msg_div.add_border()

            return top

        top.add_style("margin: 5px 20px")

        table = Table()
        top.add(table)
        table.add_row()
        table.add_style("width: 100%")

        #tr, header = table.add_row_cell()
        #header.add_style("height: 40px")

        table.add_row()
        left = table.add_cell()
        left.add_style("vertical-align: top")
        left.add_style("width: 300px")
        left.add_style("max-width: 300px")
        left.add_style("height: auto")

        right = table.add_cell()
        right.add_style("vertical-align: top")
        right.add_style("width: auto")
        right.add_style("height: auto")

        left.add(my.get_collection_wdg())
        right.add(my.get_right_content_wdg())

        return top
コード例 #42
0
    def get_add_chat_wdg(my):

        div = DivWdg()
        div.add_border()
        div.add_style("padding: 20px")
        div.add_class("spt_add_chat_top")

        table = Table()
        table.add_style("width: auto")
        div.add(table)
        table.add_row()

        text = TextInputWdg(title="user", icon="USER_ADD")
        table.add_cell(text)
        text.add_class("spt_add_chat_user")

        add_button = ActionButtonWdg(title="Start Chat")
        table.add_cell(add_button)
        add_button.add_behavior({
            'type':
            'click_up',
            'cbjs_action':
            '''
            var top = bvr.src_el.getParent(".spt_add_chat_top");
            var el = top.getElement(".spt_add_chat_user");
            var user = el.value;
            if (!user) {
                alert("Specify a valid user to chat with");
                return;
            }

            // new chat
            var server = TacticServerStub.get();
            var category = "chat";

            var class_name = 'tactic.ui.app.ChatCmd';
            var kwargs = {
                users: [user]
            }
            server.execute_cmd(class_name, kwargs);

            spt.panel.refresh(bvr.src_el);
            '''
        })

        return div
コード例 #43
0
ファイル: message_wdg.py プロジェクト: 0-T-0/TACTIC
    def get_add_chat_wdg(my):

        div = DivWdg()
        div.add_border()
        div.add_style("padding: 20px")
        div.add_class("spt_add_chat_top")

        table = Table()
        table.add_style("width: auto")
        div.add(table)
        table.add_row()

        text = TextInputWdg(title="user", icon="USER_ADD")
        table.add_cell(text)
        text.add_class("spt_add_chat_user")


        add_button = ActionButtonWdg(title="Start Chat")
        table.add_cell(add_button)
        add_button.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            var top = bvr.src_el.getParent(".spt_add_chat_top");
            var el = top.getElement(".spt_add_chat_user");
            var user = el.value;
            if (!user) {
                alert("Specify a valid user to chat with");
                return;
            }

            // new chat
            var server = TacticServerStub.get();
            var category = "chat";

            var class_name = 'tactic.ui.app.ChatCmd';
            var kwargs = {
                users: [user]
            }
            server.execute_cmd(class_name, kwargs);

            spt.panel.refresh(bvr.src_el);
            '''
        } )

        return div
コード例 #44
0
    def get_display(self):
        outer_div = DivWdg()
        outer_div.set_id('link_components_to_packages_div')

        table = Table()
        table.add_attr('id', 'link_components_to_packages_table')
        table.add_style('width', '100%')
        table.add_border(style='solid', color='#F2F2F2', size='1px')

        order_code = self.order_sobject.get_code()

        components = get_component_sobjects_from_order_code(order_code)
        packages = get_package_sobjects_from_order_code(order_code)

        existing_component_package_links = self.get_existing_entries(components, packages)

        package_row = table.add_row()
        table.add_cell(row=package_row)

        for package in packages:
            table.add_cell(package.get('name'), row=package_row)

        for component in components:
            component_row = table.add_row()
            component_row.set_id(component.get_code())

            table.add_cell(component.get('name'), row=component_row)

            for package in packages:
                checkbox = CheckboxWdg(name='{0}_{1}'.format(component.get_code(), package.get_code()))

                if self.component_package_link_exists(component, package, existing_component_package_links):
                    checkbox.set_checked()

                checkbox_cell = table.add_cell(checkbox)
                checkbox_cell.add_style('text-align', 'center')

        outer_div.add(table)

        submit_button = SubmitWdg('Submit')
        submit_button.add_behavior(self.get_submit_button_behavior())

        outer_div.add(submit_button)

        return outer_div
コード例 #45
0
ファイル: error_wdg.py プロジェクト: hellios78/TACTIC
    def get_display(my):

        box = DivWdg(css="login")

        box.add_style("margin-top: auto")
        box.add_style("margin-bottom: auto")
        box.add_style("text-align: center")

        script = HtmlElement.script(
            """function login(e) {
                if (!e) var e = window.event;
                if (e.keyCode == 13) {
                submit_icon_button('Submit');
                }}
                """
        )

        div = DivWdg()
        div.add_style("margin: 0px 0px")
        div.add_class("centered")

        div.add(HtmlElement.br(6))
        sthpw = SpanWdg("SOUTHPAW TECHNOLOGY INC", css="login_sthpw")
        sthpw.add_style("color: #333")
        div.add(sthpw)
        div.add(HtmlElement.br(2))

        div.add(my.get_error_wdg())
        box.add(div)

        widget = Widget()
        # widget.add( HtmlElement.br(3) )
        table = Table()
        table.add_style("width: 100%")
        table.add_style("height: 85%")
        table.add_row()
        td = table.add_cell()
        td.add_style("vertical-align: middle")
        td.add_style("text-align: center")
        td.add_style("background: transparent")
        td.add(box)
        widget.add(table)

        return widget
コード例 #46
0
    def get_row_wdg(my, buttons, show_title=False):

        table = Table()
        table.set_round_corners(20)
        table.add_style("margin-top: -3px")
        table.add_attr("cellspacing", "0px")
        table.add_attr("cellpadding", "0px")
        table.add_row()

        base = "%s/%s" % (BASE, my.top.get_theme())

        img = "<img src='%s/MainButtonSlices_left.png'/>" % base
        left = DivWdg(img)
        left.add_style("opacity", ALPHA)
        table.add_cell(left)

        td = table.add_cell()
        td.add_style("border-size: 0")
        for count, button in enumerate(buttons):
            button.add_style("float: left")
            td.add(button)

            if button.get_show_arrow_menu():
                spacer = DivWdg()
                spacer.add_style("float: left")
                td.add(spacer)
                img = "<img src='%s/MainButtonSlices_between.png'/>" % base
                spacer.add(img)
                spacer.add_style("opacity", ALPHA)

            if count < len(buttons) - 1:
                spacer = DivWdg()
                spacer.add_style("float: left")
                td.add(spacer)
                img = "<img src='%s/MainButtonSlices_between.png'/>" % base
                spacer.add(img)
                spacer.add_style("opacity", ALPHA)

        img = "<img src='%s/MainButtonSlices_right.png'/>" % base
        right = DivWdg(img)
        right.add_style("opacity", ALPHA)
        table.add_cell(right)

        return table
コード例 #47
0
    def get_display_old(my):
        '''This is NOT used, just used as a reference for the old method'''
        icon_id = 'upload_div'
        div = DivWdg()

        if my.get_option('upload_type') == 'arbitrary':
            counter = HiddenWdg('upload_counter', '0')
            div.add(counter)
            icon = IconButtonWdg('add upload', icon=IconWdg.ADD)
            icon.set_id(icon_id)
            icon.add_event('onclick', "Common.add_upload_input('%s','%s','upload_counter')" \
                %(icon_id, my.get_input_name()))
            div.add(icon)

        table = Table()
        table.set_class("minimal")
        table.add_style("font-size: 0.8em")

        names = my.get_option('names')
        required = my.get_option('required')
        if not names:
            my.add_upload(table, my.name)
        else:
            names = names.split('|')
            if required:
                required = required.split('|')
                if len(required) != len(names):
                    raise TacticException(
                        'required needs to match the number of names if defined in the config file.'
                    )
            # check for uniqueness in upload_names
            if len(set(names)) != len(names):
                raise TacticException(
                    '[names] in the config file must be unique')

            for idx, name in enumerate(names):
                if required:
                    is_required = required[idx] == 'true'
                else:
                    is_required = False
                my.add_upload(table, name, is_required)

        table.add_row()
コード例 #48
0
ファイル: layout_summary_wdg.py プロジェクト: zieglerm/TACTIC
    def get_display(self):
        sobject = self.get_current_sobject()
        task_table = Table(css="minimal")
        task_table.add_style("width: 300px")
        search_key = sobject.get_search_key()
        tasks = self.tasks_dict.get(search_key)
        if tasks:
            for task in tasks:
                task_table.add_row()
                process = task.get_value("process")
                td = task_table.add_cell(HtmlElement.i(process))
                task_table.add_data(':')
                td.add_style("vertical-align: top")
                td.add_style("text-align: right")
                td.add_style("width: 75px")
                td.add_style("padding: 2px")
                task_table.add_cell(task.get_value("description"))

        return task_table
コード例 #49
0
ファイル: layout_summary_wdg.py プロジェクト: 0-T-0/TACTIC
    def get_display(my):
        sobject = my.get_current_sobject()
        task_table = Table(css="minimal")
        task_table.add_style("width: 300px")
        search_key = sobject.get_search_key()
        tasks = my.tasks_dict.get(search_key)
        if tasks:
            for task in tasks:
                task_table.add_row()
                process = task.get_value("process")
                td = task_table.add_cell(HtmlElement.i(process))
                task_table.add_data(':')
                td.add_style("vertical-align: top")
                td.add_style("text-align: right")
                td.add_style("width: 75px")
                td.add_style("padding: 2px")
                task_table.add_cell( task.get_value("description") )

        return task_table
コード例 #50
0
    def get_display(my):

        box = DivWdg(css='login')

        box.add_style("margin-top: auto")
        box.add_style("margin-bottom: auto")
        box.add_style("text-align: center")

        script = HtmlElement.script('''function login(e) {
                if (!e) var e = window.event;
                if (e.keyCode == 13) {
                submit_icon_button('Submit');
                }}
                ''')

        div = DivWdg()
        div.add_style("margin: 0px 0px")
        div.add_class("centered")

        div.add(HtmlElement.br(6))
        sthpw = SpanWdg("SOUTHPAW TECHNOLOGY INC", css="login_sthpw")
        sthpw.add_style("color: #333")
        div.add(sthpw)
        div.add(HtmlElement.br(2))

        div.add(my.get_error_wdg())
        box.add(div)

        widget = Widget()
        #widget.add( HtmlElement.br(3) )
        table = Table()
        table.add_style("width: 100%")
        table.add_style("height: 85%")
        table.add_row()
        td = table.add_cell()
        td.add_style("vertical-align: middle")
        td.add_style("text-align: center")
        td.add_style("background: transparent")
        td.add(box)
        widget.add(table)

        return widget
コード例 #51
0
    def get_audio_configuration_section_table(self, name, id, float_left=True):
        table = Table()

        if float_left:
            table.add_style('float: left')

        table.add_style('margin', '10px')
        table.add_row()
        table.add_header(name)

        for i in range(1, 9):
            table.add_row()

            label_cell = table.add_cell('TRK. {0}'.format(i))
            label_cell.add_style('padding', '10px 10px 10px 0px')

            table.add_cell(self.get_language_select_wdg(id + '_language_' + str(i)))
            table.add_cell(self.get_type_select_wdg(id + '_type_' + str(i)))

        return table
コード例 #52
0
    def get_program_format_table(self):
        program_format_table = Table()
        program_format_table.add_style('float', 'left')

        program_format_table.add_row()
        program_format_table.add_header('Program Format')
        program_format_table.add_header()

        text_input_name_id_pairs = [
            ('Roll-up (blank)', 'roll_up_blank'),
            ('Bars/Tone', 'bars_tone'),
            ('Black/Silence', 'black_silence_1'),
            ('Slate/Silence', 'slate_silence'),
            ('Black/Silence', 'black_silence_2'),
            ('Start of Program', 'start_of_program'),
            ('End of Program', 'end_of_program')
        ]

        self.setup_table_rows_with_input_boxes(program_format_table, text_input_name_id_pairs, timecode=True)

        return program_format_table
コード例 #53
0
    def get_audio_configuration_section_table(self, name, id, float_left=True):
        table = Table()

        if float_left:
            table.add_style('float: left')

        table.add_style('margin', '10px')
        table.add_row()
        table.add_header(name)

        for i in range(1, 9):
            table.add_row()

            label_cell = table.add_cell('TRK. {0}'.format(i))
            label_cell.add_style('padding', '10px 10px 10px 0px')

            table.add_cell(
                self.get_language_select_wdg(id + '_language_' + str(i)))
            table.add_cell(self.get_type_select_wdg(id + '_type_' + str(i)))

        return table
コード例 #54
0
    def get_container_with_top_row(my):

        # Getting [ Title| Machine Room | Blah | Blah table headings ]

        container = DivWdg()
        container.add_class('container')
        container.add_style('width: 1500px !important;')
        
        top_table_container = DivWdg()
        top_table_container.add_style('overflow-y: scroll !important;')

        top_table = Table()

        top_table.add_class('table table-bordered')
        top_table.add_style('table-layout: fixed;')
        top_table.add_row()
        
        title_cell = top_table.add_cell("Title")
        title_cell.add_class('col-md-1')
       
        second_cell = top_table.add_cell("Machine Room")
        second_cell.add_class('col-md-1')
        
        third_cell = top_table.add_cell("Compression")
        third_cell.add_class('col-md-1')

        fourth_cell = top_table.add_cell("Audio")
        fourth_cell.add_class('col-md-1')

        fifth_cell = top_table.add_cell("QC")
        fifth_cell.add_class('col-md-1')

        sixth_cell = top_table.add_cell("EDel")
        sixth_cell.add_class('col-md-1')

        top_table_container.add(top_table)

        container.add(top_table_container)
        
        return container
コード例 #55
0
    def get_display(my):

        div = DivWdg()
        table = Table()
        table.set_class("minimal")
        table.add_style("font-size: 0.8em")
        table.add_row()
        table.add_cell("File")
        table.add_cell('<input type="file" name="%s"/>' % (my.get_input_name())
        )
        table.add_row()
        table.add_cell("Context")

        select = SelectWdg("%s|context" % my.get_input_name() )
        select.set_option("values", "publish|roughDesign|colorFinal|colorKey")
        table.add_cell(select)

        table.add_row()
        table.add_cell("Description")
        table.add_cell('<textarea name="%s|description"></textarea>' % my.get_input_name())
        div.add(table)

        return div
コード例 #56
0
    def configure_category(my, title, category, options):
        div = DivWdg()

        title_wdg = DivWdg()
        div.add(title_wdg)

        #from tactic.ui.widget.swap_display_wdg import SwapDisplayWdg
        #swap = SwapDisplayWdg()
        #div.add(swap)

        title_wdg.add("<b>%s</b>" % title)

        table = Table()
        div.add(table)
        #table.add_color("color", "color")
        table.add_style("color: #000")
        table.add_style("margin: 20px")

        for option in options:
            table.add_row()
            display_title = Common.get_display_title(option)
            td = table.add_cell("%s: " % display_title)
            td.add_style("width: 150px")

            if option.endswith('password'):
                text = PasswordInputWdg(name="%s/%s" % (category, option))
            else:
                text = TextInputWdg(name="%s/%s" % (category, option))

            value = Config.get_value(category, option)
            if value:
                text.set_value(value)

            table.add_cell(text)

        return div
コード例 #57
0
ファイル: simple_search_wdg.py プロジェクト: mwx1993/TACTIC
    def get_top(my):
        top = my.top
        top.add_color("background", "background", -5)
        top.add_style("margin-bottom: -2px")
        top.add_class("spt_filter_top")

        table = Table()
        top.add(table)

        table.add_style("margin-left: auto")
        table.add_style("margin-right: auto")
        table.add_style("width: 100%")


        tr = table.add_row()

        if not my.content:
            my.content = DivWdg()
            my.content.add("No Content")

        td = table.add_cell()
        td.add(my.content)
        my.content.add_style("margin: -2 -1 -2 -2")


        show_search = my.kwargs.get("show_search")
        if show_search in [False, 'false']:
            show_search = False
        else:
            show_search = True
        if show_search:
            search_wdg = my.get_search_wdg()
            table.add_row()
            search_wdg.add_style("float: right")

            search_wdg.add_style("padding-top: 6px")
            search_wdg.add_style("padding-left: 10px")
            search_wdg.add_style("height: 33px")

            td = table.add_cell()
            td.add(search_wdg)
            td.add_style("padding: 10px 20px")
            #td.add_border()
            #td.add_color("background", "background", -10)



        hidden = HiddenWdg("prefix", my.prefix)
        top.add(hidden)
        # this cannot be spt_search as it will confuse spt.dg_table.search_cbk() 
        top.add_class("spt_simple_search")

        return top
コード例 #58
0
ファイル: main_wdg.py プロジェクト: zieglerm/TACTIC
    def get_display(self):

        top = DivWdg()
        top.add_border()
        top.add_style("padding: 10px")
        top.add_color("color", "color")
        top.add_gradient("background", "background", 0, -5)
        #top.add_style("height: 550px")

        top.add_behavior({
            'type':
            'load',
            'cbjs_action':
            '''
            spt.named_events.fire_event("side_bar|hide_now", {} );
            '''
        })

        project = Project.get()
        title = DivWdg()
        title.add("Project Startup and Configuration")
        title.add_style("font-size: 18px")
        title.add_style("font-weight: bold")
        title.add_style("text-align: center")
        title.add_style("padding: 10px")
        title.add_style("margin: -10px -10px 10px -10px")

        top.add(title)
        title.add_gradient("background", "background3", 5, -10)

        shelf = DivWdg()
        top.add(shelf)
        shelf.add_style("margin-left: -8px")
        shelf.add_style("width: 130px")

        button_div = DivWdg()
        shelf.add(button_div)
        button_div.add_style("float: left")
        button_div.add_style("margin-top: -3px")

        security = Environment.get_security()
        view_side_bar = security.check_access("builtin",
                                              "view_side_bar",
                                              "allow",
                                              default='allow')
        if view_side_bar:
            button = IconButtonWdg(title="Side Bar", icon=IconWdg.ARROW_LEFT)
            button_div.add(button)
            shelf.add("Toggle Side Bar")
            shelf.add_attr("title", "Toggle Side Bar (or press '1')")
            button.add_behavior({
                'type':
                'click_up',
                'cbjs_action':
                '''
                spt.named_events.fire_event("side_bar|toggle");
                '''
            })
            shelf.add_behavior({
                'type':
                'click_up',
                'cbjs_action':
                '''
                spt.named_events.fire_event("side_bar|toggle");
                '''
            })
            shelf.add_class("hand")
        else:
            shelf.add("&nbsp;")

        search_wdg = Table()
        top.add(search_wdg)
        search_wdg.add_row()

        search_wdg.add_class("spt_main_top")
        search_wdg.add_style("padding: 10px")
        search_wdg.add_style("margin: 20px auto")
        search_wdg.add_style("width: 430px")

        td = search_wdg.add_cell("Search: ")
        td.add_style("vertical-align: top")
        td.add_style("padding-top: 8px")

        custom_cbk = {}
        custom_cbk['enter'] = '''
            var top = bvr.src_el.getParent(".spt_main_top");
            var search_el = top.getElement(".spt_main_search");
            var keywords = search_el.value;

            if (keywords != '') {
                var class_name = 'tactic.ui.panel.ViewPanelWdg';
                var kwargs = {
                    'search_type': 'sthpw/sobject_list',
                    'view': 'result_list',
                    'keywords': keywords,
                    'simple_search_view': 'simple_filter',
                    //'show_shelf': false,
                }
                spt.tab.set_main_body_tab();
                spt.tab.add_new("Search Results", "Search Results", class_name, kwargs);
            }
        '''

        from tactic.ui.input import TextInputWdg, LookAheadTextInputWdg
        #text = TextInputWdg(name="search")
        text = LookAheadTextInputWdg(name="search",
                                     custom_cbk=custom_cbk,
                                     width='280',
                                     height='42px')
        #text = TextWdg("search")
        text.add_class("spt_main_search")
        text.add_style("width: 290px")

        search_wdg.add_cell(text)
        search_wdg.add_style("font-weight: bold")
        search_wdg.add_style("font-size: 16px")

        icon_div = DivWdg()
        td = search_wdg.add_cell(icon_div)
        td.add_style("vertical-align: top")
        icon_div.add_style("width: 38px")
        icon_div.add_style("height: 27px")
        icon_div.add_style("padding-top: 7px")
        icon_div.add_style("padding-left: 4px")
        icon_div.add_style("text-align: center")
        #icon_div.add_gradient("background", "background3", 15, -10)
        icon_div.add_color("background", "background3", 10)
        over_color = icon_div.get_color("background3", 0)
        out_color = icon_div.get_color("background3", 10)
        icon_div.set_round_corners(5)
        icon_div.set_box_shadow("1px 1px 1px 1px")
        icon = IconWdg("Search", IconWdg.SEARCH_32, width=24)
        icon_div.add(icon)
        button = icon_div
        icon_div.add_class("hand")
        icon_div.add_behavior({
            'type':
            'mouseover',
            'color':
            over_color,
            'cbjs_action':
            '''
            bvr.src_el.setStyle("background", bvr.color);
            '''
        })
        icon_div.add_behavior({
            'type':
            'mouseout',
            'color':
            out_color,
            'cbjs_action':
            '''
            bvr.src_el.setStyle("background", bvr.color);
            bvr.src_el.setStyle("box-shadow", "1px 1px 1px 1px #999");
            bvr.src_el.setStyle("margin-top", "-5");
            bvr.src_el.setStyle("margin-right", "0");
            '''
        })
        icon_div.add_behavior({
            'type':
            'click',
            'color':
            out_color,
            'cbjs_action':
            '''
            bvr.src_el.setStyle("box-shadow", "0px 0px 1px 1px #999");
            bvr.src_el.setStyle("margin-top", "-3");
            bvr.src_el.setStyle("margin-right", "-2");
            '''
        })
        icon_div.add_behavior({
            'type':
            'click_up',
            'color':
            out_color,
            'cbjs_action':
            '''
            bvr.src_el.setStyle("box-shadow", "1px 1px 1px 1px #999");
            bvr.src_el.setStyle("margin-top", "-5");
            bvr.src_el.setStyle("margin-right", "0");
            '''
        })

        button.add_behavior({
            'type':
            'click_up',
            'cbjs_action':
            '''
            var top = bvr.src_el.getParent(".spt_main_top");
            var search_el = top.getElement(".spt_main_search");
            var keywords = search_el.value;

            if (keywords == '') {
                return;
            }

            var class_name = 'tactic.ui.panel.ViewPanelWdg';
            var kwargs = {
                'search_type': 'sthpw/sobject_list',
                'view': 'result_list',
                'keywords': keywords,
                'simple_search_view': 'simple_filter',
                //'show_shelf': false,
            }
            spt.tab.set_main_body_tab();
            spt.tab.add_new("Search Results", "Search Results", class_name, kwargs);
            '''
        })

        #desc = DivWdg()
        #top.add(desc)
        #desc.add("Dashboard")
        #desc.add_style("width: 600px")

        # create a bunch of panels
        table = Table()
        table.add_color("color", "color")
        table.add_style("margin-bottom: 20px")
        table.center()
        top.add(table)
        table.add_row()

        #security = Environment.get_security()
        #if not security.check_access("builtin", "view_site_admin", "allow"):

        td = table.add_cell()
        td.add_style("padding: 3px")
        td.add_style("vertical-align: top")
        title = "Configuration"
        #description = '''All TACTIC projects can be uniquely designed and managed using our configuration tools.'''
        description = '''Configure a Project from start to finish.'''
        image = "<img src='/context/icons/64x64/configuration_64.png'/>"
        behavior = {
            'type':
            'click_up',
            'cbjs_action':
            '''
            spt.tab.set_main_body_tab();
            var class_name = 'tactic.ui.startup.ProjectConfigWdg';
            var kwargs = {
                help_alias: 'project-startup-configuration'
                };
            spt.tab.add_new("project_configuration", "Configuration", class_name, kwargs);
            '''
        }
        config_wdg = self.get_main_section_wdg(title, description, image,
                                               behavior)
        td.add(config_wdg)

        # Manage Users
        td = table.add_cell()
        td.add_style("vertical-align: top")
        td.add_style("padding: 3px")
        title = "Manage Users and Security"
        image = "<img src='/context/icons/64x64/dashboard_64.png'/>"
        image = DivWdg()
        image_link = "<div style='margin-bottom: -64px'><img src='/context/icons/64x64/lock_64.png'/></div>"
        image.add(image_link)

        image1 = IconWdg("Manage Users", IconWdg.USER_32)
        image2 = IconWdg("Manage Users", IconWdg.USER_32)
        image3 = IconWdg("Manage Users", IconWdg.USER_32)
        image4 = IconWdg("Manage Users", IconWdg.USER_32)
        image.add(image1)
        image.add(image2)
        image.add("<br/>")
        image.add(image3)
        image.add(image4)
        description = '''Manage users that can access the system'''

        behavior = {
            'type':
            'click_up',
            'cbjs_action':
            '''
        spt.tab.set_main_body_tab();
        var class_name = 'tactic.ui.startup.UserConfigWdg';
        var kwargs = {
            help_alias: 'project-startup-manage-users'
            };
        spt.tab.add_new("manage_user", "Manage Users", class_name, kwargs);
        '''
        }
        manage_users_wdg = self.get_main_section_wdg(title, description, image,
                                                     behavior)
        td.add(manage_users_wdg)

        # custom layout editor
        td = table.add_cell()
        td.add_style("padding: 3px")
        td.add_style("vertical-align: top")
        title = "Custom Layouts"
        description = '''Create interfaces using the Custom Layout Editor.'''
        image = "<img src='/context/icons/64x64/layout_64.png'/>"
        behavior = {
            'type':
            'click_up',
            'cbjs_action':
            '''
            spt.tab.set_main_body_tab();
            var class_name = 'tactic.ui.tools.CustomLayoutEditWdg';
            var kwargs = {
                help_alias: 'project-startup-configuration'
                };
            spt.tab.add_new("custom_layout_editor", "Custom Layout Editor", class_name, kwargs);
            '''
        }
        config_wdg = self.get_main_section_wdg(title, description, image,
                                               behavior)
        td.add(config_wdg)

        tr = table.add_row()

        # Plugins
        td = table.add_cell()
        td.add_style("vertical-align: top")
        td.add_style("padding: 3px")
        title = "Manage Plugins"
        image = IconWdg("Manage Plugins", IconWdg.PLUGIN_32)
        #image = "<img src='/context/icons/64x64/dashboard_64.png'/>"
        description = '''Upload, install, remove and create TACTIC plugins.'''

        behavior = {
            'type':
            'click_up',
            'cbjs_action':
            '''
        var class_name = 'tactic.ui.app.PluginWdg';
        spt.tab.set_main_body_tab();
        spt.tab.add_new("plugins", "Manage Plugin", class_name, kwargs);
        '''
        }
        plugin_wdg = self.get_small_section_wdg(title, description, image,
                                                behavior)
        td.add(plugin_wdg)

        # Examples
        td = table.add_cell()
        td.add_style("vertical-align: top")
        td.add_style("padding: 3px")
        title = "Tools"
        image = IconWdg("Tools", IconWdg.SHARE_32)
        #image = "<img src='/context/icons/64x64/dashboard_64.png'/>"
        description = '''A collection of example views.'''

        behavior = {
            'type':
            'click_up',
            'cbjs_action':
            '''
        var class_name = 'tactic.ui.startup.ToolsWdg';
        spt.tab.set_main_body_tab();
        spt.tab.add_new("tools", "Tools", class_name, kwargs);
        '''
        }
        share_wdg = self.get_small_section_wdg(title, description, image,
                                               behavior)
        td.add(share_wdg)

        # Share
        """
        td = table.add_cell()
        td.add_style("vertical-align: top")
        td.add_style("padding: 3px")
        title = "Shares"
        image = IconWdg("Shares", IconWdg.SHARE_32)
        #image = "<img src='/context/icons/64x64/dashboard_64.png'/>"
        description = '''Share project with other TACTIC installs.'''

        behavior = {
        'type': 'click_up',
        'cbjs_action': '''
        var class_name = 'tactic.ui.startup.ShareWdg';
        spt.tab.set_main_body_tab();
        spt.tab.add_new("shares", "Shares", class_name, kwargs);
        '''
        }
        share_wdg = self.get_small_section_wdg(title, description, image, behavior)
        td.add(share_wdg)
        """

        # Advanced
        td = table.add_cell()
        td.add_style("vertical-align: top")
        td.add_style("padding: 3px")
        title = "Advanced Setup"
        image = IconWdg("Advanced", IconWdg.ADVANCED_32)
        #image = "<img src='/context/icons/64x64/dashboard_64.png'/>"
        description = '''A set of advanced configuration tools.'''

        behavior = {
            'type':
            'click_up',
            'cbjs_action':
            '''
        var class_name = 'tactic.ui.app.ProjectStartWdg';
        spt.tab.set_main_body_tab()
        spt.tab.add_new("project_setup", "Project Setup", class_name)
        '''
        }
        share_wdg = self.get_small_section_wdg(title, description, image,
                                               behavior)
        td.add(share_wdg)
        """
        td = table.add_cell()
        td.add_style("vertical-align: top")
        td.add_style("padding: 3px")
	title = "Documentation"

        description = '''TACTIC Documentation.
        * Project Setup Documentation<br/>
        <br/>
        * End User Documentation<br/>
        <br/>
        * Developer Documentation<br/>
        <br/>
        * System Administrator Documentation<br/>
        <br/>
        '''
        image = "<img src='/context/images/getting_started_pipeline.png'/>"
        behavior = {
        'type': 'click_up',
        'cbjs_action': '''
        spt.help.load_alias("main")
        '''
        }
        doc_wdg = self.get_section_wdg(title, description, image, behavior)
        td.add(doc_wdg)
        """

        tr, td = table.add_row_cell()
        td.add_style("font-size: 14px")
        td.add("<br/>")

        from misc_wdg import QuickLinksWdg
        quick_links_wdg = QuickLinksWdg()
        td.add(quick_links_wdg)

        #td = table.add_cell()
        #totals_wdg = self.get_totals_wdg()
        #td.add(totals_wdg)

        return top
コード例 #59
0
    def get_display(my):

        top = my.top
        top.add_class("spt_changelist_content")
        my.set_as_panel(top)
        top.add_color("color", "color")
        top.add_color("background", "background")
        #top.add_border()
        #top.add_style("padding", "10px")
        top.add_style("min-width: 600px")
        top.add_style("min-height: 400px")

        top.add_behavior({'type': 'load', 'cbjs_action': scm_get_onload_js()})

        sync_dir = Environment.get_sandbox_dir()
        # HARD CODED
        project = Project.get()
        depot = project.get_value("location", no_exception=True)
        if not depot:
            depot = project.get_code()
        location = '//%s' % depot

        changelist = my.kwargs.get("changelist")
        if not changelist:
            changelist = WidgetSettings.get_value_by_key("current_changelist")
        else:
            WidgetSettings.set_value_by_key("current_changelist", changelist)

        if not changelist:
            changelist = 'default'

        changelists = my.kwargs.get("changelists")
        if not changelists:
            changelists = []
        elif isinstance(changelists, basestring):
            changelists = changelists.replace("'", '"')
            changelists = jsonloads(changelists)

        top.add_behavior({
            'type':
            'load',
            'sync_dir':
            sync_dir,
            'depot':
            depot,
            'cbjs_action':
            '''
            spt.scm.sync_dir = bvr.sync_dir;
            spt.scm.depot = bvr.depot;
            '''
        })

        inner = DivWdg()
        top.add(inner)

        table = Table()
        inner.add(table)
        table.add_style("width: 100%")
        table.add_color("background", "background", -3)

        table.add_row()
        th = table.add_header("")

        th = table.add_header("Changelist")
        th.add_style("text-align: left")
        th = table.add_header("Description")
        th.add_style("text-align: left")
        th = table.add_header("# Items")
        th.add_style("text-align: left")
        th = table.add_header("Status")
        th.add_style("text-align: left")
        th = table.add_header("View")
        th.add_style("text-align: left")
        th = table.add_header("Delete")
        th.add_style("text-align: left")
        #table.set_unique_id()
        #table.add_smart_styles("spt_changelist_item", {
        #    'text-align: right'
        #    } ))

        bgcolor = table.get_color("background", -8)
        table.add_relay_behavior({
            'type':
            'mouseover',
            'bvr_match_class':
            'spt_changelist_item',
            'bgcolor':
            bgcolor,
            'cbjs_action':
            '''
            bvr.src_el.setStyle("background-color", bvr.bgcolor);
            '''
        })
        table.add_relay_behavior({
            'type':
            'mouseout',
            'bvr_match_class':
            'spt_changelist_item',
            'cbjs_action':
            '''
            bvr.src_el.setStyle("background-color", '');
            '''
        })

        table.add_relay_behavior({
            'type':
            'mouseup',
            'bvr_match_class':
            "spt_changelist_radio",
            'cbjs_action':
            '''

            var changelist = bvr.src_el.value;
            var top = bvr.src_el.getParent(".spt_changelist_content");
            top.setAttribute("spt_changelist", changelist);
            spt.app_busy.show("Loading Changelists Information");
            spt.changelist.load(bvr.src_el, changelist);
            spt.app_busy.hide();

            '''
        })

        for c in changelists:
            num_items = len(c.get("info"))
            name = c.get("change")

            tr = table.add_row()
            tr.add_class("spt_changelist_item")

            radio = RadioWdg("changelist")
            radio.add_class("spt_changelist_radio")
            table.add_cell(radio)
            radio.set_option("value", name)
            if name == changelist:
                radio.set_checked()

            table.add_cell(name)
            table.add_cell(c.get("desc"))
            table.add_cell(num_items)
            table.add_cell(c.get("status"))

            if num_items:
                icon = IconButtonWdg(title="View", icon=IconWdg.ZOOM)

                icon.add_behavior({
                    'type':
                    'click_up',
                    'changelist':
                    c.get("change"),
                    'cbjs_action':
                    '''
                    var top = bvr.src_el.getParent(".spt_changelist_content");
                    top.setAttribute("spt_changelist", bvr.changelist);

                    spt.app_busy.show("Loading Changelist");
                    spt.changelist.load(bvr.src_el, bvr.changelist);
                    spt.app_busy.hide();

                    '''
                })
            else:
                icon = ''
            table.add_cell(icon)

            if not num_items and name != 'default':
                icon = IconButtonWdg(title="Delete Changelist",
                                     icon=IconWdg.DELETE)
            else:
                icon = ""

            table.add_cell(icon)

        inner.add("<hr/>")

        files = my.kwargs.get("files")
        if isinstance(files, basestring):
            files = files.replace("'", '"')
            files = jsonloads(files)

        if files == None:
            inner.add_behavior({
                'type':
                'load',
                'location':
                location,
                'changelist':
                changelist,
                'sync_dir':
                sync_dir,
                'cbjs_action':
                '''

spt.changelist = {}
spt.changelist.load = function(el, changelist) {
    var applet = spt.Applet.get();
    var changelists = spt.scm.run("get_changelists_by_user",[]);
    var dflt = {
        'change': 'default',
        'status': 'pending'
    }
    changelists.push(dflt);
    changelists = changelists.reverse();
    for (var i = 0; i < changelists.length; i++) {
        var info = spt.scm.run("get_changelist_files",[changelists[i].change]);
        changelists[i]['info'] = info;
    }

    // get the current chnage list
    var files = spt.scm.run("get_changelist_files",[changelist]);
    var path_info = {};
    var sizes = [];
    for ( var i = 0; i < files.length; i++) {

        // FIXME: perforce specific
        var path = files[i].depotFile;
        path = path.replace(bvr.location, bvr.sync_dir);
        files[i].path = path;

        var size;
        if (applet.exists(path)) {
            var info = applet.get_path_info(path);
            size = info.size;
        }
        else {
            size = 0;
        }
        sizes.push(size);
        path_info[path] = 'editable';
    }
    //var ret_val = spt.scm.status(bvr.sync_dir);
    //console.log(ret_val);

    var class_name = 'tactic.ui.checkin.changelist_wdg.ChangelistWdg';
    var kwargs = {
        files: files,
        sizes: sizes,
        changelist: changelist,
        changelists: changelists,
        path_info: path_info,
    }
    var top = el.getParent(".spt_changelist_content");
    spt.panel.load(top, class_name, kwargs);

}
spt.changelist.load(bvr.src_el, bvr.changelist);
            '''
            })

        content = DivWdg()
        inner.add(content)
        content.add_class("spt_changelist_content")

        if files == None:

            loading_wdg = DivWdg()
            content.add(loading_wdg)
            loading_wdg.add("<b>Loading ...</b>")
            loading_wdg.add_style("padding: 30px")

        elif files:
            title_wdg = DivWdg()
            title_wdg.add_style("height: 15px")
            title_wdg.add("Changelist: [%s]" % changelist)
            content.add(title_wdg)
            title_wdg.add_gradient("background", "background", -5)
            title_wdg.add_style("padding: 5px")
            title_wdg.add_border()

            #button = SingleButtonWdg(tip='Add New Changelist', icon=IconWdg.ADD)
            #content.add(button)

            content.add("<br/>")

            paths = [x.get("path") for x in files]
            sizes = my.kwargs.get("sizes")
            path_info = my.kwargs.get("path_info")
            from scm_dir_list_wdg import ScmDirListWdg
            # dummy search_key
            search_key = "sthpw/virtual?code=xx001"
            dir_list_wdg = ScmDirListWdg(
                base_dir=sync_dir,
                paths=paths,
                sizes=sizes,
                path_info=path_info,
                all_open=True,
                #search_key=search_key
            )
            content.add(dir_list_wdg)

        else:

            content.add("Changelist: [%s]" % changelist)
            content.add("<br/>" * 2)

            no_files_wdg = DivWdg()
            content.add(no_files_wdg)
            no_files_wdg.add_style("padding: 20px")
            no_files_wdg.add_border()
            no_files_wdg.add("No files in changelist")

            no_files_wdg.add_color("color", "color3")
            no_files_wdg.add_color("background", "background3")
            no_files_wdg.add_style("font-weight: bold")
            no_files_wdg.add_style("text-align: center")

        return top