Example #1
0
 def get_snapshot(my, node_name, snapshot_type="asset"):
     ''' use this only if the info is not already in the
         session_contents table'''
     snapshot_code = my.get_snapshot_code(node_name, snapshot_type)
     if snapshot_code == "":
         return None
     return Snapshot.get_by_code(snapshot_code)
Example #2
0
 def get_snapshot(my, node_name, snapshot_type="asset"):
     ''' use this only if the info is not already in the
         session_contents table'''
     snapshot_code = my.get_snapshot_code(node_name, snapshot_type)
     if snapshot_code == "":
         return None
     return Snapshot.get_by_code(snapshot_code)
Example #3
0
 def add_ref_by_snapshot_code(my, snapshot_code, instance_name=None, parent=None, type='ref', node_name='', tag='main'):
     snapshot = Snapshot.get_by_code(snapshot_code)
     if not snapshot:
         Environment.add_warning("Reference not found", "Found reference to snapshot [%s] which no longer exists in the Tactic database" % snapshot_code)
         return
         
     return my.add_ref_by_snapshot(snapshot, instance_name, parent, type, node_name, tag=tag)
Example #4
0
    def get_loader_xml(my, ticket, project_code, snapshot_code, context="", options=""):
        '''uses the loader to generate an execute xml that can be
        used to load the assets'''
        try:
            my.init(ticket)
            Project.set_project(project_code)

            snapshot = Snapshot.get_by_code(snapshot_code)

            # get the loader implementation
            loader_context = ProdLoaderContext()
            loader_context.set_context(context)

            # pass on any message options for the loader
            if options != "":
                loader_context.set_options(options)

            loader = loader_context.get_loader(snapshot)
            loader.execute()

            execute_xml = loader.get_execute_xml()
            xml = execute_xml.get_xml()

        finally:
            DbContainer.close_all()
        
        return xml
Example #5
0
    def execute(my):
        database = "sthpw" 

        sql = DbContainer.get(database)
        value_array = sql.do_query("select code, cc from (select code, count(code) as cc from file group by code order by cc desc) as X where cc > 1;")
        #value_array = sql.do_query("select code, cc from (select code, count(code) as cc from file group by code order by cc desc) as X;")

        print "found [%s] pairs" % len(value_array)

        for count, value_list in enumerate(value_array):
            if count >= BATCH:
                break

            # get the file object
            file_code = value_list[0]
            search = Search("sthpw/file")
            search.add_filter("code", file_code)
            files = search.get_sobjects()

            #if len(files) == 1:
            #    continue

            for file in files:
                project_code = file.get_value("project_code")
                if not project_code:
                    print "WARNING: file [%s] has no project_code" % file_code
                    continue

                project = Project.get_by_code(project_code)
                initials = project.get_initials()

                id = file.get_id()
                new_file_code = "%s%s" % (id, initials)
                if file_code == new_file_code:
                    continue

                print "-"*20
                print "switching: ", file_code, "to", new_file_code


                snapshot_code = file.get_value("snapshot_code")
                snapshot = Snapshot.get_by_code(snapshot_code)
                assert snapshot

                snapshot_xml = snapshot.get_xml_value("snapshot")
                print snapshot_xml.to_string()
                node = snapshot_xml.get_node("snapshot/file[@file_code='%s']" % file_code)
                Xml.set_attribute(node, "file_code", new_file_code)
                print snapshot_xml.to_string()

                assert node


                # set the file_code
                file.set_value("code", new_file_code)
                file.commit()

                # set the snapshot
                snapshot.set_value("snapshot", snapshot_xml.to_string() )
                snapshot.commit()
Example #6
0
    def init_cgi(my):
        web = WebContainer.get_web()
        snapshot_code = web.get_form_value("snapshot_code")
        namespace = web.get_form_value("namespace")

        snapshot = Snapshot.get_by_code(snapshot_code)
        session = SessionContents.get(asset_mode=True)

        my.set_info(snapshot, session, namespace)
Example #7
0
    def init_cgi(my):
        web = WebContainer.get_web()
        snapshot_code = web.get_form_value("snapshot_code")
        namespace = web.get_form_value("namespace")

        snapshot = Snapshot.get_by_code(snapshot_code)
        session = SessionContents.get(asset_mode=True)

        my.set_info(snapshot, session, namespace)
Example #8
0
 def execute(my):
     # NONE option is used for clearing the labels
     from pyasm.widget import SelectWdg
     if my.value == SelectWdg.NONE_MODE:
         my.value = ''
     for snap_code in my.snap_codes:
         snap_code = snap_code.split('|')[0]
         snapshot = Snapshot.get_by_code(snap_code)
         
         if snapshot:
             snapshot.set_value(my.attr_name, my.value)
             snapshot.commit()
Example #9
0
 def get_node_name(my, snapshot_code, namespace):
     xml = my._get_data()
     snapshot = Snapshot.get_by_code(snapshot_code)
     type = snapshot.get_type()
     if type == 'anim_export':
         type = 'anim'
     node = xml.get_node("session/node[@%s_snapshot_code='%s' and @namespace='%s']"\
         % (type, snapshot.get_code(), namespace  ))
     if node is not None:
         return Xml.get_attribute(node, 'name')
     else:
         return ''
Example #10
0
 def get_node_name(my, snapshot_code, namespace):
     xml = my._get_data()
     snapshot = Snapshot.get_by_code(snapshot_code)
     type = snapshot.get_type()
     if type == 'anim_export':
         type = 'anim'
     node = xml.get_node("session/node[@%s_snapshot_code='%s' and @namespace='%s']"\
         % (type, snapshot.get_code(), namespace  ))
     if node is not None:
         return Xml.get_attribute(node, 'name')
     else:
         return ''
Example #11
0
    def get_shot_loader_xml(my, ticket, project_code, snapshot_code, shot_code, instance_name, context="", options=""):
        '''uses the loader to generate an execute xml that can be
        used to load the assets'''
        try:
            my.init(ticket)
            Project.set_project(project_code)

            snapshot = Snapshot.get_by_code(snapshot_code)

            # get the shot
            shot = Shot.get_by_code(shot_code)
            if not shot:
                raise ServiceException("No shot [%s] exists" % shot_code)


            # get the loader implementation
            loader_context = ProdLoaderContext()
            loader_context.set_shot(shot)
            loader_context.set_context(context)

            # pass on any message options for the loader
            if options != "":
                loader_context.set_options(options)

            loader = loader_context.get_loader(snapshot)

            # just set the shot if we are loading the shot
            if shot_code == instance_name:
                loader.set_instance(shot)
            else:
                instance = ShotInstance.get_by_shot(shot, instance_name)
                if not instance:
                    raise TacticException('Asset Instance [%s] not found in shot [%s]'%(instance_name, shot.get_code()))
                loader.set_instance(instance)

            # setting all instances in anim to be loaded with the unique flag
            loader.set_unique()

            loader.execute()

            execute_xml = loader.get_execute_xml()
            xml = execute_xml.get_xml()

        finally:
            DbContainer.close_all()
        
        return xml
Example #12
0
    def execute(my):

        if my.project_code:
            Project.set_project(project_code)

        snapshot = Snapshot.get_by_code(my.snapshot_code)

        # get the loader implementation
        from pyasm.prod.load import ProdLoaderContext
        loader_context = ProdLoaderContext()
        loader_context.set_context(snapshot.get_value("context"))

        # pass on any message options for the loader
        #if options != "":
        #    loader_context.set_options(options)

        loader = loader_context.get_loader(snapshot)
        loader.execute()

        my.execute_xml = loader.get_execute_xml().to_string()
Example #13
0
    def add_ref_by_snapshot_code(my,
                                 snapshot_code,
                                 instance_name=None,
                                 parent=None,
                                 type='ref',
                                 node_name='',
                                 tag='main'):
        snapshot = Snapshot.get_by_code(snapshot_code)
        if not snapshot:
            Environment.add_warning(
                "Reference not found",
                "Found reference to snapshot [%s] which no longer exists in the Tactic database"
                % snapshot_code)
            return

        return my.add_ref_by_snapshot(snapshot,
                                      instance_name,
                                      parent,
                                      type,
                                      node_name,
                                      tag=tag)
Example #14
0
    def execute(my):

        if my.project_code:
            Project.set_project(project_code)

        snapshot = Snapshot.get_by_code(my.snapshot_code)

        # get the loader implementation
        from pyasm.prod.load import ProdLoaderContext

        loader_context = ProdLoaderContext()
        loader_context.set_context(snapshot.get_value("context"))

        # pass on any message options for the loader
        # if options != "":
        #    loader_context.set_options(options)

        loader = loader_context.get_loader(snapshot)
        loader.execute()

        my.execute_xml = loader.get_execute_xml().to_string()
Example #15
0
    def set_args(my, ticket, queue_id):

        my.ticket = ticket


        # get the necessary data
        queue = Queue.get_by_id(queue_id)
        #data = queue.get_xml_value("data")
        data = queue.get_xml_value("serialized")
        search_key = data.get_value("data/search_key")

        my.sobject = Search.get_by_search_key(search_key)
        if not my.sobject:
            raise Exception("SObject with search_key: %s does not exist" % search_key)

        snapshot_code = data.get_value("data/snapshot_code")
        my.snapshot = Snapshot.get_by_code(snapshot_code)

        my.file_range = data.get_value("data/file_range")
        my.session = "<session/>"

        my.pattern = data.get_value("data/pattern")
Example #16
0
    def get_update_xml(my, ticket, project_code, snapshot_code, asset_code, instance, context='', options=''):
        '''an update xml to update node info'''
        try:
            my.init(ticket)
            Project.set_project(project_code)
            
            snapshot = Snapshot.get_by_code(snapshot_code)

            # get the loader implementation
            loader_context = ProdLoaderContext()
            loader_context.set_context(context)
            if options != "":
                loader_context.set_options(options)

            loader = loader_context.get_updater(snapshot, asset_code, instance)
            loader.execute()

            execute_xml = loader.get_execute_xml()
            xml = execute_xml.get_xml()

        finally:
            DbContainer.close_all()
        return xml
Example #17
0
    def get_bottom(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')
            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|%s] context [%s] not found" %(search_type, search_id, 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.PREFIX 
            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('%s','%s')'''
                    % (prefix, my.REF_CB_NAME)})
            div.add( SpanWdg(update_button, css='small'))
        
        return div
Example #18
0
    def get_display(self):

        self.is_refresh = self.kwargs.get('is_refresh') =='true'
      
        if not self.is_refresh:
            top = DivWdg(css='spt_view_panel')
            self.set_as_panel(top)
        else:
            top = Widget() 

        div = DivWdg(css="filter_box")
        div.add("<b>Current Session</b>")
        top.add(div)

        # the button which initiates the introspection
        button = IntrospectWdg()
        #button.add_style("float", "right")
        top.add(button)

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


        session = SessionContents.get()
        if not session:
            widget.add("<h3>No contents in session</h3>")
            return widget

        table = Table()
        table.add_class("table")
        table.add_style("width: 100%")
        table.add_row()
        table.add_header("&nbsp;")
        table.add_header("Type")
        table.add_header("Asset")
        table.add_header("Node Name")
        table.add_header("Node Type")
        table.add_header("Reference")
        table.add_header("Session")
        table.add_header("Latest")

        node_names = session.get_node_names()
        for node_name in node_names:
            table.add_row()


            # snapshot_code
            snapshot_code = session.get_snapshot_code(node_name, "shot")
            if not snapshot_code:
                snapshot_code = session.get_snapshot_code(node_name, "anim")
            if not snapshot_code:
                snapshot_code = session.get_snapshot_code(node_name, "asset")

            snapshot = Snapshot.get_by_code(snapshot_code)
            sobject = None

            if snapshot:

                sobject = snapshot.get_sobject()
                base = sobject.get_search_type_obj().get_base_search_type()

                thumb = ThumbWdg()
                thumb.set_icon_size(60)

                # FIXME: make this more automatic
                if base == "prod/shot_instance":
                    thumb_sobj = sobject.get_parent("prod/asset")
                    thumb.set_sobject(thumb_sobj)
                else:
                    thumb.set_sobject(sobject)

                table.add_cell(thumb)

                title = sobject.get_search_type_obj().get_title()
                table.add_cell( title )

                # TODO: this should be more automatic!
                if base == "prod/shot_instance":
                    asset_code = sobject.get_value("asset_code")
                    shot_code = sobject.get_value("shot_code")
                    name = sobject.get_value("name")
                    table.add_cell("%s: %s in %s" % (name,asset_code,shot_code))
                else:
                    code = sobject.get_code()
                    name = sobject.get_name()
                    if code == name:
                        table.add_cell( "%s" % (code) )
                    else:
                        table.add_cell( "%s - %s" % (code, name) )

            else:
                table.add_cell("<i>No snapshot</i>")
                table.add_cell("---")
                table.add_cell("---")
                

            # display the node name
            table.add_cell(node_name)

            # display node type
            table.add_cell( session.get_node_type(node_name) )


            # display if it is a reference
            is_reference = session.is_reference(node_name)
            if is_reference:
                table.add_cell( "Yes" )
            else:
                table.add_cell( "No" )


            if snapshot:
                # add the snapshot info
                context = snapshot.get_value("context")
                version = snapshot.get_value("version")
                table.add_cell( "%s v%0.2d" % (context, version))
            else:
                table.add_cell("---")

            table.add_cell( self.get_version_wdg(session,snapshot,node_name) )

        top.add(table)
        return top       
Example #19
0
    def execute(my):
        search = Search("sthpw/file")
        search.add_limit(1000)
        search.add_where("relative_dir is NULL")
        search.add_order_by("code")
        files = search.get_sobjects()

        for file in files:

            snapshot_code = file.get_value("snapshot_code")

            snapshot = Snapshot.get_by_code(snapshot_code)
            if not snapshot:
                if WARNING: print "WARNING: Snapshot [%s] not found for file [%s]" % (snapshot_code, file.get_code() )
                continue

            try:
                file_name = file.get_value("file_name")
                if WARNING:
                    lib_dir = snapshot.get_lib_dir()
                    path = "%s/%s" % (lib_dir, file_name)

                    if not os.path.exists(path):
                        print "WARNING: path [%s] does not exist" % path

                file_type = snapshot.get_type_by_file_name(file_name)

                relative_dir = snapshot.get_relative_dir(file_type=file_type)

                cur_relative_dir = file.get_value("relative_dir")
                if cur_relative_dir and cur_relative_dir != relative_dir:
                    if WARNING: print "WARNING: current [%s] and build relative dir [%s] are not equal" % (cur_relative_dir, relative_dir)

                    #answer = raw_input("Fix (y/n): ")
                    #if answer == "n":
                    #    continue
                    #continue


                if cur_relative_dir != relative_dir:
                    file.set_value("relative_dir", relative_dir)
                    file.commit()



            except SObjectNotFoundException, e:
                # Remove some dangling unittest
                if snapshot_code.endswith("UNI"):
                    file.delete()
                    snapshot.delete()
                else:
                    if WARNING:
                        print "WARNING: Error getting directory for snapshot [%s] for file [%s]" % (snapshot_code, file.get_code() )
                        print "\t", e.__str__()

                continue

            except TacticException, e:
                print "WARNING: Problem found on file [%s]" % file.get_code()
                print "\t", e.__str__()
                continue
Example #20
0
    def get_display(my):

        my.is_refresh = my.kwargs.get('is_refresh') =='true'
      
        if not my.is_refresh:
            top = DivWdg(css='spt_view_panel')
            my.set_as_panel(top)
        else:
            top = Widget() 

        div = DivWdg(css="filter_box")
        div.add("<b>Current Session</b>")
        top.add(div)

        # the button which initiates the introspection
        button = IntrospectWdg()
        #button.add_style("float", "right")
        top.add(button)

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


        session = SessionContents.get()
        if not session:
            widget.add("<h3>No contents in session</h3>")
            return widget

        table = Table()
        table.add_class("table")
        table.add_style("width: 100%")
        table.add_row()
        table.add_header("&nbsp;")
        table.add_header("Type")
        table.add_header("Asset")
        table.add_header("Node Name")
        table.add_header("Node Type")
        table.add_header("Reference")
        table.add_header("Session")
        table.add_header("Latest")

        node_names = session.get_node_names()
        for node_name in node_names:
            table.add_row()


            # snapshot_code
            snapshot_code = session.get_snapshot_code(node_name, "shot")
            if not snapshot_code:
                snapshot_code = session.get_snapshot_code(node_name, "anim")
            if not snapshot_code:
                snapshot_code = session.get_snapshot_code(node_name, "asset")

            snapshot = Snapshot.get_by_code(snapshot_code)
            sobject = None

            if snapshot:

                sobject = snapshot.get_sobject()
                base = sobject.get_search_type_obj().get_base_search_type()

                thumb = ThumbWdg()
                thumb.set_icon_size(60)

                # FIXME: make this more automatic
                if base == "prod/shot_instance":
                    thumb_sobj = sobject.get_parent("prod/asset")
                    thumb.set_sobject(thumb_sobj)
                else:
                    thumb.set_sobject(sobject)

                table.add_cell(thumb)

                title = sobject.get_search_type_obj().get_title()
                table.add_cell( title )

                # TODO: this should be more automatic!
                if base == "prod/shot_instance":
                    asset_code = sobject.get_value("asset_code")
                    shot_code = sobject.get_value("shot_code")
                    name = sobject.get_value("name")
                    table.add_cell("%s: %s in %s" % (name,asset_code,shot_code))
                else:
                    code = sobject.get_code()
                    name = sobject.get_name()
                    if code == name:
                        table.add_cell( "%s" % (code) )
                    else:
                        table.add_cell( "%s - %s" % (code, name) )

            else:
                table.add_cell("<i>No snapshot</i>")
                table.add_cell("---")
                table.add_cell("---")
                

            # display the node name
            table.add_cell(node_name)

            # display node type
            table.add_cell( session.get_node_type(node_name) )


            # display if it is a reference
            is_reference = session.is_reference(node_name)
            if is_reference:
                table.add_cell( "Yes" )
            else:
                table.add_cell( "No" )


            if snapshot:
                # add the snapshot info
                context = snapshot.get_value("context")
                version = snapshot.get_value("version")
                table.add_cell( "%s v%0.2d" % (context, version))
            else:
                table.add_cell("---")

            table.add_cell( my.get_version_wdg(session,snapshot,node_name) )

        top.add(table)
        return top       
Example #21
0
    def get_display(self):
        
        if self.mode == 'detail':
            upstream = True
            div = DivWdg()
            self.snapshot_code = self.kwargs.get('snapshot_code')
            ref_snapshot = Snapshot.get_by_code(self.snapshot_code)
            self._handle_snapshot(ref_snapshot, div, upstream, recursive=False)
            return div


        self.web = WebContainer.get_web()

        if self.sobjects:
            snapshot = self.sobjects[0]
        else:
            search_type = self.kwargs.get("search_type")
            search_id = self.kwargs.get("search_id")

            snapshot = None
            if search_type == Snapshot.SEARCH_TYPE:
                snapshot = Search.get_by_id(search_type, search_id)
            else:
                snapshot = Snapshot.get_latest(search_type, search_id)
        if not snapshot:
            self.add(HtmlElement.h3("No snapshot found"))
            return super(DependencyWdg,self).get_display()



        widget = DivWdg()
        widget.add_style('min-width: 700px')
        
      
        if self.show_title:
            self.add(HtmlElement.h3("Asset Dependency"))

        from tactic.ui.panel import TableLayoutWdg
        table = TableLayoutWdg(search_type="sthpw/snapshot", mode='simple', view='table', width='700px')
        table.add_style('min-width: 700px')
        table.set_sobject(snapshot)
        widget.add(table)


        sobject = snapshot.get_sobject()
        search_type_obj = sobject.get_search_type_obj()

        #file_div = DivWdg(css='left_content discussion_child')
        file_div = DivWdg()
        file_div.add_color("background", "background", -20)
        file_div.add_color("color", "color")
        file_div.add_style("padding: 5px")
        file_div.add_border()




        #file_div.add_style('margin','0 10px 0 10px')
        file_div.add_style('padding','10px 0 0 10px')
        #file_div.add_style('-moz-border-radius: 6px')
        title = DivWdg()
        title.add_style("font-weight: bold")
        title.add_style("font-size: 1.2em")
        #title.add_style('margin-left', '10px')

        if self.show_title:
            title.add(search_type_obj.get_title() )
            title.add(" - ")
            title.add(sobject.get_code() )
            if sobject.has_value("description"):
                title.add(" : ")
                title.add(sobject.get_value("description") )

            file_div.add(title)
            file_div.add(HtmlElement.br())

        # find out how many 1st level ref nodes we are dealing with
        xml = snapshot.get_xml_value("snapshot")
        
        #self.total_ref_count = len(xml.get_nodes("snapshot/file/ref | snapshot/ref |snapshot/input_ref| snapshot/fref"))

        self._handle_snapshot(snapshot, file_div, upstream=True, recursive=True )
        self._handle_snapshot(snapshot, file_div,  upstream=False, recursive=True )

        #widget.add(widget)
        widget.add(file_div)
        widget.add(HtmlElement.br(2))

        #return super(DependencyWdg,self).get_display()
        return widget
Example #22
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