Example #1
0
    def get_display(self):
        outer_div = DivWdg()
        outer_div.add_class('new-order-entry-form')

        order_name_input = TextInputWdg()
        order_name_input.set_name('name')

        outer_div.add(get_label_widget('Name'))
        outer_div.add(order_name_input)

        po_number_input = TextInputWdg()
        po_number_input.set_name('po_number')

        outer_div.add(get_label_widget('PO Number'))
        outer_div.add(po_number_input)

        client_select_wdg = get_select_widget_from_search_type('twog/client', 'client', 'name', 'code')

        outer_div.add(get_label_widget('Client'))
        outer_div.add(client_select_wdg)

        sales_rep_select_wdg = get_select_widget_from_search_type('sthpw/login_in_group', 'Client', 'login_full_name',
                                                                  'code', [('login_group', 'sales')])

        outer_div.add(get_label_widget('Sales Rep'))
        outer_div.add(sales_rep_select_wdg)

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

        outer_div.add(submit_button)

        return outer_div
Example #2
0
    def get_sync_mode_wdg(self):

        div = DivWdg()
        div.add_class("spt_sync_mode")

        div.add("Share Mode: ")
        select = SelectWdg("sync_mode")
        div.add(select)
        select.set_option("values", "file|xmlrpc")

        select.add_behavior( {
            'type': 'change',
            'cbjs_action': '''
            var top = bvr.src_el.getParent(".spt_sync_mode");
            var value = bvr.src_el.value;
            var xmlrpc_el = top.getElement(".spt_xmlrpc_mode");
            var file_el = top.getElement(".spt_file_mode");

            if (value == 'xmlrpc') {
                spt.show(xmlrpc_el);
                spt.hide(file_el);
            }
            else {
                spt.hide(xmlrpc_el);
                spt.show(file_el);
            }
            '''
        } )

        div.add( self.get_xmlrpc_mode_wdg() )
        div.add( self.get_file_mode_wdg() )

        return div
    def get_display(self):
        outer_div = DivWdg()
        outer_div.add_class('new-order-title-entry-form')

        self.get_order_code_select_widget(outer_div)
        self.get_order_entry_widget(outer_div)
        self.get_title_select_widget(outer_div)
        self.get_title_entry_wdg(outer_div)
        self.get_platform_select_widget(outer_div)

        self.get_languages_widget(outer_div)
        self.get_territory_widget(outer_div)
        self.get_description_input_widget(outer_div)
        self.get_total_program_runtime_widget(outer_div)
        self.get_checkboxes_section(outer_div)

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

        popup_button = ButtonWdg('Popup')
        popup_button.add_behavior({'css_class': 'popup_click', 'type': 'click_up', 'cbjs_action': 'spt.panel.load_popup("Test", "order_builder.OrderTitleEntryWdg", {});'})
        outer_div.add(popup_button)

        outer_div.add(submit_button)

        return outer_div
Example #4
0
    def get_display(my):

        top = DivWdg()
        my.set_as_panel(top)
        top.add_class("spt_table_view_manager_top")

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

        web = WebContainer.get_web()
        if not my.search_type:
            my.search_type = web.get_form_value("search_type")
        if not my.view:
            my.view = web.get_form_value("view")
        if not my.view:
            my.view = 'table'


        filter_wdg = my.get_filter_wdg()
        top.add(filter_wdg)


        #web = WebContainer.get_web()
        #search_type = web.get_form_value("search_type")
        #view = web.get_form_value("view")

        view_manager_wdg = ViewManagerWdg(search_type=my.search_type,view=my.view)
        top.add(view_manager_wdg)


        return top
Example #5
0
    def get_example_chooser_content(self):
        choice_list_div = DivWdg()
        choice_list_div.set_id("UiExampleChoiceList")
        choice_list_div.add_styles( "background: #202020; color: #999999; border: 1px solid black; " \
                                    "border-top: 0px;" )

        example_wdg_classes = self._get_example_widget_classes()

        choice_list_div.add( "<br/>" )

        for ex_wdg_class in example_wdg_classes:
            ex_wdg = ex_wdg_class()

            ex_title = ex_wdg.get_example_title()
            ex_desc  = ex_wdg.get_example_description()
            ex_class_path = Common.get_full_class_name( ex_wdg )

            ex_div = DivWdg()
            ex_div.add_styles( "color: #999999; padding: 8px; padding-left: 20px; cursor: pointer;" )
            ex_div.add_class("SPT_DTS")
            ex_div.add_behavior( {'type': 'click_up',
                                  'cbjs_action': 'spt.ui_play.show_example("%s");' % ex_class_path } )
            ex_div.add( ex_title )
            choice_list_div.add( ex_div )

        choice_list_div.add( "<br/>" )
        return choice_list_div
Example #6
0
    def get_ping_wdg(self):
        div = DivWdg()
        div.add_class("spt_diagnostics_ping")

        ping_div = DivWdg()
        div.add(ping_div)

        ping_div.add( CheckboxWdg() )

        ping_div.add_behavior( {
            'type': 'load',
            'cbjs_action': '''
            var server = TacticServerStub.get();
            var result = server.ping();

            var msg = 'wow';

            var status_el = spt.get_cousin(bvr.src_el, ".spt_diagnostics_ping",".spt_diagnostics_ping_status");
            status_el.innerHTML = result;
            '''
        } )




        # Test database connection
        ping_div.add("Test Server Ping")

        status_div = DivWdg()
        status_div.add_class("spt_diagnostics_ping_status")
        status_div.add("Checking ...")
        div.add(status_div)

        return div
Example #7
0
 def add_dummy(my, config, subsection_div):
     div = DivWdg()
     div.add_attr("spt_view", config.get_view() )
     div.add_class("spt_side_bar_element")
     div.add_class("spt_side_bar_dummy")
     div.add( my.get_drop_wdg() )
     subsection_div.add(div)
Example #8
0
    def get_menu_item(my, element_name, display_handler):

        content = DivWdg()
        content.add_attr("spt_element_name", element_name)
        content.add_class("hand")

        # add the drag/drop behavior
        behavior = {
            "type": "drag",
            "mouse_btn": "LMB",
            "modkeys": "",
            "src_el": "@",
            "cbfn_setup": "spt.side_bar.pp_setup",
            "cbfn_motion": "spt.side_bar.pp_motion",
            "cbfn_action": "spt.side_bar.pp_action",
        }
        content.add_behavior(behavior)

        content.set_id("manage_%s" % element_name)
        content.add_style("position: relative")
        content.add_style("margin: 3px")
        content.add_style("left: 0")
        content.add_style("top: 0")
        content.add_style("z-index: 100")
        if display_handler == "SeparatorWdg":
            content.add(HtmlElement.hr())
        else:
            content.add(element_name)

        return content
    def get_bottom_wdg(my):
        # check if the user has enabled it 
        info = my.check_bottom_wdg()
        if info.get('check') == False:
            return None

        
        title = info.get('title')
        result = info.get('result')

        div = DivWdg()
        div.add(title)
        div.add(str(result))
        div.add_style("text-align: right")
        div.add_class( "spt_%s_expr_bottom" % (my.get_name()) )


        # DEPRECATED until we have a better solution
        # add a listener
        '''
        for sobject in sobjects:
            if sobject.is_insert():
                continue

            # DISABLE this for simple
            #if my.enable_eval_listener:
            #    my.add_js_expression(div, sobject, expression)
        '''

        return div
Example #10
0
    def get_display(my):
        widget = DivWdg(id='link_view_select')
        widget.add_class("link_view_select")
        if my.refresh:
            widget = Widget()
        else:
            my.set_as_panel(widget)
        
        views = []
        if my.search_type:
            from pyasm.search import WidgetDbConfig
            search = Search( WidgetDbConfig.SEARCH_TYPE )
            search.add_filter("search_type", my.search_type)
            search.add_regex_filter("view", "link_search:|saved_search:", op="NEQI")
            search.add_order_by('view')
            widget_dbs = search.get_sobjects()
            views = SObject.get_values(widget_dbs, 'view')
        
        labels = [view for view in views]

        views.insert(0, 'table')
        labels.insert(0, 'table (Default)')
        st_select = SelectWdg('new_link_view', label='View: ')
        st_select.set_option('values', views)
        st_select.set_option('labels', labels)
        widget.add(st_select)
        return widget
    def get_display(my):

        dd_activator = DivWdg()

        if my.style:
            dd_activator.add_styles( my.style )

        dd_activator.add_style( "width: %spx" % my.width )
        dd_activator.add_class("SPT_DTS");

        if my.nudge_menu_horiz != 0:
            dd_activator.set_attr("spt_nudge_menu_horiz", my.nudge_menu_horiz)

        if my.nudge_menu_vert != 0:
            dd_activator.set_attr("spt_nudge_menu_vert", my.nudge_menu_vert)

        # Generate button ...
        #
        table = Table()
        table.add_row()
        table.add_styles("width: 100%; padding: 0px; margin: 0px;")
        td = table.add_cell()
        td.add_looks("menu border curs_default")
        td.add_styles( "padding: 0px; width: 100%; overflow: hidden; height: 12px; max-height: 12px;" )

        title_div = DivWdg()
        title_div.add_styles( "padding: 0px; margin-left: 4px; margin-top: 1px;" )
        if my.icon_path:
            img = HtmlElement.img()
            img.set_attr("src", my.icon_path)
            img.set_attr("title", my.title)
            img.add_styles("padding: 0px; padding-bottom: 1px; margin: 0px; text-decoration: none;")
            title_div.add(img)
            title_div.add_looks("menu")
        else:
            title_div.add(my.title)
            title_div.add_looks("menu fnt_text")

        td.add( title_div )

        td = table.add_cell()
        # -- Example of setting only some of the borders with dotted style ...
        # td.add_looks( "menu_btn_icon clear_borders border_bottom border_right dotted" )
        td.add_looks( "menu_btn_icon border curs_default" )
        td.add_styles( "padding: 0px; text-align: center; overflow: hidden; " \
                       "width: 15px; min-width: 15px;" \
                       "height: 12px; max-height: 12px;" )

        arrow_img = HtmlElement.img("/context/icons/silk/_spt_bullet_arrow_down_dark_8x8.png")
        arrow_img.add_styles( "border: 0px; margin-left: 1px; margin-top: 0px;" )
        td.add( arrow_img )

        dd_activator.add(table)

        dd_activator.add( my.kwargs.get("smart_menu_set") )
        dd_activator.add_class("SPT_SMENU_ACTIVATOR")
        dd_activator.add_behavior( { 'type': 'click_up', 'activator_type' : 'smart_menu',
                                     'cbjs_action': 'spt.smenu.show_on_dropdown_click_cbk( evt, bvr )' } )

        return dd_activator
    def get_display(self):
        # Set up the outer <div> to hold all the form elements
        outer_div = DivWdg()
        outer_div.add_class('new-order-entry-form')
        outer_div.set_id('new-order-entry-form')

        # Set up the <input> widget for 'name'
        outer_div.add(HtmlElement.label('Name'))
        name_input = TextInputWdg(name='name')
        outer_div.add(name_input)

        # Set up the <input> widget for 'po_number'
        outer_div.add(HtmlElement.label('PO Number'))
        po_number_input = TextInputWdg()
        po_number_input.set_name('po_number')
        outer_div.add(po_number_input)

        # Set up the <select> widget and it's options for 'client'
        outer_div.add(HtmlElement.label('Client'))
        client_select_wdg = get_select_widget_from_search_type('twog/client', 'client', 'name', 'code')
        outer_div.add(client_select_wdg)

        # Set up the Save button
        save_button = SubmitWdg('Save')
        save_button.add_behavior(self.save_button_behavior())
        outer_div.add(save_button)

        # Set up the Save and Add button
        save_and_add_button = SubmitWdg('Save and Add')
        save_and_add_button.add_behavior(self.save_and_add_button_behavior())
        outer_div.add(save_and_add_button)

        return outer_div
Example #13
0
    def get_display(my):
        
        widget = DivWdg()

        if my.kwargs.get("is_refresh") == 'true':
            from tactic.ui.widget import TitleWdg
            title = TitleWdg(name_of_title='Import CSV',help_alias='importing-csv-data')
            widget.add(title)

        widget.add_style('padding: 10px')
        widget.add_style('font-size: 12px')
        #widget.add_border()
        widget.add_color('color','color') 
        widget.add_color('background','background') 
        widget.add_class("spt_import_top")
       

        inner = DivWdg()
        widget.add(inner)
        inner.add( my.get_first_row_wdg() )
        inner.add(ProgressWdg())

        if my.is_refresh:
            return inner
        else:
            return widget
Example #14
0
    def get_security_wdg(self):

        div = DivWdg()
        div.add_class("spt_security")

        div.add("A server can sync either be scoped for a single project or all projects.  Transactions that occur in the admin project never get synced.")

        div.add("<br/>"*2)

        div.add("Project: ")

        search = Search("sthpw/project")
        search.add_filters("code", ['admin','unittest'], op='not in')
        search.add_order_by("title")
        projects = search.get_sobjects()

        select = SelectWdg("projects")
        div.add(select)
        labels = [x.get_value("title") for x in projects]
        values = [x.get_value("code") for x in projects]

        project_code = Project.get_project_code()
        if project_code != 'admin':
            select.set_value(project_code)
        select.set_option("labels", labels)
        select.set_option("values", values)
        select.add_empty_option("-- All --")


        div.add("<br/>"*2)

        return div
Example #15
0
    def get_section_wdg(my, title, description, image, behavior):

        section_wdg = DivWdg()
        section_wdg.set_round_corners()
        section_wdg.add_border()
        section_wdg.add_class("spt_report_top")
        section_wdg.add_style("width: 200px")
        section_wdg.add_style("height: 100px")
        section_wdg.add_style("overflow: hidden")
        section_wdg.add_style("margin: 10px")
        section_wdg.set_box_shadow("0px 0px 10px")

        title_wdg = DivWdg()
        section_wdg.add(title_wdg)
        title_wdg.add(title)
        title_wdg.add_style("height: 20px")
        title_wdg.add_style("padding: 3px")
        title_wdg.add_style("margin-top: 3px")
        title_wdg.add_style("font-weight: bold")
        title_wdg.add_gradient("background", "background")


        button = IconButtonWdg(title="Options", icon=IconWdg.ARROWHEAD_DARK_DOWN)
        title_wdg.add(button)
        button.add_style("float: right")

        # set up menus
        menu = my.get_menu()
        SmartMenu.add_smart_menu_set( button, { 'MENU_ITEM': menu } )
        SmartMenu.assign_as_local_activator( button, "MENU_ITEM", True )


        section_wdg.add_color("background", "background")
        #section_wdg.add_gradient("background", "background", 0, -3)
        section_wdg.add_behavior( {
        'type': 'hover',
        'add_color_modifier': -5,
        'cb_set_prefix': 'spt.mouse.table_layout_hover',
        } )

        desc_div = DivWdg()
        desc_div.add(description)
        desc_div.add_style("padding: 5px 10px 10px 5px")


        div = DivWdg()
        section_wdg.add(div)
        div.add_style("padding: 3px")
        div.add_style("margin: 5px")
        div.add_style("width: 65px")
        div.add_style("height: 50px")
        div.add_style("float: left")
        div.add(image)
        section_wdg.add(desc_div)
        div.add_style("overflow: hidden")

        section_wdg.add_behavior( behavior )
        section_wdg.add_class("hand")

        return section_wdg
Example #16
0
    def get_display(my):

        sobject = my.get_current_sobject()

        name = my.get_name()

        top = DivWdg()

        if sobject.is_insert():
            top.add_style("opacity: 0.3")
        else:
            # this gives the swap it's behaviors, so will be disabled
            # on insert
            top.add_class("spt_hidden_row_%s" % name)


        label = my.get_option("label")
        if label:
            label = Search.eval(label, sobject)
        else:
            label = None
        icon = my.get_option("icon")

        swap = SwapDisplayWdg(title=label, icon=icon, show_border=True)
        swap.set_behavior_top(my.layout)

        top.add(swap)

        return top
Example #17
0
    def get_info_wdg(self):

        div = DivWdg()
        div.add_class("spt_info")


        return div
    def get_folder_wdg(my, element_name, config, options, base_path, current_path, info, personal, use_same_config):
        li = HtmlElement.li()
        li.add_class("spt_side_bar_link")
        li.add_class("main_li")


        title = my._get_title(config, element_name)
        title_wdg = DivWdg()
        title_wdg.add_class("menu_header")
        li.add(title_wdg)
        title_wdg.add(title)


        ul = HtmlElement.ul()
        li.add(ul)
        ul.add_class("spt_side_bar_section")
        ul.add_class("sub_ul")

        # then get view name from options in order to read a new
        # config and recurse ...
        options_view_name = options.get('view')
        if options_view_name:
            if use_same_config:
                xml = config.get_xml()
                sub_config = WidgetConfig.get(xml=xml)
                sub_config.set_view(options_view_name)
            else:
                sub_config = my.get_config( my.config_search_type, options_view_name, default=my.default, personal=personal)

            info['level'] += 1
            my.generate_section( sub_config, ul, info, base_path=current_path, personal=personal, use_same_config=use_same_config )
            info['level'] -= 1

        return li
Example #19
0
    def get_arrow_wdg(my):

        pointer_wdg = DivWdg()
        pointer_wdg.add_class("spt_popup_pointer")
        widget.add(pointer_wdg)
        pointer_wdg.add_style("position: absolute")
        pointer_wdg.add_style("float: left")
        pointer_wdg.add_style("background-color", "transparent")
        #pointer_wdg.add("/\\")

        arrow = DivWdg()
        pointer_wdg.add(arrow)
        arrow.add_style("transform: rotate(-45deg)")
        arrow.add_style("-webkit-transform: rotate(-45deg)")

        arrow.add_style("border-style: solid")
        arrow.add_style("border-width: 1px 1px 0px 0px")
        arrow.add_style("border-color: #000")
        arrow.add_style("width: 20px")
        arrow.add_style("height: 20px")
        arrow.add_style("margin-top: 0px")
        arrow.add_color("background-color", "background", -10)


        pointer_wdg.add_style("left: %s" % (15-offset.get('x')))
        pointer_wdg.add_style("top: -10")
        pointer_wdg.add_style("height: 11")

        pointer_wdg.add_style("z-index: 10")

        return pointer_wdg
Example #20
0
    def get_display(self):
        outer_div = DivWdg()
        outer_div.add_class('new-title-entry-form')

        title_name_input = TextInputWdg()
        title_name_input.set_name('name')

        outer_div.add(get_label_widget('Name'))
        outer_div.add(title_name_input)

        episode_input = TextInputWdg()
        episode_input.set_name('episode')

        outer_div.add(get_label_widget('Episode'))
        outer_div.add(episode_input)

        description_input = TextAreaInputWdg()
        description_input.set_name('description')

        outer_div.add(get_label_widget('Description'))
        outer_div.add(description_input)

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

        outer_div.add(submit_button)

        return outer_div
    def get_display(self):
        outer_div = DivWdg()
        outer_div.add_class('new-work-order-entry-form')

        page_label = "Work Order for {0}".format(self.title_order)
        outer_div.add(page_label)

        process_input = TextInputWdg()
        process_input.set_name('process')

        outer_div.add(get_label_widget('Process'))
        outer_div.add(process_input)

        instructions_input = TextAreaInputWdg()
        instructions_input.set_name('instructions')

        outer_div.add(get_label_widget('Instructions'))
        outer_div.add(instructions_input)

        description_input = TextAreaInputWdg()
        description_input.set_name('description')

        outer_div.add(get_label_widget('Description (Optional)'))
        outer_div.add(description_input)

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

        outer_div.add(submit_button)

        return outer_div
Example #22
0
    def get_display(my):

        sobject = my.get_current_sobject()

        my.search_key = SearchKey.get_by_sobject(sobject)
    
        div = DivWdg()
        div.add_class("hand")

        title = "Show Item Details"
        if my.widget:
            widget = my.widget
        else:
            widget = IconButtonWdg(title=title, icon=IconWdg.ZOOM)


        code = sobject.get_code()
        name = sobject.get_value("name", no_exception=True)
        if not name:
            name = code


        widget.add_behavior( {
        'type': 'click_up',
        'search_key': my.search_key,
        'code': code,
        'name': name,
        'cbjs_action': '''
        spt.tab.set_main_body_tab();
        var class_name = 'tactic.ui.tools.TaskDetailPanelWdg';
        var kwargs = {
            search_key: bvr.search_key,
        };

        var mode = '';
        var layout = bvr.src_el.getParent(".spt_tool_top");
        if (layout != null) {
            mode = 'tool'
        }

        if (mode == 'tool') {
            spt.app_busy.show("Loading ...");
            var layout = bvr.src_el.getParent(".spt_tool_top");
            var element = layout.getElement(".spt_tool_content");
            spt.panel.load(element, class_name, kwargs);
            spt.app_busy.hide();
        }
        else {
            var element_name = "detail_"+bvr.code;
            var title = "Detail ["+bvr.name+"]";
            spt.tab.add_new(element_name, title, class_name, kwargs);
        }
        '''
        } )


        div.add(widget)

        return div
Example #23
0
    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
        '''
        } )
Example #24
0
    def get_display(my):

        # set the sobjects to all the widgets then preprocess
        for widget in my.widgets:
            widget.set_sobjects(my.sobjects)
            widget.set_parent_wdg(my)
            # preprocess the elements
            widget.preprocess()


        top = my.top
        my.set_as_panel(top)

        inner = DivWdg()
        top.add(inner)
        inner.add_color("background", "background")
        inner.add_color("color", "color")
        inner.add_class("spt_dashboard_top")

        title = DivWdg()
        inner.add(title)
        title.add(my.get_title())
        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")

        #temp solution. Disable the frame title showing, so have more space for the view table
        title.add_style("display: none")

        title.add_color("background", "background3")

        #table = Table()
        from tactic.ui.container import ResizableTableWdg
        table = ResizableTableWdg()
        inner.add(table)
        table.set_max_width()

        panels = my.get_panels()

        for panel in panels:

            title = panel.get('title')
            #if title in ['Data', None]:
            #    tr, td = table.add_row_cell()
            #else:
            #    td = table.add_cell()
            tr = table.add_row()
            td = table.add_cell(resize=False)
            td.add_style("min-height: 100px")

            td.add_style("vertical-align: top")


            panel = my.get_panel_wdg(td, panel)
            td.add(panel)

        return top
Example #25
0
    def get_elements_wdg(my):

        div = DivWdg()
        div.add_style("min-width: 200px")
        div.add_style("min-height: 500px")

        title_wdg = DivWdg()
        div.add(title_wdg)
        title_wdg.add("Elements")
        title_wdg.add_style("padding: 5px")
        title_wdg.add_gradient("background", "background", -10)

        #element_names = ['Checkin', 'Checkout']
        element_names = my.config.get_element_names()

        elements_wdg = DivWdg()
        div.add(elements_wdg)
        elements_wdg.add_style("padding: 5px")


        view = 'tab_config_whatever'


        hover = div.get_color("background", -10)

        for element_name in element_names:
            element_div = DivWdg()
            elements_wdg.add(element_div)
            element_div.add(element_name)
            element_div.add_style("padding: 3px")

            element_div.add_behavior( {
                'type': 'hover',
                'hover': hover,
                'cbjs_action_over': '''bvr.src_el.setStyle("background", bvr.hover)''',
                'cbjs_action_out': '''bvr.src_el.setStyle("background", "")'''
            } )
            element_div.add_class("hand")

            element_div.add_behavior( {
                'type': 'click_up',
                'view': view,
                'element_name': element_name,
                'cbjs_action': '''
                var top = bvr.src_el.getParent(".spt_tab_edit_top");
                var content = top.getElement(".spt_tab_edit_content");
                var class_name = 'tactic.ui.tools.tab_edit_wdg.TabElementDefinitionWdg';
                var kwargs = {
                  view: bvr.view,
                  element_name: bvr.element_name
                };

                spt.panel.load(content, class_name, kwargs);
                '''
            } )


        return div
Example #26
0
    def get_display(my):

        top = DivWdg()
        top.add_class("spt_project_top")
        my.set_as_panel(top)


        inner = DivWdg()
        top.add(inner)
        inner.add_style("padding: 10px")
        inner.add_color("background", "background")

        inner.add("In this project, I want to manage: <br/><br/>")


        categories = ['Project Management', 'Asset Management', 'Budgets and Expenses', 'Ticketing']

        category_items = {
        'Project Management': [
            'Tasks', 'Work Hours', 'Project Tasks', 'Scheduling', 'Task Pipelines'
        ],
        'Asset Management': [
            'Central Asset Library'
        ],
        'Budgets and Expenses': [
            'Expense List'
        ],
        'Ticketing': [
            'Tickets',
            'Sprints',
            'Burn Down',
        ],
        }


        categories_div = DivWdg()
        inner.add(categories_div)

        for category in categories:
            category_div = DivWdg()
            categories_div.add(category_div)
            category_div.add(category)

            items = category_items.get(category)
            for item in items:
                item_div = DivWdg()
                category_div.add(item_div)

                item_div.add("&nbsp;"*5)

                checkbox = CheckboxWdg()
                item_div.add(checkbox)
                item_div.add(item)

            category_div.add_style("margin-bottom: 5px")


        return top
Example #27
0
    def get_display(my):

        #my.init_kwargs()

        my.sobject = my.get_current_sobject()
        if not my.sobject or my.sobject.is_insert():
            return ""

        # determine the type
        name = my.get_name()

        if not my.expression: 
            div = DivWdg()
            sobject_id = '000'
            if my.sobject:
                sobject_id = my.sobject.get_id()
            div.add_class( "spt_%s_expr_id%s" % ( name, sobject_id ) )
            div.add_class( "spt_%s_expr" % name )

            raw_result = super(ExpressionElementWdg, my).get_display()

            div.add( raw_result )
            # Now check to see if there are inline CSS styles provided ...
            inline_styles = my.kwargs.get('inline_styles')
            if inline_styles:
                style_list = inline_styles.split(";")
                for style in style_list:
                    div.add_style( style )
            return div


        try:
            use_cache = my.get_option("use_cache") in ['true', True]
            if use_cache:
                result = my.sobject.get_value(my.get_name())
            else:
                result = my._get_result(my.sobject, my.expression)





            # calculte the alt expression if defined
            # DEPRECATED: use format expression instead
            if my.alt_expression:
                my.alt_result = my._get_result(my.sobject, my.alt_expression)
            else:
                my.alt_result = result
        except Exception, e:
            print "Expression error: ", e
            print "    in column [%s] with [%s]" % (my.get_name(), my.expression)
            #from pyasm.widget import ExceptionWdg
            #widget = ExceptionWdg(e)
            #return widget
            widget = DivWdg()
            widget.add("Expression error: %s" % e)
            return widget
Example #28
0
    def get_display(self):
        self.display_expr = self.kwargs.get('display_expr')
        self.values = []

        instance_type = self.get_option("instance_type")
        accepted_type = self.get_option("accepted_drop_type")

        div = DivWdg()
        div.add_class("spt_drop_element_top")
        div.add_style("width: 100%")
        div.add_style("min-height: 70px")
        div.add_style("height: auto")
        div.add_style("min-width: 100px")
        div.add_style("max-height: 300px")
        div.add_style("overflow-y: auto")
        div.add_style("overflow-x: hidden")

        self.value_wdg = HiddenWdg(self.get_name())
        self.value_wdg.add_class("spt_drop_element_value")
        div.add( self.value_wdg )



        version = self.parent_wdg.get_layout_version()
        #if version != "2":
        self.add_drop_behavior(div, accepted_type)



        # add the hidden div which holds containers info for the sobject
        template_div = DivWdg()
        template_div.add_style("display: none")
        template_item = self.get_item_div(None)

        # float left for the new icon beside it
        item_div = template_item.get_widget('item_div')
        #item_div.add_style('float: left')

        template_item.add_class("spt_drop_template")
        new_icon = IconWdg("New", IconWdg.NEW)
        new_icon.add_style('padding-left','3px')
        #TODO: insert the new_icon at add(new_icon, index=0) and make sure
        # the js-side sobject_drop_action cloning align the template div properly
        #template_item.add(new_icon)
        template_div.add(template_item)
        div.add(template_div)


        content_div = DivWdg()
        div.add(content_div)
        content_div.add_class("spt_drop_content")

        if instance_type:
            instance_wdg = self.get_instance_wdg(instance_type)
            content_div.add(instance_wdg)
            
        return div
    def get_content_wdg(my):

        div = DivWdg()
        div.add_class("spt_tool_top")

        table = Table()
        div.add(table)
        table.add_row()

        td = table.add_cell()
        from table_layout_wdg import FastTableLayoutWdg

        kwargs = my.kwargs.copy()


        td.add_style("width: 1%")
        td.add_style("vertical-align: top")
        layout_div = DivWdg()
        layout_div.add_style("min-height: 500px")
        td.add(layout_div)

        my.kwargs['element_names'] = ['name','description','detail', 'file_list','general_checkin']
        my.kwargs['show_shelf'] = False
        layout = FastTableLayoutWdg(**my.kwargs)
        layout_div.add(layout)
        #from tactic.ui.panel import TileLayoutWdg
        #layout = TileLayoutWdg(**my.kwargs)
        #layout_div.add(layout)


        td = table.add_cell()
        td.add_border(color="#EEE")
        td.add_style("vertical-align: top")

        content = DivWdg()
        td.add(content)
        content.add_class("spt_tool_content")
        #content.add_style("margin: -1px")


        no_content_wdg = DivWdg()
        content.add(no_content_wdg)
        no_content_wdg.add("<br/>"*3)
        no_content_wdg.add("<i>-- No Content --</i>")
        #no_content_wdg.add_style("opacity: 0.5")
        no_content_wdg.add_style("margin: 30px auto")
        no_content_wdg.add_color("color", "color3")
        no_content_wdg.add_color("background", "background3")
        no_content_wdg.add_style("text-align", "center")
        no_content_wdg.add_style("padding-top: 20px")
        no_content_wdg.add_style("padding-bottom: 20px")
        no_content_wdg.add_style("width: 350px")
        no_content_wdg.add_style("height: 110px")
        no_content_wdg.add_border()


        return div
Example #30
0
    def get_display(my):

        div = DivWdg()
        div.add_class("spt_project_template_top")
        my.set_as_panel(div)

        div.add_color("background", "background")

        upload_div = DivWdg()
        upload_div.add_style("padding: 10px")
        upload_div.add_style("width: 600px")



        # add the main layout
        table = ResizableTableWdg()
        table.add_color("color", "color")
        div.add(table)

        table.add_row()
        left = table.add_cell()
        left.add_border()
        left.add_style("min-width: 250px")
        left.add_style("height: 400px")

        left.add(my.get_templates_wdg() )

        right = table.add_cell()
        right.add_border()
        right.add_style("width: 400px")
        right.add_style("height: 400px")
        right.add_style("padding: 5px")
        right.add_class("spt_project_template_content")

        template = my.kwargs.get("template")
        if template: 
            template_dir = Environment.get_template_dir()
            template_dir = "%s/%s" % (template_dir, template)
            class_name = 'tactic.ui.app.ProjectTemplateEditWdg';
            content_div = ProjectTemplateEditWdg(template_dir=template_dir)
        else:
            content_div = DivWdg()
            content_div.add_style("margin: 40px")
            content_div.add_style("width: 300px")
            content_div.add_style("height: 150px")
            content_div.add_style("opacity: 0.7")
            content_div.add_border()
            content_div.add_color("background", "background3")
            content_div.add("<br/>"*4)
            content_div.add("No templates selected")
            content_div.add_style("text-align: center")

        right.add(content_div)

        return div
Example #31
0
    def get_item_wdg(my, sobject):

        div = DivWdg()
        div.add_class("spt_item_top")
        div.add_style("padding: 10px")
        SmartMenu.assign_as_local_activator(div, 'DG_DROW_SMENU_CTX')
        div.add_class("spt_table_row")
        div.add_attr("spt_search_key", sobject.get_search_key(use_id=True))
        div.add_attr("spt_search_code", sobject.get_code())
        name = sobject.get_value("name", no_exception=True)
        if not name:
            name = sobject.get_code()
        div.add_attr("spt_name", name)

        table = Table()
        div.add(table)
        table.set_max_width()
        tr = table.add_row()

        width = my.kwargs.get("preview_width")
        if not width:
            width = "240px"

        td = table.add_cell()
        td.add_style("width: %s" % width)
        td.add_style("vertical-align: top")
        """
        from tile_layout_wdg import ThumbWdg2
        thumb_div = DivWdg()
        #td.add(thumb_div)
        thumb_div.add_border()
        thumb_div.set_box_shadow("0px 0px 5px")
        thumb_div.add_color("background", "background", -5)
        thumb_div.add_class("spt_item_content")
        #thumb_div.add_style("min-height: 120px")

        thumb = ThumbWdg2()
        thumb_div.add(thumb)
        thumb.set_sobject(sobject)
        """

        tile_wdg = my.tile_layout.get_tile_wdg(sobject)
        td.add(tile_wdg)

        info_div = my.get_info_wdg(sobject)
        td = table.add_cell(info_div)
        td.add_style("vertical-align: top")

        return div
Example #32
0
    def get_doc_wdg(my):
        div = DivWdg()

        search = Search("config/widget_config")
        search.add_filter("category", "HelpWdg")
        sobjects = search.get_sobjects()

        hover = div.get_color("background", -10)

        for sobject in sobjects:
            help_div = DivWdg()
            div.add(help_div)
            help_div.add_style("padding: 3px")

            view = sobject.get_value("view")
            help_div.add(view)

            help_div.add_class("hand");
            help_div.add_behavior( {
            'type': 'hover',
            'hover': hover,
            'cbjs_action_over': '''
            bvr.src_el.setStyle("background", bvr.hover);
            ''',
            'cbjs_action_out': '''
            bvr.src_el.setStyle("background", "");
            '''
            } )


            help_div.add_behavior( {
            'type': 'click_up',
            'view': view,
            'cbjs_action': '''
            var top = bvr.src_el.getParent(".spt_help_edit_top");
            var content = top.getElement(".spt_help_edit_content");

            var class_name = 'tactic.ui.app.HelpEditContentWdg';
            var kwargs = {
                view: bvr.view 
            };

            spt.panel.load(content, class_name, kwargs);

            '''
            } )

        return div
Example #33
0
    def get_display(self):
        top = DivWdg()
        self.set_as_panel(top)

        title_div = DivWdg()
        title_div.add_class("maq_search_bar")
        title_div.add("Diagnostics")
        top.add(title_div)

        tool_div = DivWdg()
        top.add(tool_div)
        refresh = IconButtonWdg("Refresh", IconWdg.REFRESH)
        refresh.add_behavior({
            'type':
            'click_up',
            'cbjs_action':
            '''
            var top = bvr.src_el.getParent(".spt_panel");
            spt.panel.refresh(top);
            '''
        })
        tool_div.add(refresh)

        content = RoundedCornerDivWdg(hex_color_code="2F2F2F",
                                      corner_size="10")
        content.set_dimensions(width_str='300px', content_height_str=None)
        top.add(content)

        server_title_div = DivWdg()
        server_title_div.add_class("maq_search_bar")
        content.add(server_title_div)
        server_title_div.add("Server")
        server_content_div = DivWdg()
        server_content_div.add_style("padding: 10px")
        server_content_div.add(self.get_ping_wdg())
        server_content_div.add(self.get_load_balance_wdg())
        content.add(server_content_div)

        database_title_div = DivWdg()
        database_title_div.add_class("maq_search_bar")
        content.add(database_title_div)
        database_title_div.add("Database")
        database_content_div = DivWdg()
        database_content_div.add_style("padding: 10px")
        database_content_div.add(self.get_database_wdg())
        content.add(database_content_div)

        checkin_title_div = DivWdg()
        checkin_title_div.add_class("maq_search_bar")
        content.add(checkin_title_div)
        checkin_title_div.add("Database")
        checkin_content_div = DivWdg()
        checkin_content_div.add_style("padding: 10px")
        checkin_content_div.add(self.get_asset_dir_wdg())
        checkin_content_div.add(self.get_asset_management_wdg())
        content.add(checkin_content_div)

        return top
Example #34
0
    def get_section_wdg(my, title, description, image, behavior):

        section_wdg = DivWdg()
        section_wdg.set_round_corners()
        section_wdg.add_border()
        section_wdg.add_style("width: 120px")
        section_wdg.add_style("height: 100px")
        section_wdg.add_style("overflow: hidden")
        section_wdg.add_style("margin: 5px")
        section_wdg.set_box_shadow("0px 0px 10px")

        title_wdg = DivWdg()
        section_wdg.add(title_wdg)
        title_wdg.add(title)
        title_wdg.add_style("height: 20px")
        title_wdg.add_style("padding: 3px")
        title_wdg.add_style("margin-top: 0px")
        title_wdg.add_style("font-weight: bold")
        title_wdg.add_color("background", "background", -10)

        section_wdg.add_color("background", "background")
        #section_wdg.add_gradient("background", "background", 0, -3)
        section_wdg.add_behavior({
            'type':
            'hover',
            'add_color_modifier':
            -5,
            'cb_set_prefix':
            'spt.mouse.table_layout_hover',
        })
        """
        desc_div = DivWdg()
        desc_div.add(description)
        desc_div.add_style("padding: 5px 10px 10px 5px")
        """

        div = DivWdg()
        section_wdg.add(div)
        div.add_style("margin-top: 20px")
        div.center()
        div.add_style("width: 32px")
        div.add(image)

        section_wdg.add_behavior(behavior)
        section_wdg.add_class("hand")
        section_wdg.add_attr('title', description)

        return section_wdg
Example #35
0
    def get_display(my):

        widget = DivWdg()

        pipeline_code = my.get_option('pipeline')
        pipeline = Pipeline.get_by_code(pipeline_code)
        if not pipeline:
            widget.add("No pipeline defined")
            return widget

        processes = pipeline.get_process_names()

        widget.add_style("border: solid 1px blue")
        widget.add_style("position: absolute")
        widget.add_style("top: 300")
        widget.add_style("left: -500")

        for process in processes:

            #inputs = pipeline.get_input_processes(process)
            outputs = pipeline.get_output_processes(process)

            div = DivWdg()
            widget.add(div)
            div.add_class("spt_input_option")
            div.add_attr("spt_input_key", process)

            #if not outputs:
            #    # then we can't go anywhere, so just add a message
            #    text = ""
            #    div.add(text)
            #    continue

            values = []
            #values.extend( [str(x) for x in inputs] )
            values.append(process)
            values.extend([str(x) for x in outputs])

            select = SelectWdg(my.get_input_name())
            select.set_value(process)
            select.add_empty_option('-- Select --')
            select.set_option("values", values)
            div.add(select)

            from tactic.ui.panel import CellEditWdg
            CellEditWdg.add_edit_behavior(select)

        return widget
Example #36
0
    def get_title_wdg(my, element_name, config, options):
        li = HtmlElement.li()
        li.add_class("spt_side_bar_title")
        li.add_class("main_title")

        title = my._get_title(config, element_name)
        title_wdg = DivWdg()
        title_wdg.add_class("menu_header")
        li.add(title_wdg)
        title_wdg.add(title)

        li.add_style("list-style-type: none")
        li.add_style("display: block")
        li.add_style("font-weight: bold")

        return li
Example #37
0
    def get_folder_wdg(self, element_name, config, options, base_path,
                       current_path, info, personal, use_same_config):

        attributes = config.get_element_attributes(element_name)
        if attributes.get("is_visible") == "false":
            return

        li = HtmlElement.li()
        li.add_class("spt_side_bar_link")
        li.add_class("main_li unselectable")

        title = self._get_title(config, element_name)
        title_wdg = DivWdg()
        title_wdg.add_class("menu_header")
        li.add(title_wdg)
        title_wdg.add(title)

        ul = HtmlElement.ul()
        li.add(ul)
        ul.add_class("spt_side_bar_section")
        ul.add_class("sub_ul unselectable")
        ul.add_style('cursor', 'pointer')

        # then get view name from options in order to read a new
        # config and recurse ...
        options_view_name = options.get('view')
        if options_view_name:
            if use_same_config:
                xml = config.get_xml()
                sub_config = WidgetConfig.get(xml=xml)
                sub_config.set_view(options_view_name)
            else:
                sub_config = self.get_config(self.config_search_type,
                                             options_view_name,
                                             default=self.default,
                                             personal=personal)

            info['level'] += 1
            self.generate_section(sub_config,
                                  ul,
                                  info,
                                  base_path=current_path,
                                  personal=personal,
                                  use_same_config=use_same_config)
            info['level'] -= 1

        return li
Example #38
0
    def get_display(self):

        sobject = self.get_current_sobject()

        value = sobject.get_value(self.get_name())
        if value.startswith("{") and value.endswith("}"):
            value = Search.eval(value)

        if value.startswith("/"):
            new_window = 'false'
        else:
            new_window = 'true'

        top = DivWdg()
        top.add_class("hand")
        top.add_style("width: 0%")

        if value:
            top.add_behavior({
                'type':
                'click_up',
                'link':
                value,
                'new_window':
                new_window,
                'cbjs_action':
                '''
            if (bvr.new_window == 'false') {
                document.location = bvr.link;
            }
            else{
                var new_window = window.open(bvr.link, '_blank');
                new_window.focus();
            }
            '''
            })

            icon = self.get_option("icon")
            if not icon:
                icon = 'jump'

            from pyasm.widget import IconWdg
            icon = icon.upper()
            icon = IconWdg(value, eval("IconWdg.%s" % icon))
            top.add(icon)

        return top
Example #39
0
    def get_display_single_on_load_bvr(my):
        class_path = Common.get_full_class_name(my)

        top = DivWdg()
        top.add_styles("border: 1px solid black;")

        count = my.kwargs.get('count')
        print "count: ", count
        if count:
            count = int(count)
        else:
            count = 0

        top.add('top: %s' % count)
        top.add_class('my_dynamic_add_div_%s' % count)

        max = 10

        if count == 0:

            top.add_behavior({
                'type':
                'load',
                'cbjs_action':
                '''
                    var server = TacticServerStub.get();

                    var widget_class = '%s';
                    var count = 1;
                    var max = %s;

                    var main = $('main_body');

                    for( var c=count; c <= max; c++ ) {
                        spt.app_busy.show("Dynamic Loading ...", "Loading widget with count of " + c);
                        var div = document.createElement('div');
                        args = { "count": '' + c };
                        html = server.get_widget(widget_class, {"args": args}) + '<br/>';
                        spt.behavior.replace_inner_html(div, html);
                        main.appendChild(div);
                    }

                    spt.app_busy.hide();
                ''' % (class_path, max)
            })

        return top
Example #40
0
    def get_panels(my):

        panels = []

        search_type_panel = DivWdg()
        search_type_panel.add_style("padding-top: 3px")
        search_type_panel.add_style("overflow-y: auto")
        search_type_panel.add(SearchTypePanel())
        search_type_panel.add_style("min-height: 100px")
        search_type_panel.add_style("height: 300px")
        search_type_panel.add_class("spt_resizable")

        panel = {
            'widget': search_type_panel,
            'title': 'Searchable Type (sType) List',
            'width': '50%'
        }
        panels.append(panel)

        from tactic.ui.container import TabWdg
        config_xml = '''
        <config>
        <tab>
        <element name="Help">
            <display class='tactic.ui.app.HelpContentWideWdg'>
              <alias>main</alias>
              <width>1000px</width>
            </display>
        </element>
        </tab>
        </config>
        '''

        div = DivWdg()
        tab = TabWdg(show_add=False, config_xml=config_xml, tab_offset=5)
        div.add(tab)
        div.add_style("margin: 0px -6px -6px -6px")

        panel = {
            'widget': div,
            #'title': 'Data',
            'title': None,
            'width': '100%',
        }
        panels.append(panel)

        return panels
Example #41
0
    def get_right_content_wdg(my):

        div = DivWdg()
        div.add_style("width: 100%")
        div.add_class("spt_collection_content")

        #shelf_wdg = my.get_header_wdg()
        #shelf_wdg.add_style("float: right")
        #div.add(shelf_wdg)

        tile = CollectionContentWdg(search_type=my.search_type,
                                    show_shelf=False,
                                    show_search_limit=False,
                                    sobjects=my.sobjects)
        div.add(tile)

        return div
Example #42
0
    def get_note_wdg(self, note):

        div = DivWdg()
        div.add_class("spt_note")

        note_str = note.get_value("note")
        login = note.get_value("login")
        if not login:
            login = "******"
        date = note.get_datetime_value("timestamp")
        date_str = date.strftime("%Y-%m-%d")

        div.add("%s - %s<br/>" % (date_str, login))
        div.add("<br/>")
        div.add(note_str)

        return div
Example #43
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
Example #44
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
    def get_display(self):
        outer_div = DivWdg()
        outer_div.add_class('order-builder')
        outer_div.add_style('display', 'inline-block')

        order_div = DivWdg()

        order_div.add(self.setup_order_information())

        div_width = 500

        components_div = DivWdg()
        components_div.add_style('display', 'inline-block')
        components_div.add_style('width', '{0}px'.format(div_width))
        components_div.add_style('float', 'left')
        components_div.add(
            self.setup_html_list_for_components_in_order(div_width))
        order_div.add(components_div)

        file_flows_div = DivWdg()
        file_flows_div.add_style('display', 'inline-block')
        file_flows_div.add_style('width', '300px')
        file_flows_div.add_style('float', 'left')
        file_flows_div.add(
            self.setup_html_list_for_file_flows_in_order(div_width))
        order_div.add(file_flows_div)

        packages_div = DivWdg()
        packages_div.add_style('display', 'inline-block')
        packages_div.add_style('width', '{0}px'.format(div_width))
        packages_div.add_style('float', 'left')
        packages_div.add(
            self.setup_html_list_for_packages_in_orders(div_width))
        order_div.add(packages_div)

        files_div = DivWdg()
        files_div.add_style('display', 'inline-block')
        files_div.add_style('width', '300px')
        files_div.add_style('float', 'left')
        files_div.add_style('margin-left', '20px')
        files_div.add(self.setup_files_in_order_div())
        order_div.add(files_div)

        outer_div.add(order_div)

        return outer_div
Example #46
0
    def get_database_wdg(self):
        div = DivWdg()

        database_div = DivWdg()
        div.add(database_div)

        database_div.add(CheckboxWdg())

        # Test database connection
        database_div.add("Test Database Connection")

        status_div = DivWdg()
        status_div.add_class("spt_diagnostics_database")
        status_div.add("Checking ...")
        div.add(status_div)

        return div
Example #47
0
    def get_panels(my):

        panels = []

        user_panel = DivWdg()
        user_panel.add_style("padding-top: 3px")
        user_panel.add_style("overflow-y: auto")
        user_panel.add(UserPanelWdg())
        user_panel.add_style("min-height: 100px")
        user_panel.add_style("height: 400px")
        user_panel.add_class("spt_resizable")

        panel = {
            'widget': user_panel,
            'title': 'List of Users',
        }
        panels.append(panel)

        from tactic.ui.container import TabWdg
        config_xml = '''
        <config>
        <tab>
        <element name="Help">
            <display class='tactic.ui.app.HelpContentWideWdg'>
              <alias>main</alias>
              <width>1000px</width>
            </display>
        </element>
        <element name="Users in Project">
            <display class='tactic.ui.startup.UserSecurityWdg'/>
        </element>
        </tab>
        </config>
        '''
        tab = TabWdg(show_add=False, config_xml=config_xml)

        panel = {
            'widget': tab,
            #'title': 'Data',
            'title': None,
            'width': '100%',
            'height': '100%'
        }
        panels.append(panel)

        return panels
Example #48
0
    def get_asset_management_wdg(self):
        div = DivWdg()
        div.add_class("spt_diagnostics_dam")

        handoff_div = DivWdg()
        handoff_div.add_behavior({
            'type':
            'load',
            'cbjs_action':
            '''
            var server = TacticServerStub.get();
            var handoff_dir = server.get_handoff_dir();

            var applet = spt.Applet.get();
            applet.makedirs(handoff_dir);

            var random_number=Math.floor(Math.random()*100)
            var filename = 'test'+random_number+'.txt';
            applet.create_file(handoff_dir+'/'+filename, 'test');

            var cmd = 'tactic.ui.app.DiagnosticsHandoffDirTestCmd';
            var args = {
                handoff_dir: handoff_dir,
                filename: filename
            };
            server.execute_cmd(cmd, args);

            var status_el = spt.get_cousin(bvr.src_el, ".spt_diagnostics_dam",".spt_diagnostics_handoff_status");
            status_el.innerHTML = "OK";


            '''
        })

        # Test handoff directory
        div.add(handoff_div)
        handoff_div.add(CheckboxWdg())
        handoff_div.add("Test Handoff Directory")

        handoff_status_div = DivWdg()
        handoff_status_div.add_class("spt_diagnostics_handoff_status")
        handoff_status_div.add("Checking ...")
        div.add(handoff_status_div)

        return div
Example #49
0
    def get_display(self):

        smenu_set_div = DivWdg()
        smenu_set_div.add_class("SPT_SMENU_SET")
        smenu_set_div.add_class("SPT_PUW")


        if self.match_subset:
            smenu_set_div.set_attr("SPT_SMENU_MATCH_SUBSET","true")

        # ??? div.set_attr("SPT_CONTEXT_CLASS_TAG", "spt_dg_row")

        # create default subset first ...
        subset_div = DivWdg()
        subset_div.add_class("SPT_SMENU_SUBSET SPT_SMENU_SUBSET__DEFAULT")

        # -- this needs to be added to activator element ...
        # subset_div.set_attr("SPT_SMENU_SUBSET_TAG", "SPT_SMENU_SUBSET__DEFAULT")

        menu_spec_list = self.menu_specs_map.get('SPT_SMENU_SUBSET__DEFAULT')
        if menu_spec_list:
            for menu_spec in menu_spec_list:
                smenu_wdg = SmartMenuWdg( menu_tag_suffix = menu_spec.get('menu_tag_suffix'),
                                          width = menu_spec.get('width'),
                                          opt_spec_list = menu_spec.get('opt_spec_list'),
                                          allow_icons = menu_spec.get('allow_icons'),
                                          setup_cbfn = menu_spec.get('setup_cbfn') )
                subset_div.add( smenu_wdg )

        smenu_set_div.add( subset_div )



        if self.match_subset:
        #{
            for subset_tag, menu_spec_list in self.menu_specs_map.iteritems():
                if subset_tag != 'SPT_SMENU_SUBSET__DEFAULT':
                    subset_div = DivWdg()
                    subset_div.add_class("SPT_SMENU_SUBSET %s" % subset_tag)
                    subset_div.set_attr("SPT_SMENU_SUBSET_TAG", subset_tag)

                    for menu_spec in menu_spec_list:
                        smenu_wdg = SmartMenuWdg( menu_tag_suffix = menu_spec.get('menu_tag_suffix'),
                                                  width = menu_spec.get('width'),
                                                  opt_spec_list = menu_spec.get('opt_spec_list'),
                                                  allow_icons = menu_spec.get('allow_icons'),
                                                  setup_cbfn = menu_spec.get('setup_cbfn') )
                        subset_div.add( smenu_wdg )

                    smenu_set_div.add( subset_div )
        #}



        return smenu_set_div
Example #50
0
    def get_format_wdg(my, value, format, display_value):
        div = DivWdg()

        if format not in ['Checkbox'] and value == '':
            return div

        if format == 'Checkbox':

            div.add_style("width: 100%")
            div.add_class("spt_boolean_top")
            from pyasm.widget import CheckboxWdg
            checkbox = CheckboxWdg(my.get_name())
            checkbox.set_option("value", "true")
            if value:
                checkbox.set_checked()
            div.add(checkbox)
            checkbox.add_behavior({
                'type':
                'click_up',
                'propagate_evt':
                True,
                'cbjs_action':
                '''

            var cached_data = {};
            var value_wdg = bvr.src_el;
            var top_el = bvr.src_el.getParent(".spt_boolean_top");
            spt.dg_table.edit.widget = top_el;
            var key_code = spt.kbd.special_keys_map.ENTER;
            spt.dg_table.inline_edit_cell_cbk( value_wdg, cached_data );
            '''
            })

        elif format == '-$1,234.00':
            if value < 0:
                div.add_style("color: red")
                div.add("(%s)" % display_value.replace("-", ""))
            else:
                div.add_style("color: black")
                div.add(display_value)

        else:
            div.add(display_value)

        return div
Example #51
0
    def get_sqlite_wdg(my):
        div = DivWdg()
        div.add_class("spt_db_options")
        div.add_attr("spt_vendor", "Sqlite")
        div.add_style("padding: 20px")

        div.add("Database Folder: ")
        text = TextInputWdg(name="database/sqlite_db_dir")
        div.add(text)

        db_dir = Config.get_value("database", "sqlite_db_dir")
        if not db_dir:
            data_dir = Environment.get_data_dir()
            db_dir = "%s/db" % data_dir

        text.set_value(db_dir)

        return div
Example #52
0
    def get_asset_dir_wdg(self):
        div = DivWdg()

        asset_dir_div = DivWdg()
        div.add(asset_dir_div)

        asset_dir_div.add(CheckboxWdg())

        asset_dir_div.add("Test Asset Directory")

        status = self.test_asset_dir()

        status_div = DivWdg()
        status_div.add_class("spt_diagnostics_asset_dir")
        status_div.add(status)
        div.add(status_div)

        return div
Example #53
0
    def get_bottom_wdg(my):
        # check if the user has enabled it
        info = my.check_bottom_wdg()

        if info.get('check') == False:
            return None

        title = info.get('title')
        result = info.get('result')
        format = my.get_option('format')
        result = my.get_format_value(result, format)

        div = DivWdg()
        div.add(title)
        div.add(str(result))
        div.add_style("text-align: right")
        div.add_class("spt_%s_expr_bottom" % (my.get_name()))
        return div
Example #54
0
    def get_display(self):

        width = self.kwargs.get("width")
        if not width:
            width = 300
        height = self.kwargs.get("height")
        if not height:
            height = 100

        top = self.top
        top.add_class("spt_uploader_top")

        inner = DivWdg()
        top.add(inner)
        inner.add_style("scroll: auto")
        inner.add_style("padding: 3px")
        inner.add_behavior({
            'type': 'load',
            'cbjs_action': self.get_onload_js()
        })

        drop_wdg = DivWdg()
        inner.add(drop_wdg)
        drop_wdg.add_class("spt_uploader_drop")
        drop_wdg.add_border()
        drop_wdg.add_style("width: %s" % width)
        drop_wdg.add_style("height: %s" % height)

        drop_wdg.add_behavior({
            'type':
            'load',
            'cbjs_action':
            '''
        var drop_area = bvr.src_el;
        spt.uploader.init_drop_area(drop_area);
        '''
        })

        button_div = DivWdg()
        top.add(button_div)

        #top.add('''<input id="files-upload" type="file" multiple=""/>''')

        return top
Example #55
0
    def get_display(my):

        width = "100%"
        height = "100%"

        sobject = my.get_current_sobject()

        div = DivWdg()
        div.add_class("spt_thumb_top")

        path = my.path
        if path:
            img = HtmlElement.img(src=path)
        else:
            search_type = sobject.get_search_type_obj()
            path = my.get_path_from_sobject(search_type)
            if path:
                img = DivWdg()
                img.add_style("opacity: 0.2")

                img_inner = HtmlElement.img(src=path)
                img.add(img_inner)

                img_inner.add_style("width: %s" % width)

        if path and path.startswith("/context"):
            img.add_style("padding: 10px 15%")
            img.add_style("width: 70%")
        elif path:
            img.add_style("width: %s" % width)
            img.add_style("height: %s" % height)
            img.add_style('margin-left','auto')
            img.add_style('margin-right','auto')

        if not path:
            img = DivWdg()
        img.add_class("spt_image")
        div.add(img)

        div.add_style("height: 100%")


        return div
Example #56
0
    def get_bottom_wdg(self):

        self.init_kwargs()

        sobjects = self.sobjects
        # ignore the first 2 (edit and insert) if it's on the old TableLayoutWdg
        if self.get_layout_wdg().get_layout_version() == '1':
            sobjects = sobjects[2:]

        if not sobjects:
            return None

        expression = self.get_option("bottom")
        if not expression:
            return None

        # parse the expression
        self.vars = self.get_vars()

        parser = ExpressionParser()
        result = parser.eval(expression, sobjects=sobjects, vars=self.vars)

        format_str = self.kwargs.get("display_format")
        if format_str:
            from tactic.ui.widget import FormatValueWdg
            format_wdg = FormatValueWdg(format=format_str, value=result)
            result = format_wdg
        else:
            result = str(result)

        div = DivWdg()
        div.add(result)
        div.add_style("text-align: right")
        div.add_class("spt_%s_expr_bottom" % (self.get_name()))

        # add a listener
        for sobject in sobjects:
            if sobject.is_insert():
                continue
            if self.enable_eval_listener:
                self.add_js_expression(div, sobject, expression)

        return div
Example #57
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
Example #58
0
    def get_load_balance_wdg(my):
        div = DivWdg()
        div.add_class("spt_diagnostics_load_balance")

        load_div = DivWdg()
        div.add(load_div)
        load_div.add_behavior( {
            'type': 'load',
            'cbjs_action': '''
            var server = TacticServerStub.get();

            var ports = {};
            var num_ports = 0;
            for (var i=0; i<10; i++) {
                var info = server.get_connection_info();
                var port = info.port;
                if (typeof(ports[port]) == 'undefined') {
                    ports[port] = 0;
                    num_ports += 1;
                }
                ports[port] += 1
            }

            var msg = "Number of ports: "+num_ports;

            var status_el = spt.get_cousin(bvr.src_el, ".spt_diagnostics_load_balance",".spt_diagnostics_load_status");
            status_el.innerHTML = "OK - "+msg;
            '''
        } )

        # Test load balancing
        load_div.add( CheckboxWdg() )
        load_div.add("Test Load Balancing")

        load_status_div = DivWdg()
        load_status_div.add_class("spt_diagnostics_load_status")
        load_status_div.add("Checking ...")
        div.add(load_status_div)



        return div
Example #59
0
    def get_display(my):

        print "NotifyPollCmd"

        user = Environment.get_user_name()
        print "user: "******"sthpw/message")
        #search.add_filter("login", user)

        search = Search("sthpw/login")
        sobjects = search.get_sobjects()

        codes = [x.get_code() for x in sobjects]
        codes = ", ".join(codes)

        div = DivWdg()
        div.add_behavior({
            'type':
            'click_up',
            'cbjs_action':
            '''
            spt.tab.set_main_body_tab();
            var class_name = 'tactic.ui.panel.ViewPanelWdg';
            var search_type = "sthpw/login";
            var view = 'table';
            var kwargs = {
                'search_type': search_type,
                'view': view
            }
            spt.tab.add_new("Login", "Login", class_name, kwargs);
            '''
        })
        div.add("cow")
        div.add_class("handle")

        #my.info = {
        #    'msg': div.get_buffer_display()
        #}

        return div
Example #60
0
    def get_display(self):

        search_wdg = DivWdg()
        search_wdg.add_class("spt_table_search")
        prefix = HiddenWdg("prefix", "introspect")
        search_wdg.add(prefix)

        hidden = HiddenWdg("introspect", "true")
        search_wdg.add(hidden)

        class_name = HiddenWdg("class_name", "tactic.ui.cgapp.IntrospectWdg")
        search_wdg.add(class_name)

        checkbox = CheckboxWdg("search")
        search_wdg.add("Session Filter: ")
        search_wdg.add(checkbox)

        self.top.add(search_wdg)

        return self.top