Пример #1
0
    def get_display(my):

        top = my.top
        my.set_as_panel(top)

        title_wdg = DivWdg()
        top.add(title_wdg)
        title_wdg.add("Local")
        title_wdg.add_style("padding: 10px")
        title_wdg.add_color("background", "background", -10)
        title_wdg.add_border()
        title_wdg.add_style("margin: -6px -6px 10px -6px")
        title_wdg.add_style("font-weight: bold")

        from tactic.ui.container import TabWdg
        tab = TabWdg(selected="Info", show_add=False)
        top.add(tab)
        tab.add(my.get_info_wdg())

        return top
Пример #2
0
    def get_display(my):

        top = my.top
        my.set_as_panel(top)

        title_wdg = DivWdg()
        top.add(title_wdg)
        title_wdg.add("Local")
        title_wdg.add_style("padding: 10px")
        title_wdg.add_color("background", "background", -10)
        title_wdg.add_border()
        title_wdg.add_style("margin: -6px -6px 10px -6px")
        title_wdg.add_style("font-weight: bold")

        from tactic.ui.container import TabWdg

        tab = TabWdg(selected="Info", show_add=False)
        top.add(tab)
        tab.add(my.get_info_wdg())

        return top
Пример #3
0
    def get_display(my):

        my.search_type = None

        my.view = 'tab'
        config_xml = my.get_config_xml()
        config = WidgetConfig.get(view=my.view, xml=config_xml)

        top = DivWdg()
        #tab = TabWdg(width=1000, save_state="admin_tab_state")
        tab = TabWdg(config=config, view=my.view, width=1000)
        top.add(tab)
        for widget in my.widgets:
            tab.add(widget)


        # set the current one active
        div = DivWdg()
        div.add_style("display: hidden")
        div.add_behavior( {
        'type': 'load',
        'cbjs_action': '''
        spt.tab.set_main_body_top();
        var headers = spt.tab.get_headers();
        // if there are no headers, then there was an error
        if (headers.length == 0) {
            return;
        }

        var name = headers[headers.length-1].getAttribute("spt_element_name");
        spt.tab.select(name);
        '''
        } )

        top.add(div)



        return top
Пример #4
0
    def get_display(self):

        self.search_type = None

        self.view = 'tab'
        config_xml = self.get_config_xml()
        config = WidgetConfig.get(view=self.view, xml=config_xml)

        top = DivWdg()
        #tab = TabWdg(width=1000, save_state="admin_tab_state")
        tab = TabWdg(config=config, view=self.view, width=1000)
        top.add(tab)
        for widget in self.widgets:
            tab.add(widget)

        # set the current one active
        div = DivWdg()
        div.add_style("display: hidden")
        div.add_behavior({
            'type':
            'load',
            'cbjs_action':
            '''
        spt.tab.set_main_body_top();
        var headers = spt.tab.get_headers();
        // if there are no headers, then there was an error
        if (headers.length == 0) {
            return;
        }

        var name = headers[headers.length-1].getAttribute("spt_element_name");
        spt.tab.select(name);
        '''
        })

        top.add(div)

        return top
Пример #5
0
    def get_display(my):

        top = my.top
        my.set_as_panel(top)
        top.add_class("spt_share_item")

        my.server_code = my.kwargs.get("server_code")
        if not my.server_code:
            top.add("No server selected")
            return top



        my.server = Search.get_by_code("sthpw/sync_server", my.server_code)
        my.base_dir = my.server.get_value("base_dir")


        title_wdg = DivWdg()
        top.add( title_wdg )
        title_wdg.add( my.server_code )
        title_wdg.add_style("padding: 10px")
        title_wdg.add_color("background", "background", -10)
        title_wdg.add_border()
        title_wdg.add_style("margin: -6px -6px 10px -6px")
        title_wdg.add_style("font-weight: bold")

        description = my.server.get_value("description")
        title_wdg.add(" &nbsp; <i style='font-size: 9px; opacity: 0.5'>( %s )</i>" % description )




        from tactic.ui.container import TabWdg
        tab = TabWdg(selected="Info", show_add=False)
        top.add(tab)
        tab.add(my.get_info_wdg())
        tab.add(my.get_files_wdg())

        tab.add( my.get_tools_wdg() )

        return top
Пример #6
0
    def get_display(self):

        top = self.top
        self.set_as_panel(top)
        top.add_class("spt_share_item")

        self.server_code = self.kwargs.get("server_code")
        if not self.server_code:
            top.add("No server selected")
            return top



        self.server = Search.get_by_code("sthpw/sync_server", self.server_code)
        self.base_dir = self.server.get_value("base_dir")


        title_wdg = DivWdg()
        top.add( title_wdg )
        title_wdg.add( self.server_code )
        title_wdg.add_style("padding: 10px")
        title_wdg.add_color("background", "background", -10)
        title_wdg.add_border()
        title_wdg.add_style("margin: -6px -6px 10px -6px")
        title_wdg.add_style("font-weight: bold")

        description = self.server.get_value("description")
        title_wdg.add(" &nbsp; <i style='font-size: 9px; opacity: 0.5'>( %s )</i>" % description )




        from tactic.ui.container import TabWdg
        tab = TabWdg(selected="Info", show_add=False)
        top.add(tab)
        tab.add(self.get_info_wdg())
        tab.add(self.get_files_wdg())

        tab.add( self.get_tools_wdg() )

        return top
Пример #7
0
    def get_display(self):

        top = self.top;
        self.set_as_panel(top)
        top.add_class("spt_chat_top")


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



        search = Search("sthpw/subscription")
        search.add_filter("category", "chat")
        search.add_user_filter()
        chats = search.get_sobjects()
        keys = [x.get_value("message_code") for x in chats]


        """
        chat_list_div = DivWdg()
        inner.add(chat_list_div)
        for i, chat in enumerate(chats):
            chat_div = DivWdg()
            chat_list_div.add(chat_div)
            chat_div.add_style("padding: 5px")
            chat_div.add_class("hand")

            # find all the users with the same chat
            key = chat.get_value("message_code")
            #chat_div.add(key)
            chat_div.add("#%s: " % i)

            search = Search("sthpw/subscription")
            search.add_filter("message_code", key)
            subscriptions = search.get_sobjects()
            users = [x.get_value("login") for x in subscriptions]
            chat_div.add(", ".join(users))

            chat_div.add_behavior( {
                'type': 'click_up',
                'key': key,
                'cbjs_action': '''
                var class_name = 'tactic.ui.app.ChatSessionWdg';
                var kwargs = {
                    'key': bvr.key,
                }
                spt.panel.load_popup("Chat: " + bvr.key, class_name, kwargs);

                '''
            } )

            chat_div.add_behavior( {
                'type': 'mouseover',
                'cbjs_action': '''
                bvr.src_el.setStyle("color", "#214e75");
                '''
            } )


            chat_div.add_behavior( {
                'type': 'mouseout',
                'cbjs_action': '''
                bvr.src_el.setStyle("color", "");
                '''
            } )
        """



        #keys = self.kwargs.get("keys")
        #if not keys:
        #    return

        inner.add( self.get_add_chat_wdg() )


        inner.add("<br/>")
        

        from tactic.ui.container import TabWdg
        tab = TabWdg(
                show_add=False,
                show_remove=False
        )
        inner.add(tab)

        for key in keys:
            search = Search("sthpw/subscription")
            search.add_filter("message_code", key)
            subscriptions = search.get_sobjects()
            users = [x.get_value("login") for x in subscriptions]
            users = ", ".join(users)

            session_div = DivWdg()
            session_div.set_name(users)
            session_div.add_style("width: 100%")
            #inner.add(session_div)
            tab.add(session_div)

            session = ChatSessionWdg(key=key)
            session_div.add(session)

        inner.add("<br clear='all'/>")

        if self.kwargs.get("is_refresh") == 'true':
            return inner
        else:
            return top
Пример #8
0
    def get_display(my):

        top = my.top;
        my.set_as_panel(top)
        top.add_class("spt_chat_top")


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



        search = Search("sthpw/subscription")
        search.add_filter("category", "chat")
        search.add_user_filter()
        chats = search.get_sobjects()
        keys = [x.get_value("message_code") for x in chats]


        """
        chat_list_div = DivWdg()
        inner.add(chat_list_div)
        for i, chat in enumerate(chats):
            chat_div = DivWdg()
            chat_list_div.add(chat_div)
            chat_div.add_style("padding: 5px")
            chat_div.add_class("hand")

            # find all the users with the same chat
            key = chat.get_value("message_code")
            #chat_div.add(key)
            chat_div.add("#%s: " % i)

            search = Search("sthpw/subscription")
            search.add_filter("message_code", key)
            subscriptions = search.get_sobjects()
            users = [x.get_value("login") for x in subscriptions]
            chat_div.add(", ".join(users))

            chat_div.add_behavior( {
                'type': 'click_up',
                'key': key,
                'cbjs_action': '''
                var class_name = 'tactic.ui.app.ChatSessionWdg';
                var kwargs = {
                    'key': bvr.key,
                }
                spt.panel.load_popup("Chat: " + bvr.key, class_name, kwargs);

                '''
            } )

            chat_div.add_behavior( {
                'type': 'mouseover',
                'cbjs_action': '''
                bvr.src_el.setStyle("color", "#214e75");
                '''
            } )


            chat_div.add_behavior( {
                'type': 'mouseout',
                'cbjs_action': '''
                bvr.src_el.setStyle("color", "");
                '''
            } )
        """



        #keys = my.kwargs.get("keys")
        #if not keys:
        #    return

        inner.add( my.get_add_chat_wdg() )


        inner.add("<br/>")
        

        from tactic.ui.container import TabWdg
        tab = TabWdg(
                show_add=False,
                show_remove=False
        )
        inner.add(tab)

        for key in keys:
            search = Search("sthpw/subscription")
            search.add_filter("message_code", key)
            subscriptions = search.get_sobjects()
            users = [x.get_value("login") for x in subscriptions]
            users = ", ".join(users)

            session_div = DivWdg()
            session_div.set_name(users)
            session_div.add_style("width: 100%")
            #inner.add(session_div)
            tab.add(session_div)

            session = ChatSessionWdg(key=key)
            session_div.add(session)

        inner.add("<br clear='all'/>")

        if my.kwargs.get("is_refresh") == 'true':
            return inner
        else:
            return top