Example #1
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
Example #2
0
    def get_display(self):
        top = DivWdg()
        self.set_as_panel(top)

        top.add("Search Type: ")
        search_type_text = TextWdg("search_type")
        top.add(search_type_text)

        test_button = ProdIconButtonWdg("Test")
        top.add(test_button)
        test_button.add_behavior({
            'type':
            'click_up',
            'cbjs_action':
            '''
            var top = bvr.src_el.getParent(".spt_panel");
            var values = spt.api.get_input_values(top, null, false);
            var search_type = values['search_type'][0];
            cmd = 'tactic.command.NamingMigratorCmd';
            server = TacticServerStub.get();
            server.execute_cmd(cmd, values)
            '''
        })

        return top
Example #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
Example #4
0
    def get_display(my):
        top = DivWdg()
        my.set_as_panel(top)

        top.add("Search Type: ")
        search_type_text = TextWdg("search_type")
        top.add(search_type_text)

        test_button = ProdIconButtonWdg("Test")
        top.add(test_button)
        test_button.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            var top = bvr.src_el.getParent(".spt_panel");
            var values = spt.api.get_input_values(top, null, false);
            var search_type = values['search_type'][0];
            cmd = 'tactic.command.NamingMigratorCmd';
            server = TacticServerStub.get();
            server.execute_cmd(cmd, values)
            '''
        } )

        return top
Example #5
0
    def get_display(my):
        top = DivWdg()
        top.add_class("spt_top")

        dialog = DialogWdg()
        dialog_id = dialog.get_id()

        # create the button
        button = DivWdg()
        button.add_style("padding: 5px")
        button.add_style("width: 30px")
        button.add_style("text-align: center")
        button.add_style("float: left")
        button.add_gradient("background", "background")
        button.add_border()
        top.add(button)
        icon = IconWdg("Press Me", IconWdg.ZOOM)
        icon.add_style("float: left")
        button.add(icon)
        icon = IconWdg("Press Me", IconWdg.INFO_OPEN_SMALL)
        icon.add_style("margin-left: -9px")
        button.add(icon)
        button.add_behavior({
            'type':
            'click_up',
            'dialog_id':
            dialog_id,
            'cbjs_action':
            '''
        var pos = bvr.src_el.getPosition();
        var el = $(bvr.dialog_id);
        el.setStyle("left", pos.x+1);
        el.setStyle("top", pos.y+32);
        el.setStyle("display", "");
        '''
        })

        # defined the dialog
        top.add(dialog)
        dialog.add_title("Search Limit")

        table = Table()
        table.add_color("color", "color2")
        dialog.add(table)
        table.add_row()
        td = table.add_cell()
        td.add("Search Limit: ")

        td = table.add_cell()
        select = SelectWdg("search_limit")
        select.set_option("values", "5|10|20|50|100|200|Custom")
        td.add(select)

        save_button = ProdIconButtonWdg("Save")
        td.add(save_button)
        cancel_script = dialog.get_cancel_script()
        save_button.add_behavior({
            'type':
            'click_up',
            'cbjs_action':
            '''
        var dialog_top = bvr.src_el.getParent(".spt_dialog_top");
        var values = spt.api.get_input_values(dialog_top);

        var top = spt.get_parent(bvr.src_el, ".spt_top");
        var input = top.getElement(".spt_search_limit");
        input.value = values.search_limit;
        %s
        ''' % cancel_script
        })

        text = TextWdg("search_limit")
        text.add_class("spt_search_limit")
        top.add(text)

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

        my.search_type = my.kwargs.get('search_type')
        my.element_name = my.kwargs.get('element_name')
        assert my.search_type
        assert my.element_name

        class_name = 'tactic.ui.app.aggregate_wdg.AggregateCmd'
        interval = 120
        priority = None

        if my.kwargs.get('is_refresh'):
            user = Environment.get_user_name()

            # these interval jobs need to have a specific code
            code = "aggregate|%s|%s" % (my.search_type, my.element_name)

            # check to see if the job exists
            #job = Search.get_by_code("sthpw/queue", code)
            job = None
            if not job:
                job = SearchType.create("sthpw/queue")
                #job.set_value("code", code)

                job.set_value("project_code", Project.get_project_code() )
                job.set_value("class_name", class_name)
                job.set_value("command", class_name)
                job.set_value("serialized", str(my.kwargs) )
                job.set_value("interval", 120)
                job.set_value("state", 'pending')
                job.set_value("queue", 'interval')
                job.set_value("priority", 9999)
                job.set_value("login", user) 
                job.commit()




        my.view = my.kwargs.get('view')
        if not my.view:
            my.view = 'definition'

        
        top = DivWdg()
        my.set_as_panel(top)

        action_div = DivWdg()
        top.add(action_div)

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



        register_div = DivWdg()
        register_div.add_class("spt_queue_register")
        top.add(register_div)
        register_div.add_style("border: solid 1px black")
        register_div.add_style("padding: 20px")
        register_div.add("Register new interval aggregate")

        table = Table()
        table.add_style("margin: 15px")
        register_div.add(table)
        table.add_row()
        table.add_cell("command: ")
        table.add_cell(class_name)

        #table.add_row()
        #table.add_cell("priority: ")
        #table.add_cell(priority)

        table.add_row()
        table.add_cell("interval: ")
        td = table.add_cell("every ")
        td.set_attr("title", "Recalculation interval")
        text = TextWdg("interval")
        text.add_style("width: 30px")
        text.set_value(interval)
        td.add(text)

        unit_select = SelectWdg("unit")
        unit_select.set_value(interval)
        unit_select.set_option("values", "seconds|minutes|hours|days")
        td.add(" ")
        td.add(unit_select)

        table.add_row()
        table.add_cell("queue: ")
        table.add_cell("interval")


        from pyasm.widget import ProdIconButtonWdg
        button = ProdIconButtonWdg("Register")
        button.add_behavior( {
        'type': 'click_up',
        'cbjs_action': '''
        var top = bvr.src_el.getParent(".spt_queue_register")
        var values = spt.api.get_input_values(top);
        var top = bvr.src_el.getParent(".spt_panel");
        spt.panel.refresh(top);
        '''
        } )
        register_div.add(button)


        from pyasm.widget import ProdIconButtonWdg
        button = ProdIconButtonWdg("Cancel")
        button.add_behavior( {
        'type': 'click_up',
        'cbjs_action': '''
        alert('cancel');
        '''
        } )
        register_div.add(button)


        '''
        cmd = AggregateCmd(**my.kwargs)

        print "registering scheduled task"
        scheduler = Scheduler.get()
        scheduler.start_thread()
        task = AggregateRefreshTask(name="cow", command=cmd)
        scheduler.add_interval_task(task, 10, mode='forked')
        scheduler.cancel_task("cow", delay=35)
        '''


        top.add("<br/>")
        top.add("<b>Current Job Queue</b>")
        top.add("<br/><br/>")
        from tactic.ui.panel import TableLayoutWdg
        table = TableLayoutWdg(search_type='sthpw/queue',view='test')
        top.add(table)

        return top
Example #7
0
    def get_display(my):
        top = DivWdg()
        top.add_class("spt_top")

        dialog = DialogWdg()
        dialog_id = dialog.get_id()

        # create the button
        button = DivWdg()
        button.add_style("padding: 5px")
        button.add_style("width: 30px")
        button.add_style("text-align: center")
        button.add_style("float: left")
        button.add_gradient("background", "background")
        button.add_border()
        top.add(button)
        icon = IconWdg("Press Me", IconWdg.ZOOM)
        icon.add_style("float: left")
        button.add(icon)
        icon = IconWdg("Press Me", IconWdg.INFO_OPEN_SMALL)
        icon.add_style("margin-left: -9px")
        button.add(icon)
        button.add_behavior( {
        'type': 'click_up',
        'dialog_id': dialog_id,
        'cbjs_action': '''
        var pos = bvr.src_el.getPosition();
        var el = $(bvr.dialog_id);
        el.setStyle("left", pos.x+1);
        el.setStyle("top", pos.y+32);
        el.setStyle("display", "");
        '''
        } )

        # defined the dialog
        top.add(dialog)
        dialog.add_title("Search Limit")

        table = Table()
        table.add_color("color", "color2")
        dialog.add(table)
        table.add_row()
        td = table.add_cell()
        td.add("Search Limit: ")

        td = table.add_cell()
        select = SelectWdg("search_limit")
        select.set_option("values", "5|10|20|50|100|200|Custom")
        td.add(select)

        save_button = ProdIconButtonWdg("Save")
        td.add(save_button)
        cancel_script = dialog.get_cancel_script();
        save_button.add_behavior( {
        'type': 'click_up',
        'cbjs_action': '''
        var dialog_top = bvr.src_el.getParent(".spt_dialog_top");
        var values = spt.api.get_input_values(dialog_top);

        var top = spt.get_parent(bvr.src_el, ".spt_top");
        var input = top.getElement(".spt_search_limit");
        input.value = values.search_limit;
        %s
        ''' % cancel_script
        } )


        text = TextWdg("search_limit")
        text.add_class("spt_search_limit")
        top.add(text)

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

        web = WebContainer.get_web()
        naming_util = NamingUtil()

        if not my.widget_name:
            my.widget_name = my.get_name()

        # get the sobject required by this input
        sobject = my.get_current_sobject()
        if not sobject:
            sobject = Search.get_by_id(my.search_type, my.search_id)

        if my.new_sample_name:
            my.new_sample_name.replace("//", "/")
        else:
            my.new_sample_name = sobject.get_value(my.widget_name)

        widget = DivWdg()
        widget.set_id("naming")
        widget.add_style("display: block")

        # set the sample text
        div = DivWdg()
        div.add("Sample name: <i>%s</i>" % my.new_sample_name)
        div.add(HtmlElement.br(2))

        new_sample_wdg = ProdIconButtonWdg("Set New Sample")
        new_sample_wdg.add_event("onclick", "toggle_display('generate')")
        div.add(new_sample_wdg)

        generate = DivWdg()
        generate.add(HtmlElement.br())
        generate.set_id("generate")
        generate.add_style("display: none")
        sample_text = TextWdg("new_sample_name")
        sample_text.set_option("size", "30")
        # sample_text.set_persist_on_submit()
        # if my.new_sample_name:
        #    sample_text.set_value(my.new_sample_name)
        generate.add(sample_text)

        button = IconButtonWdg("Generate", IconWdg.REFRESH, long=True)
        on_script = my.setup_ajax("naming")
        button.add_event("onclick", on_script)
        generate.add(button)
        generate.add(HtmlElement.br(2))

        div.add(generate)
        widget.add(div)

        hidden = TextWdg(my.widget_name)
        value = my.naming
        hidden.set_value(my.new_sample_name)
        widget.add(my.widget_name)
        widget.add(hidden)

        # get all of the parts

        # TODO: not sure if this should be dictated by the sample name
        # break up the name into parts
        import re

        if my.new_sample_name:
            tmp = my.new_sample_name.strip("/")
            parts = re.split("[\\/._]", tmp)
            print "parts: ", parts
        else:
            return widget

        # if there is a naming, then populate that
        if my.edit_search_type:
            options = naming_util.get_options(my.edit_search_type)
        else:
            options = naming_util.get_options(sobject.get_value("search_type"))

        table = Table()
        type_values = []
        padding_values = []
        for idx, part in enumerate(parts):
            table.add_row()
            table.add_cell(part)

            type_select = SelectWdg("type_%s" % idx)
            type_select.add_empty_option("-- Explicit --")
            type_select.set_persist_on_submit()
            type_select.set_option("values", "|".join(options))
            type_values.append(type_select.get_value())
            td = table.add_cell(type_select)

        widget.add(table)

        return widget
Example #9
0
    def get_display(self):

        web = WebContainer.get_web()
        naming_util = NamingUtil()

        if not self.widget_name:
            self.widget_name = self.get_name()

        # get the sobject required by this input
        sobject = self.get_current_sobject()
        if not sobject:
            sobject = Search.get_by_id(self.search_type, self.search_id)

        if self.new_sample_name:
            self.new_sample_name.replace("//", "/")
        else:
            self.new_sample_name = sobject.get_value(self.widget_name)

        widget = DivWdg()
        widget.set_id("naming")
        widget.add_style("display: block")

        # set the sample text
        div = DivWdg()
        div.add("Sample name: <i>%s</i>" % self.new_sample_name)
        div.add(HtmlElement.br(2))

        new_sample_wdg = ProdIconButtonWdg("Set New Sample")
        new_sample_wdg.add_event("onclick", "toggle_display('generate')")
        div.add(new_sample_wdg)

        generate = DivWdg()
        generate.add(HtmlElement.br())
        generate.set_id("generate")
        generate.add_style("display: none")
        sample_text = TextWdg("new_sample_name")
        sample_text.set_option("size", "30")
        #sample_text.set_persist_on_submit()
        #if self.new_sample_name:
        #    sample_text.set_value(self.new_sample_name)
        generate.add(sample_text)

        button = IconButtonWdg("Generate", IconWdg.REFRESH, long=True)
        on_script = self.setup_ajax("naming")
        button.add_event("onclick", on_script)
        generate.add(button)
        generate.add(HtmlElement.br(2))

        div.add(generate)
        widget.add(div)

        hidden = TextWdg(self.widget_name)
        value = self.naming
        hidden.set_value(self.new_sample_name)
        widget.add(self.widget_name)
        widget.add(hidden)

        # get all of the parts

        # TODO: not sure if this should be dictated by the sample name
        # break up the name into parts
        import re
        if self.new_sample_name:
            tmp = self.new_sample_name.strip("/")
            parts = re.split('[\\/._]', tmp)
            print "parts: ", parts
        else:
            return widget

        # if there is a naming, then populate that
        if self.edit_search_type:
            options = naming_util.get_options(self.edit_search_type)
        else:
            options = naming_util.get_options(sobject.get_value("search_type"))

        table = Table()
        type_values = []
        padding_values = []
        for idx, part in enumerate(parts):
            table.add_row()
            table.add_cell(part)

            type_select = SelectWdg("type_%s" % idx)
            type_select.add_empty_option("-- Explicit --")
            type_select.set_persist_on_submit()
            type_select.set_option("values", "|".join(options))
            type_values.append(type_select.get_value())
            td = table.add_cell(type_select)

        widget.add(table)

        return widget
Example #10
0
    def get_display(self):

        self.search_type = self.kwargs.get('search_type')
        self.element_name = self.kwargs.get('element_name')
        assert self.search_type
        assert self.element_name

        class_name = 'tactic.ui.app.aggregate_wdg.AggregateCmd'
        interval = 120
        priority = None

        if self.kwargs.get('is_refresh'):
            user = Environment.get_user_name()

            # these interval jobs need to have a specific code
            code = "aggregate|%s|%s" % (self.search_type, self.element_name)

            # check to see if the job exists
            #job = Search.get_by_code("sthpw/queue", code)
            job = None
            if not job:
                job = SearchType.create("sthpw/queue")
                #job.set_value("code", code)

                job.set_value("project_code", Project.get_project_code())
                job.set_value("class_name", class_name)
                job.set_value("command", class_name)
                job.set_value("serialized", str(self.kwargs))
                job.set_value("interval", 120)
                job.set_value("state", 'pending')
                job.set_value("queue", 'interval')
                job.set_value("priority", 9999)
                job.set_value("login", user)
                job.commit()

        self.view = self.kwargs.get('view')
        if not self.view:
            self.view = 'definition'

        top = DivWdg()
        self.set_as_panel(top)

        action_div = DivWdg()
        top.add(action_div)

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

        register_div = DivWdg()
        register_div.add_class("spt_queue_register")
        top.add(register_div)
        register_div.add_style("border: solid 1px black")
        register_div.add_style("padding: 20px")
        register_div.add("Register new interval aggregate")

        table = Table()
        table.add_style("margin: 15px")
        register_div.add(table)
        table.add_row()
        table.add_cell("command: ")
        table.add_cell(class_name)

        #table.add_row()
        #table.add_cell("priority: ")
        #table.add_cell(priority)

        table.add_row()
        table.add_cell("interval: ")
        td = table.add_cell("every ")
        td.set_attr("title", "Recalculation interval")
        text = TextWdg("interval")
        text.add_style("width: 30px")
        text.set_value(interval)
        td.add(text)

        unit_select = SelectWdg("unit")
        unit_select.set_value(interval)
        unit_select.set_option("values", "seconds|minutes|hours|days")
        td.add(" ")
        td.add(unit_select)

        table.add_row()
        table.add_cell("queue: ")
        table.add_cell("interval")

        from pyasm.widget import ProdIconButtonWdg
        button = ProdIconButtonWdg("Register")
        button.add_behavior({
            'type':
            'click_up',
            'cbjs_action':
            '''
        var top = bvr.src_el.getParent(".spt_queue_register")
        var values = spt.api.get_input_values(top);
        var top = bvr.src_el.getParent(".spt_panel");
        spt.panel.refresh(top);
        '''
        })
        register_div.add(button)

        from pyasm.widget import ProdIconButtonWdg
        button = ProdIconButtonWdg("Cancel")
        button.add_behavior({
            'type':
            'click_up',
            'cbjs_action':
            '''
        alert('cancel');
        '''
        })
        register_div.add(button)
        '''
        cmd = AggregateCmd(**self.kwargs)

        print "registering scheduled task"
        scheduler = Scheduler.get()
        scheduler.start_thread()
        task = AggregateRefreshTask(name="cow", command=cmd)
        scheduler.add_interval_task(task, 10, mode='forked')
        scheduler.cancel_task("cow", delay=35)
        '''

        top.add("<br/>")
        top.add("<b>Current Job Queue</b>")
        top.add("<br/><br/>")
        from tactic.ui.panel import TableLayoutWdg
        table = TableLayoutWdg(search_type='sthpw/queue', view='test')
        top.add(table)

        return top
Example #11
0
    def get_bottom_wdg(my):
        if my.get_option('mode') =='input':
            return 
        web = WebContainer.get_web()
        if web.get_selected_app() not in ['XSI','Maya']:
            return
        div = DivWdg(css='spt_outdated_ref')
       

        refs = my.session.get_data().get_nodes("session/node/ref")
        snap_codes = []
        snap_contexts = []
        sobjects = []
        session_data_dict = {}
        asset_codes = []
        current_snapshots = []
        node_names = []
        session_versions = []
        for ref in refs:
            snap_code = Xml.get_attribute(ref, "asset_snapshot_code")
            node_name = Xml.get_attribute(ref, "name")
            version = Xml.get_attribute(ref, "asset_snapshot_version")
            asset_code = Xml.get_attribute(ref, "asset_code")
            if snap_code in snap_codes:
                continue
            snap_codes.append(snap_code)
            snap_contexts.append(Xml.get_attribute(ref, "asset_snapshot_context"))
            asset_codes.append(asset_code)
            session_data_dict[snap_code] = version, node_name  
        
        
        # must search one by one
        warnings=[]
        for idx, snap_code in enumerate(snap_codes):
            snapshot = Snapshot.get_by_code(snap_code)
            if not snapshot:
                continue
            search_type = snapshot.get_value('search_type')
            search_id = snapshot.get_value('search_id')
            sk = SearchKey.build_search_key(search_type, search_id, column='id')
            current_snapshot = Snapshot.get_snapshot(search_type, search_id, context=snap_contexts[idx], version=0)
            if not current_snapshot:
                warnings.append("Current version for [%s] context [%s] not found" %(sk, snap_contexts[idx]))
                continue
            session_version, node_name  = session_data_dict.get(snap_code)
            if session_version and int(current_snapshot.get_version()) > int(session_version):
                current_snapshots.append(current_snapshot)
                sobjects.append(current_snapshot.get_sobject())
                node_names.append(node_name)
                session_versions.append(int(session_version))
        

        title = DivWdg('Outdated References')
        title.add_style('text-decoration','underline')
        div.add(title)

        # draw the nodes to be udpated
        for idx, current_snap in enumerate(current_snapshots):
            
            cb = CheckboxWdg(my.REF_CB_NAME)
            cb.add_class('spt_ref')
            cb.add_style('display: none')
            sobj = sobjects[idx]
            node_name = node_names[idx]
            session_version = session_versions[idx]
            snapshot = current_snap
            cb_value = my.get_input_value(sobj, snapshot)
            items = cb_value.split('|')
            items[-1] = node_name
            cb_value = '|'.join(items)
            cb.set_option('value', cb_value)
            div.add(cb)
            div.add('%0.1d. %s v%0.3d -> v%0.3d\n' \
                %(idx+1, node_name, session_version, snapshot.get_version()))
            div.add(HtmlElement.br())

        for warning in warnings:
            div.add(SpanWdg(warning, css='warning'))
        div.add(HtmlElement.br())

        if current_snapshots:
            # add the button
            prefix = my.search_type
            #input_name = '%s_%s' %(my.search_type, my.CB_NAME)
            update_button = ProdIconButtonWdg("Update all references")
            update_button.add_behavior({'type': "click_up",\
            'cbjs_action': '''var cousins = bvr.src_el.getParent('.spt_outdated_ref').getElements('.spt_ref');
                             cousins.each( function(x) {x.checked=true;}); py_replace_reference(bvr, '%s','%s')'''
                    % (prefix, my.REF_CB_NAME)})
            div.add( SpanWdg(update_button, css='small'))
       
        div.add(HtmlElement.br(2))
        return div
Example #12
0
    def get_bottom_wdg(my):
        if my.get_option('mode') == 'input':
            return
        web = WebContainer.get_web()
        if web.get_selected_app() not in ['XSI', 'Maya']:
            return
        div = DivWdg(css='spt_outdated_ref')

        refs = my.session.get_data().get_nodes("session/node/ref")
        snap_codes = []
        snap_contexts = []
        sobjects = []
        session_data_dict = {}
        asset_codes = []
        current_snapshots = []
        node_names = []
        session_versions = []
        for ref in refs:
            snap_code = Xml.get_attribute(ref, "asset_snapshot_code")
            node_name = Xml.get_attribute(ref, "name")
            version = Xml.get_attribute(ref, "asset_snapshot_version")
            asset_code = Xml.get_attribute(ref, "asset_code")
            if snap_code in snap_codes:
                continue
            snap_codes.append(snap_code)
            snap_contexts.append(
                Xml.get_attribute(ref, "asset_snapshot_context"))
            asset_codes.append(asset_code)
            session_data_dict[snap_code] = version, node_name

        # must search one by one
        warnings = []
        for idx, snap_code in enumerate(snap_codes):
            snapshot = Snapshot.get_by_code(snap_code)
            if not snapshot:
                continue
            search_type = snapshot.get_value('search_type')
            search_id = snapshot.get_value('search_id')
            sk = SearchKey.build_search_key(search_type,
                                            search_id,
                                            column='id')
            current_snapshot = Snapshot.get_snapshot(
                search_type, search_id, context=snap_contexts[idx], version=0)
            if not current_snapshot:
                warnings.append(
                    "Current version for [%s] context [%s] not found" %
                    (sk, snap_contexts[idx]))
                continue
            session_version, node_name = session_data_dict.get(snap_code)
            if session_version and int(
                    current_snapshot.get_version()) > int(session_version):
                current_snapshots.append(current_snapshot)
                sobjects.append(current_snapshot.get_sobject())
                node_names.append(node_name)
                session_versions.append(int(session_version))

        title = DivWdg('Outdated References')
        title.add_style('text-decoration', 'underline')
        div.add(title)

        # draw the nodes to be udpated
        for idx, current_snap in enumerate(current_snapshots):

            cb = CheckboxWdg(my.REF_CB_NAME)
            cb.add_class('spt_ref')
            cb.add_style('display: none')
            sobj = sobjects[idx]
            node_name = node_names[idx]
            session_version = session_versions[idx]
            snapshot = current_snap
            cb_value = my.get_input_value(sobj, snapshot)
            items = cb_value.split('|')
            items[-1] = node_name
            cb_value = '|'.join(items)
            cb.set_option('value', cb_value)
            div.add(cb)
            div.add('%0.1d. %s v%0.3d -> v%0.3d\n' \
                %(idx+1, node_name, session_version, snapshot.get_version()))
            div.add(HtmlElement.br())

        for warning in warnings:
            div.add(SpanWdg(warning, css='warning'))
        div.add(HtmlElement.br())

        if current_snapshots:
            # add the button
            prefix = my.search_type
            #input_name = '%s_%s' %(my.search_type, my.CB_NAME)
            update_button = ProdIconButtonWdg("Update all references")
            update_button.add_behavior({'type': "click_up",\
            'cbjs_action': '''var cousins = bvr.src_el.getParent('.spt_outdated_ref').getElements('.spt_ref');
                             cousins.each( function(x) {x.checked=true;}); py_replace_reference(bvr, '%s','%s')'''
                    % (prefix, my.REF_CB_NAME)})
            div.add(SpanWdg(update_button, css='small'))

        div.add(HtmlElement.br(2))
        return div