Beispiel #1
0
    def get_example_display(my):

        div = DivWdg()

        # --- Example of new spt.fx animation slider --------------------------------------------------------------

        slide_div = DivWdg()
        slide_div.set_id( "ui_play_sliding_thing" )
        slide_div.set_style( "background: #9f9f9f; color: #0f0f0f; border: 1px solid black;" )
        slide_div.add( "For a moment after Mr. and Mrs. Darling left the house the night-lights by the beds of the three children continued to burn clearly. They were awfully nice little night-lights, and one cannot help wishing that they could have kept awake to see Peter; but Wendy's light blinked and gave such a yawn that the other two yawned also, and before they could close their mouths all the three went out. There was another light in the room now, a thousand times brighter than the night-lights, and in the time we have taken to say this, it had been in all the drawers in the nursery, looking for Peter's shadow, rummaged the wardrobe and turned every pocket inside out. It was not really a light; it made this light by flashing about so quickly, but when it came to rest for a second you saw it was a fairy, no longer than your hand, but still growing. It was a girl called Tinker Bell exquisitely gowned in a skeleton leaf, cut low and square, through which her figure could be seen to the best advantage. She was slightly inclined to embonpoint." )

        div.add( slide_div )

        div.add( '<br/>' )
        click_slide = DivWdg()
        click_slide.add( "Click Me to Slide!" )
        click_slide.set_style( "background: #0f0f0f; color: #9f9f9f; border: 1px solid black; width: 100px; " \
                               "cursor: pointer;" )

        click_slide.add_behavior( { 'type': 'click_up',
                                    'dst_el': 'ui_play_sliding_thing',
                                    'cbfn_action': 'spt.fx.slide_anim_cbk',
                                    'options': { 'direction': 'vertical',
                                                 'duration': 500,  # time in milliseconds
                                                 'frame_rate': 15   # frames per second
                                                }
                                    } )

        div.add( click_slide )
        return div
Beispiel #2
0
    def init(my):

        top = DivWdg()
        top.set_id('top_of_application')

        msg_div = DivWdg()
        msg_div.add_style('text-align: center')
        msg_div.add('<img src="/context/icons/common/indicator_snake.gif" border="0"/>')
        msg_div.add("&nbsp; &nbsp;")
        project = Project.get()
        title = project.get_value("title")
        if not title:
            title = "TACTIC"

        msg_div.add('''Loading "%s" ....'''% title)
        msg_div.add_style("font-size: 1.5em")

        msg_div.add_behavior( {
            'type': 'load',
            'hash': my.hash,
            'cbjs_action': '''
            if (bvr.hash) {
                spt.hash.hash = "/" + bvr.hash;
            }
            else {
                spt.hash.hash = "/index";
            }
            '''
        } )

        msg_div.add_style("margin: 200 0 500 0")
        top.add(msg_div)

        my.add(top)
        return
Beispiel #3
0
    def get_search_wdg(self):
        filter_div = DivWdg()
        filter_div.add_style("width: 100px")

        buttons_list = [
            {'label': 'Run Search', 'tip': 'Run search with this criteria' },
        ]

        txt_btn_set = TextBtnSetWdg( position='', buttons=buttons_list, spacing=6, size='large', side_padding=4 )
        run_search_bvr = {
            'type':         'click_up',
            'cbjs_action':  '''
                spt.app_busy.show('Search ...', 'Searching Active Directory for matching users.');
                setTimeout( function() {
                var top = bvr.src_el.getParent('.ad_search_wdg_top');
                var values = spt.api.Utility.get_input_values(top);
                spt.panel.refresh(top, values);
                spt.app_busy.hide();
                }, 100);
            '''
        }
        txt_btn_set.get_btn_by_label('Run Search').add_behavior( run_search_bvr )
        #filter_div.add( txt_btn_set )

        div = DivWdg()
        div.add_behavior(run_search_bvr)
        button = ProdIconButtonWdg("Run Search")
        button.add_behavior(run_search_bvr)

        div.add(button)
        filter_div.add(div)
        return filter_div
Beispiel #4
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
Beispiel #5
0
    def get_display(my):
        div = DivWdg()
        class_path = Common.get_full_class_name(my)

        from tactic.ui.panel import HashPanelWdg
        try:
            widget = HashPanelWdg.get_widget_from_hash("/index", return_none=True)
            div.add(widget)
        except:
            widget = None


        if not widget:
            class_path = class_path.replace("IndexWdg", "IndexWdg2")
            kwargs = {}
            div.add_behavior( {
                'type': 'load',
                'class_path': class_path,
                'kwargs': kwargs,
                'cbjs_action': '''
                spt.dom.load_js(["popup.js"], function() {
                    spt.panel.load(bvr.src_el, bvr.class_path, bvr.kwargs);
                });
                '''
            } )
        return div
Beispiel #6
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
    def get_display(self):
        """
        Get the display for this edit wdg launcher. It should appear as
        the name of the sobject, bold and underlined.

        :return: the sobject edit launcher widget
        """
        search_type = self.kwargs.get('search_type')
        sobject_code = self.get_sobject_code()
        display_column = self.kwargs.get('display_column')
        if not display_column:
            display_column = 'code'
        display_name = self.server.eval("@GET({0}['code','{1}'].{2})".format(search_type, sobject_code, display_column))
        display_name = display_name[0] if display_name else sobject_code

        display_mode = self.kwargs.get('display_mode')
        if display_mode == 'Browser':
            url = ctu.get_edit_wdg_url(search_type, sobject_code, server=self.server)
            launch_behavior = self.get_browser_tab_behavior(url)
        else:
            launch_behavior = self.get_launch_behavior(search_type, sobject_code, display_mode)

        display_text = '<b><u>{0}</u></b>'.format(display_name)
        div = DivWdg(display_text)
        div.add_behavior(launch_behavior)
        div.add_styles({'cursor': 'pointer'})

        return div
Beispiel #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_async_element_wdg(my, xml, element_name, load):

        tmp_config = WidgetConfig.get('tmp', xml=xml)
        display_handler = tmp_config.get_display_handler(element_name)
        display_options = tmp_config.get_display_options(element_name)

        div = DivWdg()
        unique_id = div.set_unique_id()

        if load == "sequence":
            my.sequence_data.append( {
                'class_name': display_handler,
                'kwargs': display_options,
                'unique_id': unique_id
            } )
        else:
            div.add_behavior( {
                'type': 'load',
                'class_name': display_handler,
                'kwargs': display_options,
                'cbjs_action': '''
                spt.panel.async_load(bvr.src_el, bvr.class_name, bvr.kwargs);
                '''
            } )

        loading_div = DivWdg()
        loading_div.add_style("margin: auto auto")
        loading_div.add_style("width: 150px")
        loading_div.add_style("text-align: center")
        loading_div.add_style("padding: 20px")
        div.add(loading_div)
        loading_div.add('''<img src="/context/icons/common/indicator_snake.gif" border="0"/> <b>Loading ...</b>''')

        return div
    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
Beispiel #11
0
    def get_async_element_wdg(my, xml, element_name, load):

        tmp_config = WidgetConfig.get("tmp", xml=xml)
        display_handler = tmp_config.get_display_handler(element_name)
        display_options = tmp_config.get_display_options(element_name)

        div = DivWdg()
        unique_id = div.set_unique_id()

        if load == "sequence":
            my.sequence_data.append({"class_name": display_handler, "kwargs": display_options, "unique_id": unique_id})
        else:
            div.add_behavior(
                {
                    "type": "load",
                    "class_name": display_handler,
                    "kwargs": display_options,
                    "cbjs_action": """
                spt.panel.async_load(bvr.src_el, bvr.class_name, bvr.kwargs);
                """,
                }
            )

        loading_div = DivWdg()
        loading_div.add_style("margin: auto auto")
        loading_div.add_style("width: 150px")
        loading_div.add_style("text-align: center")
        loading_div.add_style("padding: 20px")
        div.add(loading_div)
        loading_div.add("""<img src="/context/icons/common/indicator_snake.gif" border="0"/> <b>Loading ...</b>""")

        return div
    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
Beispiel #13
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
Beispiel #14
0
    def get_item_div(self, sobject):
        ''' get the item div the sobject'''
        top = DivWdg()
        top.add_style("padding: 3px 2px")
        top.add_class("spt_drop_item")
        top.add_class("SPT_DROP_ITEM")


        item_div = DivWdg()
        top.add(item_div, "item_div")
        item_div.add_style("text-overflow: ellipsis")
        item_div.add_style("white-space: nowrap")
        item_div.add_style("width: 80%")
        item_div.add_attr('title','Click to remove')
        item_div.add_style("display", "inline-block")
        item_div.add_style("vertical-align", "top")
        item_div.add_style("overflow", "hidden")


        icon_div = DivWdg()
        top.add(icon_div)
        icon = IconWdg(icon="BS_REMOVE")
        icon_div.add(icon)
        icon_div.add_behavior( {
            'type': 'click_up',
            #'cbjs_action': '''spt.dg_table_action.sobject_drop_remove(evt,bvr)'''
            'cbjs_action': '''spt.drop.sobject_drop_remove(evt,bvr)'''
        } )
        icon.add_style("opacity: 0.3")
        icon_div.add_class("hand")
        icon_div.add_style("display", "inline-block")
        icon_div.add_style("vertical-align", "top")
        #icon_div.add_border()


        #self.menu.set_over(item_div, event="mousein")
        #self.menu.set_out(top, event="mouseleave")


        # set this as the place for the display value to go
        item_div.add_class("spt_drop_display_value")

        add_icon = True
        ExpressionParser.clear_cache()
        if sobject:
            if add_icon:
                self._add_icon(sobject, item_div)

            if self.display_expr:
                display_value = Search.eval(self.display_expr, sobjects = sobject, single=True)
            else:
                display_value = sobject.get_display_value()
            if isinstance(display_value, list):
                display_value = display_value[0]
            item_div.add( display_value )
            self.values.append( SearchKey.get_by_sobject(sobject) )
        return top
Beispiel #15
0
    def get_filter_wdg(self, filter_name):

        if not filter_name:
            filter_name = self.get_name()

        from pyasm.web import DivWdg
        from tactic.ui.widget import IconButtonWdg
        filter_wdg = DivWdg()
        button = IconButtonWdg(title="Show Filter", icon="BS_SEARCH")
        filter_wdg.add_class("spt_filter_button")


        filter_wdg.add(button)
        filter_wdg.add_style("display: inline-block")
        filter_wdg.add_style("vertical-align: middle")
        filter_wdg.add_style("opacity: 0.5")

        filter_wdg.add_attr("spt_filter_name", filter_name)
        filter_wdg.add_behavior( {
            'type': 'click',
            'cbjs_action': '''
            var panel = bvr.src_el.getParent(".spt_view_panel_top");
            var th = bvr.src_el.getParent("th");
            var pos = th.getPosition(panel);

            var name = bvr.src_el.getAttribute("spt_filter_name");

            if (! spt.simple_search.has_element(name) ) {
                return;
            }

            pos.y += 35;


            spt.simple_search.show_elements([name]);
            spt.simple_search.set_position(pos);
            spt.simple_search.hide_title();
            spt.simple_search.show();

            var top = spt.simple_search.get_top();
            var size = top.getSize();
            var cur_pos = top.getPosition( $(document.body) );
            var window_size = $(document.body).getSize();
            if (cur_pos.x + size.x > window_size.x) {
                var panel_size = panel.getSize();
                pos.x = panel_size.x - size.x;
                spt.simple_search.set_position(pos);
            }

            '''
        } )



        return filter_wdg
Beispiel #16
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
Beispiel #17
0
    def get_section_wdg2(my, title, description, image, behavior):

        section_wdg = DivWdg()
        section_wdg.set_round_corners()
        section_wdg.add_border()
        section_wdg.add_style("width: 200px")
        section_wdg.add_style("height: 175px")
        section_wdg.add_style("overflow: hidden")
        section_wdg.add_style("margin: 10px")
        section_wdg.set_box_shadow("1px 1px 1px 1px")

        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")

        section_wdg.add_color("background", "background")
        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: 0px 10px 10px 5px")


        div = DivWdg()
        section_wdg.add(div)
        div.add_style("padding: 3px")
        div.add_style("margin: 5px")
        #div.add_style("width: 210px")
        #div.add_style("height: 170px")
        div.add_style("width: 105px")
        div.add_style("height: 85px")
        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
Beispiel #18
0
    def get_section_wdg2(self, title, description, image, behavior):

        section_wdg = DivWdg()
        section_wdg.set_round_corners()
        section_wdg.add_border()
        section_wdg.add_style("width: 200px")
        section_wdg.add_style("height: 175px")
        section_wdg.add_style("overflow: hidden")
        section_wdg.add_style("margin: 10px")
        section_wdg.set_box_shadow("1px 1px 1px 1px")

        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")

        section_wdg.add_color("background", "background")
        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: 0px 10px 10px 5px")


        div = DivWdg()
        section_wdg.add(div)
        div.add_style("padding: 3px")
        div.add_style("margin: 5px")
        #div.add_style("width: 210px")
        #div.add_style("height: 170px")
        div.add_style("width: 105px")
        div.add_style("height: 85px")
        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
Beispiel #19
0
    def get_display(my):

        if my.get_example_chooser == 'true':
            return my.get_example_chooser_content()

        div = DivWdg()
        div.set_id("UiPlaygroundPanelWdg")

        title = "UI Playground"
        title_wdg = DivWdg()
        title_wdg.add_looks("fnt_title_2")
        title_wdg.add(title)
        div.add(title_wdg)

        div.add(HtmlElement.hr())

        div.add('<br/>')
        click_chooser = DivWdg()
        click_chooser.add_looks("fnt_text")
        click_chooser.add(" UI Examples List Popup")
        click_chooser.add_class("SPT_DTS")
        click_chooser.add_styles(
            "cursor: pointer; padding: 6px; width: 130px; background-color: black;"
        )

        click_chooser.add_behavior( {'type': 'click_up',
                                     'cbfn_action': 'spt.popup.get_widget',
                                     'options': { 'title': 'TACTIC&trade; UI Examples',
                                                  'width': '400px',
                                                  'popup_id': 'UiExamplesChooserPopup',
                                                  'popup_parent_id': 'UiPlaygroundPanelWdg',
                                                  'class_name': 'tactic.ui.panel.ui_playground_panel_wdg.' \
                                                                'UiPlaygroundPanelWdg'
                                                  },
                                     'args': { 'get_example_chooser': 'true' }
                                     } )

        div.add(click_chooser)
        div.add('<br/>')

        example_display_div = DivWdg()
        example_display_div.add_styles("padding: 10px;")
        example_display_div.set_id("UiExampleDisplayDiv")

        div.add(example_display_div)

        div.add('<br/>')
        div.add('<br/>')

        return div
Beispiel #20
0
    def get_header_option_wdg(self):

        return

        if self.kwargs.get("use_cache2") not in ['true', True]:
            return

        div = DivWdg()

        div.add("Last Calculated: 5 days ago<br/><hr/>")

        div.add("Recalculate")
        div.add_class("hand")

        #from tactic.ui.widget import ActionButtonWdg
        #button = ActionButtonWdg(title="Recalculate")
        #div.add(button)

        div.add_behavior({
            'type':
            'click_up',
            'cbjs_action':
            '''
        var table = bvr.src_el.getParent(".spt_table");
        //var search_keys = spt.dg_table.get_search_keys();
        var search_keys = spt.dg_table.get_selected_search_keys(table);

        if (search_keys.length == 0) {
            spt.alert("No rows selected");
            return;
        }

        var header = bvr.src_el.getParent(".spt_table_th");
        var element_name = header.getAttribute("spt_element_name");

        spt.app_busy.show("Recalculating ...");
        var kwargs = {
            element_name: element_name,
            search_keys: search_keys,
        }
        spt.app_busy.show("Recalculating ...");
        var server = TacticServerStub.get();
        var class_name = 'tactic.ui.table.ExpressionRecalculateCmd';
        server.execute_cmd(class_name, kwargs);
        spt.app_busy.hide("Recalculating ...");
        '''
        })

        return div
Beispiel #21
0
    def get_logins_wdg(my, logins):
        logins_div = DivWdg()
        for login in logins:
            login_div = DivWdg()
            logins_div.add(login_div)
            login_div.add_style("padding: 5px")
            # login_div.add_style("height: 30px")
            login_div.add_style("margin: 0 5px 5px 0")
            login_div.add_attr("spt_login", login.get_value("login"))

            thumb_div = DivWdg()
            login_div.add(thumb_div)
            thumb_div.add_style("float: left")
            thumb_div.add_style("margin-right: 5px")
            thumb_div.add_style("padding-top: 1px")

            thumb = ThumbWdg()
            thumb.set_sobject(login)
            thumb_div.add(thumb)
            thumb.set_icon_size(15)

            login_div.add(login.get_full_name())

            login_div.add_behavior(
                {
                    "type": "click_up",
                    "sobject_display_expr": my.sobject_display_expr,
                    "tab_view": my.tab_view,
                    "cbjs_action": """
            var top = bvr.src_el.getParent(".spt_schedule_top");
            var class_name = 'tactic.ui.tools.schedule_wdg.ScheduleUserToolWdg';
            var login = bvr.src_el.getAttribute("spt_login")

            var kwargs = {
                login: login
            };
            if (bvr.sobject_display_expr)
                kwargs['sobject_display_expr'] = bvr.sobject_display_expr;
            if (bvr.tab_view)
                kwargs['tab_view'] = bvr.tab_view;

            var content = top.getElement(".spt_schedule_content");
            spt.panel.load(content, class_name, kwargs);
            """,
                }
            )
            login_div.add_hover()

        return logins_div
    def get_display(self):

        if self.get_example_chooser == 'true':
            return self.get_example_chooser_content()

        div = DivWdg()
        div.set_id("UiPlaygroundPanelWdg")

        title = "UI Playground"
        title_wdg = DivWdg()
        title_wdg.add_looks("fnt_title_2")
        title_wdg.add(title)
        div.add(title_wdg)

        div.add(HtmlElement.hr())

        div.add( '<br/>' )
        click_chooser = DivWdg()
        click_chooser.add_looks("fnt_text")
        click_chooser.add( " UI Examples List Popup" )
        click_chooser.add_class("SPT_DTS")
        click_chooser.add_styles("cursor: pointer; padding: 6px; width: 130px; background-color: black;")

        click_chooser.add_behavior( {'type': 'click_up',
                                     'cbfn_action': 'spt.popup.get_widget',
                                     'options': { 'title': 'TACTIC&trade; UI Examples',
                                                  'width': '400px',
                                                  'popup_id': 'UiExamplesChooserPopup',
                                                  'popup_parent_id': 'UiPlaygroundPanelWdg',
                                                  'class_name': 'tactic.ui.panel.ui_playground_panel_wdg.' \
                                                                'UiPlaygroundPanelWdg'
                                                  },
                                     'args': { 'get_example_chooser': 'true' }
                                     } )


        div.add( click_chooser )
        div.add( '<br/>' )

        example_display_div = DivWdg()
        example_display_div.add_styles( "padding: 10px;" )
        example_display_div.set_id("UiExampleDisplayDiv")

        div.add( example_display_div )

        div.add( '<br/>' )
        div.add( '<br/>' )

        return div
    def get_header_option_wdg(my):

        return

        if my.kwargs.get("use_cache2") not in ["true", True]:
            return

        div = DivWdg()

        div.add("Last Calculated: 5 days ago<br/><hr/>")

        div.add("Recalculate")
        div.add_class("hand")

        # from tactic.ui.widget import ActionButtonWdg
        # button = ActionButtonWdg(title="Recalculate")
        # div.add(button)

        div.add_behavior(
            {
                "type": "click_up",
                "cbjs_action": """
        var table = bvr.src_el.getParent(".spt_table");
        //var search_keys = spt.dg_table.get_search_keys();
        var search_keys = spt.dg_table.get_selected_search_keys(table);

        if (search_keys.length == 0) {
            spt.alert("No rows selected");
            return;
        }

        var header = bvr.src_el.getParent(".spt_table_th");
        var element_name = header.getAttribute("spt_element_name");

        spt.app_busy.show("Recalculating ...");
        var kwargs = {
            element_name: element_name,
            search_keys: search_keys,
        }
        spt.app_busy.show("Recalculating ...");
        var server = TacticServerStub.get();
        var class_name = 'tactic.ui.table.ExpressionRecalculateCmd';
        server.execute_cmd(class_name, kwargs);
        spt.app_busy.hide("Recalculating ...");
        """,
            }
        )

        return div
Beispiel #24
0
    def get_small_section_wdg(my, title, description, image, behavior):

        section_wdg = DivWdg()
        section_wdg.set_round_corners()
        section_wdg.add_border()
        section_wdg.add_style("width: 225px")
        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 5px")

        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")

        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: 5px")
        div.add_style("margin: 5px")
        div.add_style("width: 65px")
        div.add_style("height: 50px")
        div.add_style("float: left")
	div.add_style("text-align: center")
        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
Beispiel #25
0
    def get_logins_wdg(my, logins):
        logins_div = DivWdg()
        for login in logins:
            login_div = DivWdg()
            logins_div.add(login_div)
            login_div.add_style("padding: 5px")
            #login_div.add_style("height: 30px")
            login_div.add_style("margin: 0 5px 5px 0")
            login_div.add_attr("spt_login", login.get_value("login"))

            thumb_div = DivWdg()
            login_div.add(thumb_div)
            thumb_div.add_style("float: left")
            thumb_div.add_style("margin-right: 5px")
            thumb_div.add_style("padding-top: 1px")

            thumb = ThumbWdg()
            thumb.set_sobject(login)
            thumb_div.add(thumb)
            thumb.set_icon_size(15)

            login_div.add(login.get_full_name())

            login_div.add_behavior( {
            'type': 'click_up',
            'sobject_display_expr' : my.sobject_display_expr,
            'tab_view' : my.tab_view,
            'cbjs_action': '''
            var top = bvr.src_el.getParent(".spt_schedule_top");
            var class_name = 'tactic.ui.tools.schedule_wdg.ScheduleUserToolWdg';
            var login = bvr.src_el.getAttribute("spt_login")

            var kwargs = {
                login: login
            };
            if (bvr.sobject_display_expr)
                kwargs['sobject_display_expr'] = bvr.sobject_display_expr;
            if (bvr.tab_view)
                kwargs['tab_view'] = bvr.tab_view;

            var content = top.getElement(".spt_schedule_content");
            spt.panel.load(content, class_name, kwargs);
            ''' 
            } )
            login_div.add_hover()


        return logins_div
Beispiel #26
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
Beispiel #27
0
    def get_display(self):

        top = DivWdg()
        top.set_id('top_of_application')

        top.add_style("overflow: hidden")

        from tactic.ui.panel import HashPanelWdg
        splash_div = HashPanelWdg.get_widget_from_hash("/splash",
                                                       return_none=True)
        if not splash_div:

            splash_div = DivWdg()
            splash_div.add_style('text-align: center')
            splash_div.add(
                '<img src="/context/icons/common/indicator_snake.gif" border="0"/>'
            )
            splash_div.add("&nbsp; &nbsp;")
            project = Project.get()
            title = project.get_value("title")
            if not title:
                title = "TACTIC"

            splash_div.add('''Loading "%s" ....''' % title)
            splash_div.add_style("font-size: 1.5em")
            splash_div.add_style("margin: 200 0 500 0")

        splash_div.add_behavior({
            'type':
            'load',
            'hash':
            self.hash,
            'cbjs_action':
            '''
            if (bvr.hash) {
                spt.hash.hash = "/" + bvr.hash;
            }
            else {
                spt.hash.hash = "/index";
            }
            spt.hash.set_index_hash("link/_startup");
            '''
        })

        top.add(splash_div)

        return top
Beispiel #28
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
Beispiel #29
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
Beispiel #30
0
    def get_display(my):

        use_popup = my.kwargs.get("use_popup")
        if use_popup in [True, 'true']:
            use_popup = True
        else:
            use_popup = False

        div = DivWdg()
        content = my.get_content()
        content.add_style("width: 600px")
        content.add_style("margin-left: auto")
        content.add_style("margin-right: auto")

        from tactic.ui.container import PopupWdg
        if use_popup:
            popup = PopupWdg(id="LicenseManagerWdg",
                             width="500px",
                             allow_page_activity="false",
                             display='true',
                             zstart=10000,
                             allow_close=my.allow_close)
            popup.add("License Manager", "title")

            popup.add(content, "content")
            div.add(popup)

            behavior = {
                'type':
                'load',
                'cbjs_action':
                '''
                var el = $(LicenseManagerWdg);
                el.setStyle("display","");
                //var parent = el.getParent(".spt_panel");
                //parent.setStyle("left: 0px");
                //parent.setStyle("margin-right: auto");
                '''
            }
            div.add_behavior(behavior)

        else:
            div.add(content)
            content.add_style("height: 500px")

        return div
Beispiel #31
0
    def get_display(my):
        
        sobject = my.get_current_sobject()

        value = sobject.get_value( my.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 = my.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
Beispiel #32
0
    def get_display_single_on_load_bvr(self):
        class_path = Common.get_full_class_name(self)

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

        count = self.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
Beispiel #33
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
Beispiel #34
0
    def get_display(my):
        top = my.top
        my.set_as_panel(top)

        inner = DivWdg()
        top.add(inner)
        inner.add_behavior({
            'type': 'load',
            'cbjs_action': MessageWdg.get_onload_js()
        })

        inner.add_style("min-width: 400px")

        key = my.kwargs.get("key")
        interval = True

        top.add(my.get_chat_wdg(key, interval))
        return top
Beispiel #35
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
Beispiel #36
0
    def get_item_div(my, sobject):
        ''' get the item div the sobject'''
        top = DivWdg()
        top.add_attr('title', 'Click to remove')
        # FIXME: put this here for now
        top.add_behavior({
            'type':
            'click_up',
            #'cbjs_action': '''spt.dg_table_action.sobject_drop_remove(evt,bvr)'''
            'cbjs_action':
            '''spt.drop.sobject_drop_remove(evt,bvr)'''
        })

        top.add_class("spt_drop_item")
        top.add_class("SPT_DROP_ITEM")

        item_div = DivWdg()
        item_div.add_class("hand")
        item_div.add_style("float: clear")
        top.add(item_div, "item_div")

        #my.menu.set_over(item_div, event="mousein")
        #my.menu.set_out(top, event="mouseleave")

        # set this as the place for the display value to go
        item_div.add_class("spt_drop_display_value")

        add_icon = True
        ExpressionParser.clear_cache()
        if sobject:
            if add_icon:
                my._add_icon(sobject, item_div)

            if my.display_expr:
                display_value = Search.eval(my.display_expr,
                                            sobjects=sobject,
                                            single=True)
            else:
                display_value = sobject.get_display_value()
            if isinstance(display_value, list):
                display_value = display_value[0]
            item_div.add(display_value)
            my.values.append(SearchKey.get_by_sobject(sobject))
        return top
    def get_display(my):

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

        top = my.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': my.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
Beispiel #38
0
    def get_example_display(self):

        div = DivWdg()

        # --- Example of FIRING a DOM event for a 'dom_listen' behavior type --------------------------------------

        dom_event_name = 'domselffire'
        dom_fire_div = DivWdg()
        dom_fire_div.set_style("border: 1px solid #000000; background: #0000AA; width: 200px; height: 100px; " \
                                 "cursor: pointer;")
        dom_fire_div.add("Firing a DOM event (for 'dom_event' type behavior)!")
        dom_fire_div.add_behavior( {'type': 'click',
                                    'cbfn_action': 'spt.ui_play.dom_event_self_fire_action',
                                    'options': {'event_name': dom_event_name} } )
        dom_fire_div.add_behavior( {'type': 'dom_listen', 'event_name': dom_event_name,
                                    'cbfn_action': 'spt.ui_play.dom_listen_cbk'} )
        div.add( dom_fire_div )

        return div
Beispiel #39
0
    def get_display(my):
        top = my.top
        my.set_as_panel(top)

        inner = DivWdg()
        top.add(inner)
        inner.add_behavior( {
            'type': 'load',
            'cbjs_action': MessageWdg.get_onload_js()
        } )

        inner.add_style("min-width: 400px")


        key = my.kwargs.get("key")
        interval = True
        
        top.add( my.get_chat_wdg(key, interval) )
        return top
Beispiel #40
0
    def get_item_div(my, sobject):
        ''' get the item div the sobject'''
        top = DivWdg()
        top.add_style("padding: 3px 2px")
        top.add_attr('title','Click to remove')
        # FIXME: put this here for now
        top.add_behavior( {
            'type': 'click_up',
            #'cbjs_action': '''spt.dg_table_action.sobject_drop_remove(evt,bvr)'''
            'cbjs_action': '''spt.drop.sobject_drop_remove(evt,bvr)'''
        } )

        top.add_class("spt_drop_item")
        top.add_class("SPT_DROP_ITEM")

        item_div = DivWdg()
        item_div.add_class("hand")
        item_div.add_style("float: clear")
        top.add(item_div, "item_div")


        #my.menu.set_over(item_div, event="mousein")
        #my.menu.set_out(top, event="mouseleave")


        # set this as the place for the display value to go
        item_div.add_class("spt_drop_display_value")

        add_icon = True
        ExpressionParser.clear_cache()
        if sobject:
            if add_icon:
                my._add_icon(sobject, item_div)

            if my.display_expr:
                display_value = Search.eval(my.display_expr, sobjects = sobject, single=True)
            else:
                display_value = sobject.get_display_value()
            if isinstance(display_value, list):
                display_value = display_value[0]
            item_div.add( display_value )
            my.values.append( SearchKey.get_by_sobject(sobject) )
        return top
Beispiel #41
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
Beispiel #42
0
    def get_display(self):

        top = DivWdg()
        top.set_id('top_of_application')

        top.add_style("overflow: hidden")

        from tactic.ui.panel import HashPanelWdg 
        splash_div = HashPanelWdg.get_widget_from_hash("/splash", return_none=True)
        if not splash_div:

            splash_div = DivWdg()
            splash_div.add_style('text-align: center')
            splash_div.add('<img src="/context/icons/common/indicator_snake.gif" border="0"/>')
            splash_div.add("&nbsp; &nbsp;")
            project = Project.get()
            title = project.get_value("title")
            if not title:
                title = "TACTIC"

            splash_div.add('''Loading "%s" ....'''% title)
            splash_div.add_style("font-size: 1.5em")
            splash_div.add_style("margin: 200 0 500 0")


        splash_div.add_behavior( {
            'type': 'load',
            'hash': self.hash,
            'cbjs_action': '''
            if (bvr.hash) {
                spt.hash.hash = "/" + bvr.hash;
            }
            else {
                spt.hash.hash = "/index";
            }
            spt.hash.set_index_hash("link/_startup");
            '''
        } )


        top.add(splash_div)

        return top
Beispiel #43
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
Beispiel #44
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
Beispiel #45
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
Beispiel #46
0
    def get_search_wdg(self):
        filter_div = DivWdg()
        filter_div.add_style("width: 100px")

        buttons_list = [
            {
                'label': 'Run Search',
                'tip': 'Run search with this criteria'
            },
        ]

        txt_btn_set = TextBtnSetWdg(position='',
                                    buttons=buttons_list,
                                    spacing=6,
                                    size='large',
                                    side_padding=4)
        run_search_bvr = {
            'type':
            'click_up',
            'cbjs_action':
            '''
                spt.app_busy.show('Search ...', 'Searching Active Directory for matching users.');
                setTimeout( function() {
                var top = bvr.src_el.getParent('.ad_search_wdg_top');
                var values = spt.api.Utility.get_input_values(top);
                spt.panel.refresh(top, values);
                spt.app_busy.hide();
                }, 100);
            '''
        }
        txt_btn_set.get_btn_by_label('Run Search').add_behavior(run_search_bvr)
        #filter_div.add( txt_btn_set )

        div = DivWdg()
        div.add_behavior(run_search_bvr)
        button = ProdIconButtonWdg("Run Search")
        button.add_behavior(run_search_bvr)

        div.add(button)
        filter_div.add(div)
        return filter_div
Beispiel #47
0
    def get_display(my):

        div = DivWdg()

        js_editor_wdg = ShelfEditWdg()

        # div.add( "[<span onclick='$(\"ShelfEditWdg\").setStyle(\"display\",\"block\");' style='cursor: pointer;'>" \
        #          "js_edit<span>]" )

        launch_link = DivWdg()
        launch_link.add( "[js_edit]" )
        launch_link.add_style("cursor: pointer;")
        launch_link.add_behavior( {
            "type": "click_up",
            "cbjs_action": "spt.popup.open('ShelfEditWdg', false);"
        } )

        div.add( launch_link )
        div.add( js_editor_wdg )

        return div
Beispiel #48
0
    def get_display(self):

        raise Exception("tactic.widget.ColorInputWdg is deprecated")

        color_div = DivWdg()
        color_div.add_style("z-index: 1000")
        #color_div.add_style("float: left")
        import random
        number = random.randint(1, 1000)
        rainbow_id = "rainbow_%s" % number

        color_div.add('''
        <img id="%s" src="/context/spt_js/mooRainbow/rainbow.png" alt="[r]" width="16" height="16" />
        ''' % rainbow_id)
        #<input id="selfInput" name="selfInput" type="text" size="13" />

        text = TextWdg(self.get_name())
        text.set_id("selfInput")
        behavior = {
            'type': 'keyboard',
            'kbd_handler_name': 'DgTableMultiLineTextEdit'
        }
        text.add_behavior(behavior)
        color_div.add(text)


        color_div.add_behavior( { 
            "type": "load",
            "cbjs_action": '''
            var r = new MooRainbow('%s', {
                startColor: [58, 142, 246],
                imgPath:    '/context/spt_js/mooRainbow/images/',
                onComplete: function(color) { $(myInput).value=color.hex; }
            });
            ''' % rainbow_id
        } )



        return color_div
Beispiel #49
0
    def get_display_on_load_bvr_on_each_widget(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

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

        if count < 10:

            top.add_behavior({
                'type':
                'load',
                'cbjs_action':
                '''
                    var server = TacticServerStub.get();
                    var widget_class = '%s';
                    var args = {
                        count: '%s'
                    };
                    var html = server.get_widget(widget_class, {args:args});
                    var main = $('main_body');

                    var div = document.createElement('div');
                    spt.behavior.replace_inner_html(div, html);
                    main.appendChild(div);

                ''' % (class_path, count)
            })

        return top
Beispiel #50
0
    def get_display(self):

        sobject = self.get_current_sobject()
        if sobject.is_insert():
            return ""

        if sobject:
            path = sobject.get_web_path_by_type()
            filename = os.path.basename(path)

            if sobject.get_value("snapshot_type") == "sequence":
                file_range = sobject.get_file_range()
                filename = "%s (%s)" % (filename, file_range.get_display())

            widget = DivWdg()
            widget.add_style("display: inline-block")
            link = HtmlElement.href(filename, ref=path)
            link.add_attr("download", filename)
            # do this in javascript because the link doesn't
            # work for some reason
            widget.add_behavior({
                'type':
                'click',
                'filename':
                filename,
                'href':
                path,
                'cbjs_action':
                '''
                var a = document.createElement('a');
                a.href = bvr.href;
                a.download = bvr.filename;
                a.click();
                '''
            })
            widget.add(link)
        else:
            widget = ""

        return widget
Beispiel #51
0
    def get_display(self):
        parent = self.get_current_sobject()
        parent_key = SearchKey.get_by_sobject(parent)

        div = DivWdg()

        from pyasm.widget import IconButtonWdg, IconWdg
        icon = IconButtonWdg("Add Task", IconWdg.ADD)
        div.add(icon)
        #div.add("Add Tasks")
        div.add_class("hand")
        div.add_behavior({
            "type": "click_up",
            "parent_type": parent.get_base_search_type(),
            "cbfn_action": "spt.dg_table.add_tasks_cbk",
        })

        content = DivWdg()
        content.add_class("content")
        div.add(content)

        return div
Beispiel #52
0
    def get_sequence_wdg(my):

        funcs = []

        div = DivWdg()
        if not my.sequence_data:
            return div

        div.add_behavior( {
            'type': 'load',
            'data': my.sequence_data,
            'cbjs_action': '''

            var count = -1;

            var func = function() {
                if (count == bvr.data.length-1) {
                    return;
                }
                count += 1;

                var item = bvr.data[count];
                var unique_id = item.unique_id;
                var class_name = item.class_name;
                var kwargs = item.kwargs;

                var options = {
                    async: true,
                    callback: func
                }
                spt.panel.load($(unique_id), class_name, kwargs, {}, options);

            }

            func();

            '''
        } )
        return div
    def get_example_display(my):

        scroll_div = DivWdg()

        scroll_div.add_style("width: 150px")
        scroll_div.add_style("height: 80px")
        scroll_div.add_style("background: #880000")
        scroll_div.add_style("border: 2px solid #111111")
        scroll_div.add_style("overflow: hidden")

        lots_of_text = '''
TACTIC is an asset and production management system for managing productions and their assets. It can be used by one user&#44; or by hundreds. Task management and asset management can often be a daunting task in productions. Managing the relationships between these items takes effort&#44; and there can be many oportunities for things to get lost or overlooked. TACTIC takes care of managing these relationships between assets and tasks. It creates a clean and easy-to-manage readable filesystem where users only need to check out and check in their assets. They do not need to worry about where a file goes&#44; what it&#39;s called&#44; or if it&#39;s being versioned correctly. The TACTIC architecture allows asset management to be possible in just about any production environment. For new productions&#44; TACTIC provides predefined&#44; ready-to-use 3D and Flash production modules out of the box. Existing productions can build their project from the ground up to manage their specific types of processes and files using a custom TACTIC project. 
How Does TACTIC Work? TACTIC provides a simple system of containers (also called "search types"). The type of production asset being managed determines the type of search type required. A search type is added to the system for every production asset (which in TACTIC terms is called an "SObject")&#44; so the SObject can be managed when it is checked out and back in. Production management is made possible when a pipeline (a set of production processes) is associated with the SObject&#44; denoting which departments it needs to flow through to get to the finish line. In the predefined project modules&#44; search types also provide built-in handling for different file types&#44; and in some cases deep integration with the production software. This may allow users to use the TACTIC interface to check out and open files directly into their production environment (for example&#44; XSI&#44; Maya&#44; Houdini or Flash)&#44; and then save them and check them back in one step. 
        '''
        sd_contents_div = DivWdg()
        sd_contents_div.add(lots_of_text)
        sd_contents_div.add_style("width: 500px")
        sd_contents_div.add_style("height: 200px")

        sd_contents_div.add_style("text-align: justify")
        '''
        # original raw behavior to do panning scroll ...
        test_bvr = {
                'type': 'drag',
                'modkeys': 'ALT',
                'dst_el': '@.parentNode',
                'cbfn_setup': 'spt.mouse.panning_scroll_setup',
                'cbfn_motion': 'spt.mouse.panning_scroll_motion'
        }
        '''
        # use of implemented 'panning_scroll' behavior ...
        test_bvr = {'type': 'panning_scroll'}

        sd_contents_div.add_behavior(test_bvr)

        scroll_div.add(sd_contents_div)

        return scroll_div
Beispiel #54
0
    def init(my):

        top = DivWdg()
        top.set_id('top_of_application')

        msg_div = DivWdg()
        msg_div.add_style('text-align: center')
        msg_div.add('<img src="/context/icons/common/indicator_snake.gif" border="0"/>')
        msg_div.add("&nbsp; &nbsp;")
        project = Project.get()
        title = project.get_value("title")
        if not title:
            title = "TACTIC"

        msg_div.add('''Loading "%s" ....'''% title)
        msg_div.add_style("font-size: 1.5em")

        msg_div.add_behavior( {
            'type': 'load',
            'hash': my.hash,
            'cbjs_action': '''
            if (bvr.hash) {
                spt.hash.hash = "/" + bvr.hash;
            }
            else {
                spt.hash.hash = "/index";
            }
            spt.hash.set_index_hash("link/_startup");
            '''
        } )

        msg_div.add_style("margin: 200 0 500 0")
        top.add(msg_div)

        my.add(top)
        return
Beispiel #55
0
    def get_title_wdg(my):

        title = my.kwargs.get("title")
        if not title:
            widget = my.get_widget("title")
            if not widget and my.widgets:
                widget = my.widgets[0]
                title = widget.get_name().title()
        if not title:
            title = "No Title"

        icon = my.kwargs.get("icon")
        if not icon:
            icon = "G_FOLDER"

        title_div = DivWdg()
        title_div.add_class("spt_content_box_title")

        # icon on the left
        icon_div = DivWdg()
        title_div.add(icon_div)
        icon = IconWdg(icon=icon, width=16)
        icon_div.add(icon)
        icon_div.add_styles(
            '''float: left; height: 25px; margin-top: 0px; padding: 0px 8px 0px 5px;'''
        )

        # icon on the right
        show_gear = my.kwargs.get("show_gear")
        if show_gear in [True, 'true']:
            icon_div = DivWdg()
            title_div.add(icon_div)
            icon = IconWdg(icon="G_SETTINGS", width=16)
            icon_div.add(icon)
            icon_div.add_styles(
                '''float: right; height: 25px; margin-top: 0px; padding: 0px 8px 0px 5px;'''
            )

        icon_div = DivWdg()
        title_div.add(icon_div)
        icon = IconButtonWdg(icon="G_UP", width=16)
        icon_div.add(icon)
        icon_div.add_styles(
            '''float: right; height: 25px; margin-top: 0px; padding: 0px 8px;'''
        )
        icon_div.add_behavior({
            'type':
            'click_up',
            'cbjs_action':
            '''
            var top = bvr.src_el.getParent(".spt_content_box");
            var content = top.getElement(".spt_content_box_content");
            var inner = top.getElement(".spt_content_box_inner");
            var state = inner.getAttribute("spt_state");
            if ( state != "closed" ) {
                var size = inner.getSize();
                dst = -size.y-5;
                inner.setAttribute("spt_state", "open");
            }
            else {
                dst = 0;
                inner.setAttribute("spt_state", "closed");
            }
            new Fx.Tween(content, {duration: 500}).start("margin-top", dst);


            '''
        })

        icon_div = DivWdg()
        title_div.add(icon_div)
        icon = IconButtonWdg(icon="G_MAXIMIZE", width=16)
        icon_div.add(icon)
        icon_div.add_styles(
            '''float: right; height: 25px; margin-top: 0px; padding: 0px 0px;'''
        )

        icon_div.add_behavior({
            'type':
            'click_up',
            'cbjs_action':
            '''
            var top = bvr.src_el.getParent(".spt_content_box");
            if (top.hasClass("spt_content_box_max")) {
                top.removeClass("spt_content_box_max");
                top.addClass("spt_content_box_inline");
                top.size = top.getSize();
                var window_size = window.getSize();
                top.setStyle("height", window_size.y)


            }
            else {
                top.addClass("spt_content_box_max");
                top.removeClass("spt_content_box_inline");
                var size = top.size;
                top.setStyle("height", size.y)
            }
            '''
        })

        #title_div.add('''<div style="float: right; width: 20px; height: 20px; margin-top: -9px; margin-right: -8px; padding: 8px; border: solid 0px #000;">X</div>''')

        title_div.add(title)

        return title_div
Beispiel #56
0
    def get_main_section_wdg(self,
                             title,
                             description,
                             image,
                             behavior,
                             img_height="64px"):

        section_wdg = DivWdg()
        #section_wdg.set_round_corners()
        section_wdg.add_border()
        section_wdg.add_style("width: 225px")
        section_wdg.add_style("height: 225px")
        section_wdg.add_style("overflow: hidden")
        section_wdg.add_style("margin: -5px 5px 10px 5px")
        #section_wdg.add_style("margin: 10px")
        #section_wdg.set_box_shadow()

        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_style("text-align: center")
        title_wdg.add_color("background", "background", -5)

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

        shadow = section_wdg.get_color("shadow")

        section_wdg.add_behavior({
            'type':
            'click',
            'shadow':
            shadow,
            'cbjs_action':
            '''
        bvr.src_el.setStyle("box-shadow", "0px 0px 5px " + bvr.shadow);
        '''
        })

        section_wdg.add_behavior({
            'type':
            'mouseenter',
            'shadow':
            shadow,
            'cbjs_action':
            '''
        bvr.src_el.setStyle("box-shadow", "0px 0px 5px " + bvr.shadow);
        ''',
        })

        section_wdg.add_behavior({
            'type':
            'mouseleave',
            'shadow':
            shadow,
            'cbjs_action':
            '''
        bvr.src_el.setStyle("box-shadow", "0px 0px 0px " + bvr.shadow);
        ''',
        })

        desc_div = DivWdg()
        desc_div.add(description)
        desc_div.add_style("padding: 5px 10px 10px 10px")
        #desc_div.add_style("font-size: 1.5em")
        #desc_div.add_style("font-weight: bold")

        div = DivWdg()
        section_wdg.add(div)
        div.add_style("padding: 3px")
        div.add_style("margin: 10px")
        div.add_style("width: 209px")
        div.add_style("height: %s" % img_height)
        div.add_style("text-align: center")
        div.add(image)
        #div.set_box_shadow("1px 1px 1px 1px")
        section_wdg.add(desc_div)
        div.add_style("overflow: hidden")

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

        return section_wdg
Beispiel #57
0
    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
Beispiel #58
0
    def init(my):
        my.body = HtmlElement("body")
        Container.put("TopWdg::body", my.body)

        my.top = DivWdg()
        my.body.add(my.top)
        my.top.add_class("spt_top")
        Container.put("TopWdg::top", my.top)

        click_div = DivWdg()
        my.top.add(click_div)
        click_div.add_behavior({
            'type':
            'load',
            'cbjs_action':
            '''
        spt.body = {};
        spt.body.focus_elements = [];
        spt.body.add_focus_element = function(el) {
            spt.body.focus_elements.push(el);
        }

        // find all of the registered popups and close them
        // NOTE: logic can handle more than 1 focus element should it happen ...
        spt.body.hide_focus_elements = function(evt) {
            var mouse = evt.client;
            var target = evt.target;
            
            var targets = [];
            var count = 0;
            while (target) {
                targets.push(target);
                if (spt.has_class(target, 'spt_activator')) {
                    act_el = target.dialog;
                    if (act_el) {
                        targets.push(act_el);
                        break;
                    }
                }
                target = target.parentNode;
                if (count == 100) {
                    alert("Too many to close.");
                    break;
                }

            }

            // find out if any of the parents of target is the focus element
            for (var i = 0; i < spt.body.focus_elements.length; i++) {
                var el = spt.body.focus_elements[i];
                var hit = false;

                for (var j = 0; j < targets.length; j++) {
                    var target = targets[j];
                    if (target == el) {
                         hit = true;
                         break;
                         
                    }
                }
        
                if (hit)
                    break;
                else{
                    spt.hide(el);
      
                }
            }
            if (!hit)
                spt.body.focus_elements = [];

        }
        //bvr.src_el.addEvent("mousedown", spt.body.hide_focus_elements);
        document.body.addEvent("mousedown", spt.body.hide_focus_elements);
        '''
        })

        web = WebContainer.get_web()
        my.body.add_color("color", "color")

        if web.is_title_page():
            my.body.add_gradient("background", "background", 0, -20)
        else:
            my.body.add_gradient("background", "background", 0, -15)

        my.body.add_style("background-attachment: fixed !important")
        #my.body.add_style("min-height: 1200px")
        #my.body.add_style("height: 100%")
        my.body.add_style("margin: 0px")
        my.body.add_style("padding: 0px")

        # ensure that any elements that force the default menu over any TACTIC right-click context menus has the
        # 'force_default_context_menu' flag reset for the next right click that occurs ...
        #
        my.body.add_event("oncontextmenu",
                          "spt.force_default_context_menu = false;")
Beispiel #59
0
    def get_display(my):

        web = WebContainer.get_web()

        widget = Widget()
        html = HtmlElement("html")

        is_xhtml = False
        if is_xhtml:
            web.set_content_type("application/xhtml+xml")
            widget.add('''<?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html 
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
            ''')
            html.add_attr("xmlns", "http://www.w3.org/1999/xhtml")
            #html.add_attr("xmlns:svg", "http://www.w3.org/2000/svg")

        # add the copyright
        widget.add(my.get_copyright_wdg())
        widget.add(html)

        # create the header
        head = HtmlElement("head")
        html.add(head)

        head.add(
            '<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>\n'
        )
        head.add('<meta http-equiv="X-UA-Compatible" content="IE=edge"/>\n')

        # Add the tactic favicon
        head.add(
            '<link rel="shortcut icon" href="/context/favicon.ico" type="image/x-icon"/>'
        )

        # add the css styling
        head.add(my.get_css_wdg())

        # add the title in the header
        project = Project.get()
        project_code = project.get_code()
        project_title = project.get_value("title")

        if web.is_admin_page():
            is_admin = " - Admin"
        else:
            is_admin = ""

        if project_code == 'admin':
            head.add("<title>TACTIC Site Admin</title>\n")
        else:
            head.add("<title>%s%s</title>\n" % (project_title, is_admin))

        # add the javascript libraries
        head.add(JavascriptImportWdg())

        # add the body
        body = my.body
        html.add(body)
        body.add_event('onload', 'spt.onload_startup(this)')

        top = my.top

        # Add a NOSCRIPT tag block here to provide a warning message on browsers where 'Enable JavaScript'
        # is not checked ... TODO: clean up and re-style to make look nicer
        top.add("""
        <NOSCRIPT>
        <div style="border: 2px solid black; background-color: #FFFF99; color: black; width: 600px; height: 70px; padding: 20px;">
        <img src="%s" style="border: none;" /> <b>Javascript is not enabled on your browser!</b>
        <p>This TACTIC powered, web-based application requires JavaScript to be enabled in order to function. In your browser's options/preferences, please make sure that the 'Enable JavaScript' option is checked on, click OK to accept the settings change, and then refresh this web page.</p>
        </div>
        </NOSCRIPT>
        """ % (IconWdg.get_icon_path("ERROR")))

        # add the content
        content_div = DivWdg()
        top.add(content_div)
        Container.put("TopWdg::content", content_div)

        # add a dummy button for global behaviors
        from tactic.ui.widget import ButtonNewWdg, IconButtonWdg
        ButtonNewWdg(title="DUMMY", icon=IconWdg.FILM)
        IconButtonWdg(title="DUMMY", icon=IconWdg.FILM)
        # NOTE: it does not need to be in the DOM.  Just needs to be
        # instantiated
        #content_div.add(button)

        if my.widgets:
            content_wdg = my.get_widget('content')
        else:
            content_wdg = Widget()
            my.add(content_wdg)

        content_div.add(content_wdg)

        # add a calendar wdg

        from tactic.ui.widget import CalendarWdg
        cal_wdg = CalendarWdg(css_class='spt_calendar_template_top')
        cal_wdg.top.add_style('display: none')
        content_div.add(cal_wdg)

        if web.is_admin_page():
            from tactic_branding_wdg import TacticCopyrightNoticeWdg
            branding = TacticCopyrightNoticeWdg(show_license_info=True)
            top.add(branding)

        # add the admin bar
        security = Environment.get_security()
        if not web.is_admin_page() and security.check_access(
                "builtin", "view_site_admin", "allow"):

            div = DivWdg()
            top.add(div)
            top.add_style("padding-top: 21px")

            div.add_class("spt_admin_bar")

            div.add_style("height: 15px")
            div.add_style("padding: 3px 0px 3px 15px")
            #div.add_style("margin-bottom: -5px")
            div.add_style("position: fixed")
            div.add_style("top: 0px")
            div.add_style("left: 0px")
            div.add_style("opacity: 0.7")
            div.add_style("width: 100%")
            #div.add_gradient("background", "background2", 20, 10)
            div.add_style("background-color", "#000")
            div.add_style("color", "#FFF")
            div.add_style("z-index", "1000")
            div.add_class("hand")
            div.set_box_shadow("0px 5px 5px")

            # remove
            icon_div = DivWdg()
            div.add(icon_div)
            icon_div.add_style("float: right")
            icon_div.add_style("margin-right: 10px")
            icon_div.add_style("margin-top: -3px")
            icon_button = IconButtonWdg(title="Remove Admin Bar",
                                        icon=IconWdg.G_CLOSE)
            icon_div.add(icon_button)
            icon_button.add_behavior({
                'type':
                'click_up',
                'cbjs_action':
                '''
                var parent = bvr.src_el.getParent(".spt_admin_bar");
                bvr.src_el.getParent(".spt_top").setStyle("padding-top", "0px");
                spt.behavior.destroy_element(parent);
                '''
            })

            div.add("<b>ADMIN >></b>")

            div.add_behavior({
                'type':
                'listen',
                'event_name':
                'close_admin_bar',
                'cbjs_action':
                '''
                bvr.src_el.getParent(".spt_top").setStyle("padding-top", "0px");
                spt.behavior.destroy_element(bvr.src_el);
                '''
            })

            div.add_behavior({
                'type':
                'mouseover',
                'cbjs_action':
                '''
                bvr.src_el.setStyle("opacity", 0.85)
                //new Fx.Tween(bvr.src_el).start('height', "30px");
                '''
            })
            div.add_behavior({
                'type':
                'mouseout',
                'cbjs_action':
                '''
                bvr.src_el.setStyle("opacity", 0.7)
                //new Fx.Tween(bvr.src_el).start('height', "15px");
                '''
            })
            project_code = Project.get_project_code()
            div.add_behavior({
                'type':
                'click_up',
                'cbjs_action':
                '''
                var url = "/tactic/%s/admin/link/_startup";
                window.open(url);

                ''' % project_code
            })

        # Add the script editor listener
        load_div = DivWdg()
        top.add(load_div)
        load_div.add_behavior({
            'type':
            'listen',
            'event_name':
            'show_script_editor',
            'cbjs_action':
            '''
        var js_popup_id = "TACTIC Script Editor";
        var js_popup = $(js_popup_id);
        if( js_popup ) {
            spt.popup.toggle_display( js_popup_id, false );
        }
        else {
            spt.panel.load_popup(js_popup_id, "tactic.ui.app.ShelfEditWdg", {}, {"load_once": true} );
        }
        '''
        })

        # deal with the palette defined in /index which can override the palette
        if my.kwargs.get("hash") == ():
            key = "index"
            search = Search("config/url")
            search.add_filter("url", "/%s/%%" % key, "like")
            search.add_filter("url", "/%s" % key)
            search.add_where("or")
            url = search.get_sobject()
            if url:
                xml = url.get_xml_value("widget")
                palette_key = xml.get_value("element/@palette")

                # look up palette the expression for index
                from pyasm.web import Palette
                palette = Palette.get()

                palette.set_palette(palette_key)
                colors = palette.get_colors()
                colors = jsondumps(colors)

                script = HtmlElement.script('''
                    var env = spt.Environment.get();
                    env.set_colors(%s);
                    env.set_palette('%s');
                    ''' % (colors, palette_key))
                top.add(script)

        env = Environment.get()
        client_handoff_dir = env.get_client_handoff_dir(include_ticket=False,
                                                        no_exception=True)
        client_asset_dir = env.get_client_repo_dir()

        login = Environment.get_login()
        user_name = login.get_value("login")
        user_id = login.get_id()
        login_groups = Environment.get_group_names()

        # add environment information
        script = HtmlElement.script('''
        var env = spt.Environment.get();
        env.set_project('%s');
        env.set_user('%s');
        env.set_user_id('%s');
        var login_groups = '%s'.split('|');
        env.set_login_groups(login_groups);
        env.set_client_handoff_dir('%s');
        env.set_client_repo_dir('%s');

        ''' % (Project.get_project_code(), user_name, user_id,
               '|'.join(login_groups), client_handoff_dir, client_asset_dir))
        top.add(script)

        # add a global container for commonly used widgets
        div = DivWdg()
        top.add(div)
        div.set_id("global_container")

        # add in the app busy widget
        # find out if there is an override for this
        search = Search("config/url")
        search.add_filter("url", "/app_busy")
        url = search.get_sobject()
        if url:
            busy_div = DivWdg()
            div.add(busy_div)

            busy_div.add_class("SPT_PUW")
            busy_div.add_styles(
                "display: none; position: absolute; z-index: 1000")

            busy_div.add_class("app_busy_msg_block")
            busy_div.add_style("width: 300px")
            busy_div.add_style("height: 100px")
            busy_div.add_style("padding: 20px")
            busy_div.add_color("background", "background3")
            busy_div.add_border()
            busy_div.set_box_shadow()
            busy_div.set_round_corners(20)
            busy_div.set_attr("id", "app_busy_msg_block")

            # put the custom url here

            title_wdg = DivWdg()
            busy_div.add(title_wdg)
            title_wdg.add_style("font-size: 20px")
            title_wdg.add_class("spt_app_busy_title")
            busy_div.add("<hr/>")
            msg_div = DivWdg()
            busy_div.add(msg_div)
            msg_div.add_class("spt_app_busy_msg")

        else:
            from page_header_wdg import AppBusyWdg
            div.add(AppBusyWdg())

        # popup parent
        popup = DivWdg()
        popup.set_id("popup")
        div.add(popup)

        # create another general popup
        popup_div = DivWdg()
        popup_div.set_id("popup_container")
        popup_div.add_class("spt_panel")
        popup = PopupWdg(id="popup_template", destroy_on_close=True)
        popup_div.add(popup)
        div.add(popup_div)

        inner_html_div = DivWdg()
        inner_html_div.set_id("inner_html")
        div.add(inner_html_div)

        # add in a global color
        from tactic.ui.input import ColorWdg
        color = ColorWdg()
        div.add(color)

        # add in a global notify wdg
        from notify_wdg import NotifyWdg
        widget.add(NotifyWdg())

        return widget
Beispiel #60
0
    def get_display(self):

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

        self.search_key = self.kwargs.get("search_key")
        sobject = Search.get_by_search_key(self.search_key)

        if sobject.get_base_search_type() == "sthpw/snapshot":
            snapshot = sobject
        elif sobject.get_base_search_type() == "sthpw/file":
            # if it is a file object
            snapshot = sobject.get_parent()
        else:
            snapshots = Snapshot.get_by_sobject(sobject, is_latest=True)
            snapshot = snapshots[0]

        # Extension determine UI class for preview
        thumb_path = snapshot.get_web_path_by_type("icon")
        web_src = snapshot.get_web_path_by_type("web")

        from pyasm.biz import File
        file_type = "main"
        lib_path = snapshot.get_lib_path_by_type(file_type)
        src = snapshot.get_web_path_by_type(file_type)
        if not web_src:
            web_src = src

        parts = os.path.splitext(src)
        ext = parts[1]
        ext = ext.lstrip(".")
        ext = ext.lower()

        #parent = snapshot.get_parent()

        top = self.top
        self.set_as_panel(top)

        if ext == "pdf":
            iframe = HtmlElement.iframe()
            iframe.set_attr('src', src)
            iframe.add_style("width: 100%")
            iframe.add_style("height: 800px")
            top.add(iframe)
            return top

        from tactic.ui.container import ResizableTableWdg
        table = ResizableTableWdg()
        top.add(table)
        tr = table.add_row()

        # These bvrs allow for smooth switching if switching between files
        # like in the RepoBrowserWdg
        tr.add_style("height: 200px")
        load_height_bvr = {
            'type':
            'load',
            'cbjs_action':
            '''
            var last_height = spt.container.get_value("last_img_height");
            if (last_height) {
                bvr.src_el.setStyle("height", last_height);
            } 
            '''
        }
        tr.add_behavior(load_height_bvr)

        unload_height_bvr = {
            'type':
            'unload',
            'cbjs_action':
            '''
            var last_height = bvr.src_el.getStyle("height");
            spt.container.set_value("last_img_height", last_height);
            '''
        }
        tr.add_behavior(unload_height_bvr)

        table.add_style("width: 100%")
        table.add_style("text-align", "center")

        from tactic.ui.widget import EmbedWdg
        td = table.add_cell()
        td.add_color(
            "background",
            "background",
        )
        td.add_style("vertical-align: middle")
        td.add_style("height: inherit")
        td.add_style("overflow-x: auto")

        if ext in ['txt', 'html', 'ini']:
            content_div = DivWdg()
            f = open(lib_path, 'r')
            content = f.read(10000)
            f.close()
            if not content:
                text = "No Content"
            else:

                size = os.path.getsize(lib_path)

                from pyasm.common import FormatValue
                value = FormatValue().get_format_value(size, "KB")

                content_div.add("Showing first 10K of %s<hr/>" % value)

                text = TextAreaWdg()
                text.add(content)
                text.add_style("width: 100%")
                text.add_style("height: 100%")
                text.add_style("padding: 10px")
                text.add_style("border: none")
                text.add_attr("readonly", "true")

            content_div.add(text)
            td.add(content_div)
            content_div.add_style("color", "#000")
            content_div.add_style("width", "auto")
            content_div.add_style("margin", "20px")
            content_div.add_style("height", "100%")

        elif ext in File.IMAGE_EXT or ext == "gif":
            if lib_path.find("#") != -1:
                img = DivWdg()

                file_range = snapshot.get_file_range()
                file_range_div = DivWdg()
                file_range_div.add("File Range: %s" % file_range.get_display())
                img.add(file_range_div)
                file_range_div.add_style("font-size: 1.4em")
                file_range_div.add_style("margin: 15px 0px")
                """
                left_chevron = IconWdg("Previous", "BS_CHEVRON_LEFT")
                file_range_div.add(left_chevron)
                right_chevron = IconWdg("Next", "BS_CHEVRON_RIGHT")
                file_range_div.add(right_chevron)
                """

                expanded_paths = snapshot.get_expanded_web_paths()
                lib_paths = snapshot.get_expanded_lib_paths()
                lib_path = lib_paths[0]

                items_div = DivWdg()
                img.add(items_div)
                items_div.add_style("width: auto")

                for path in expanded_paths:
                    item = HtmlElement.img(src=path)
                    items_div.add(item)
                    item.add_style("max-height: 300px")
                    item.add_style("height: auto")
                    item.add_style("width: 32%")
                    item.add_style("margin: 2px")
                    item.add_style("display: inline-block")
                    #item.add_class("spt_resizable")

                img.add_style("margin: 20px")
                img.add_style("max-height: 400px")
                img.add_style("overflow-y: auto")
                img.add_style("overflow-hidden: auto")
                img.add_style("text-align: left")

            else:
                if ext == "gif":
                    img = HtmlElement.img(src=src)
                else:
                    img = HtmlElement.img(src=web_src)
                img.add_style("height: inherit")
                img.add_style("width: auto")
            td.add(img)
        elif ext in File.VIDEO_EXT:
            embed_wdg = EmbedWdg(src=src,
                                 thumb_path=thumb_path,
                                 preload="auto",
                                 controls=True)
            td.add(embed_wdg)

            embed_wdg.add_style("margin: auto auto")
            embed_wdg.add_class("spt_resizable")

            embed_wdg.add_behavior(load_height_bvr)
            embed_wdg.add_behavior(unload_height_bvr)

        else:
            thumb_table = DivWdg()
            td.add(thumb_table)

            thumb_table.add_behavior({
                'type':
                'click_up',
                'src':
                src,
                'cbjs_action':
                '''
                window.open(bvr.src);
                '''
            })
            thumb_table.add_class("hand")
            thumb_table.add_style("width: 200px")
            thumb_table.add_style("height: 125px")
            thumb_table.add_style("padding: 5px")
            thumb_table.add_style("margin-left: 20px")
            thumb_table.add_style("display: inline-block")
            thumb_table.add_style("vertical-align: top")
            thumb_table.add_style("overflow-y: hidden")
            from tactic.ui.panel import ThumbWdg2
            thumb = ThumbWdg2()
            thumb_table.add(thumb)
            thumb.set_sobject(snapshot)

        table.add_row()
        td = table.add_cell()

        from tactic.ui.checkin import PathMetadataWdg
        from tactic.ui.checkin import SnapshotMetadataWdg

        from pyasm.widget import SelectWdg
        select = SelectWdg(name="parser")
        select.add_style("width: 125px")
        select.add_style("margin-top: 0px")
        select.add_style("margin-right: 10px")
        select.add_empty_option("-- Metadata --")
        td.add(select)
        select.add_style("float: right")
        select.set_option("values",
                          ["IPTC", "EXIF", "XMP", "ImageMagick", "PIL"])
        select.add_behavior({
            'type':
            'change',
            'cbjs_action':
            '''
            var parser = bvr.src_el.value;
            spt.panel.refresh_element(bvr.src_el, {parser: parser})
            '''
        })
        if parser:
            select.set_value(parser)

        title_div = DivWdg()
        td.add(title_div)
        title_div.add("<div style='font-size: 16px'>File Metadata</div>")
        title_div.add("<div>Metadata extracted directly from the file</div>")
        title_div.add("<hr/>")
        title_div.add_style("text-align: left")
        title_div.add_style("margin: 0px 10px")

        metadata_div = DivWdg()
        td.add(metadata_div)
        metadata_div.add_style("max-height: 400px")
        metadata_div.add_style("overflow-y: auto")
        metadata_div.add_style("overflow-x: hidden")
        metadata_div.add_style("margin: 20px 0px 20px 10px")
        metadata_div.add_style("text-align: left")

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

        server_src = lib_path

        # get it dynamically by path
        metadata_wdg = PathMetadataWdg(path=server_src,
                                       parser=parser,
                                       use_tactic_tags=use_tactic_tags,
                                       search_key=self.search_key)
        metadata_div.add(metadata_wdg)

        top.add("<br/>")

        return top