(self)
return top
tasks = sobject.get_related_sobjects("sthpw/task")
        snapshots = sobject.get_related_sobjects("sthpw/snapshot")
        notes = sobject.get_related_sobjects("sthpw/note")
        work_hours = sobject.get_related_sobjects("sthpw/work_hour")
tasks = sobject.get_related_sobjects("sthpw/task")
        snapshots = sobject.get_related_sobjects("sthpw/snapshot")
        notes = sobject.get_related_sobjects("sthpw/note")
        work_hours = sobject.get_related_sobjects("sthpw/work_hour")
tasks = sobject . get_related_sobjects ( sthpw / task ) snapshots = sobject . get_related_sobjects ( sthpw / snapshot ) notes = sobject . get_related_sobjects ( sthpw / note ) work_hours = sobject . get_related_sobjects ( sthpw / work_hour )
def get_display(self):

        top = self.top
        top.add_style("min-width: 110px")


        sobject = self.get_current_sobject()
        
        if isinstance(sobject, Project):
            num_tasks = Search.eval("@COUNT(sthpw/task['project_code','%s'])"%sobject.get_code())
            num_snapshots = Search.eval("@COUNT(sthpw/snapshot['project_code','%s'])"%sobject.get_code())
            num_notes = Search.eval("@COUNT(sthpw/note['project_code','%s'])"%sobject.get_code())
            work_hours = Search.eval("@GET(sthpw/work_hour['project_code','%s'].straight_time)"%sobject.get_code())
        else:
            num_tasks = Search.eval("@COUNT(sthpw/task['project_code',$PROJECT])", sobjects=[sobject])
            num_snapshots = Search.eval("@COUNT(sthpw/snapshot['project_code',$PROJECT])", sobjects=[sobject])
            num_notes = Search.eval("@COUNT(sthpw/note['project_code',$PROJECT])", sobjects=[sobject])
            work_hours = Search.eval("@GET(sthpw/work_hour['project_code',$PROJECT].straight_time)", sobjects=[sobject])

        """
        tasks = sobject.get_related_sobjects("sthpw/task")
        snapshots = sobject.get_related_sobjects("sthpw/snapshot")
        notes = sobject.get_related_sobjects("sthpw/note")
        work_hours = sobject.get_related_sobjects("sthpw/work_hour")
        """
        line_div = DivWdg()
        top.add(line_div)
        line_div.add_style("padding: 3px")
        icon = IconWdg("Number of task", IconWdg.CALENDAR)
        line_div.add(icon)
        #num_tasks = len(tasks)
        if not num_tasks:
            num_tasks = 0
            line_div.add_style("opacity: 0.15")
            line_div.add_style("font-style: italic")
        line_div.add("%s task(s)<br/>" % num_tasks)


        kwargs = {
            "search_type": 'sthpw/task',
            "view": 'table',
            "search_key": sobject.get_search_key(),
            "show_shelf": False
        }
        line_div.generate_widget_key('tactic.ui.panel.ViewPanelWdg', inputs=kwargs)
        line_div.add_behavior( {
            'type': 'click_up',
            'search_key': sobject.get_search_key(),
            'cbjs_action': '''
            var row = bvr.src_el.getParent(".spt_table_row");
            var class_name = 'tactic.ui.panel.ViewPanelWdg';
            var class_name = bvr.src_el.getElement("SPT_WIDGET_KEY");
            var kwargs = {
                 "search_type": 'sthpw/task',
                "view": 'table',
                "search_key": bvr.search_key,
                "show_shelf": false
            }
            spt.table.remove_hidden_row(row);
            spt.table.add_hidden_row(row, class_name, kwargs);
            '''
        } )



        line_div = DivWdg()
        top.add(line_div)
        line_div.add_style("padding: 3px")
        icon = IconWdg("Number of check-in(s)", IconWdg.PUBLISH)
        line_div.add(icon)
        #num_snapshots = len(snapshots)
        if not num_snapshots:
            num_snapshots = 0
            line_div.add_style("opacity: 0.15")
            line_div.add_style("font-style: italic")
        line_div.add("%s check-in(s)<br/>" % num_snapshots )

        line_div.add_behavior( {
            'type': 'click_up',
            'search_key': sobject.get_search_key(),
            'cbjs_action': '''
            var row = bvr.src_el.getParent(".spt_table_row");
            var class_name = 'tactic.ui.panel.ViewPanelWdg';
            var kwargs = {
                search_type: 'sthpw/snapshot',
                view: 'table',
                search_key: bvr.search_key,
                show_shelf: false
            }
            spt.table.remove_hidden_row(row);
            spt.table.add_hidden_row(row, class_name, kwargs);
            '''
        } )




        line_div = DivWdg()
        top.add(line_div)
        line_div.add_style("padding: 3px")
        icon = IconWdg("Number of notes", IconWdg.NOTE)
        line_div.add(icon)
        #num_notes = len(notes)
        if not num_notes:
            num_notes = 0
            line_div.add_style("opacity: 0.15")
            line_div.add_style("font-style: italic")
        line_div.add("%s note(s)<br/>" % num_notes)


        line_div = DivWdg()
        top.add(line_div)
        line_div.add_style("padding: 3px")
        icon = IconWdg("Work Hours", IconWdg.CLOCK)
        line_div.add(icon)
        total = 0
        for work_hour in work_hours:
            straight_time = work_hour
            if straight_time:
                total += straight_time
        if not work_hours:
            work_hours = 0
            line_div.add_style("opacity: 0.15")
            line_div.add_style("font-style: italic")
        line_div.add("%s work hours<br/>" % total)


        return top
def get_display ( self ) : top = self . top top . add_style ( "min-width: 110px" ) sobject = self . get_current_sobject ( ) if isinstance ( sobject , Project ) : num_tasks = Search . eval ( "@COUNT(sthpw/task['project_code','%s'])" % sobject . get_code ( ) ) num_snapshots = Search . eval ( "@COUNT(sthpw/snapshot['project_code','%s'])" % sobject . get_code ( ) ) num_notes = Search . eval ( "@COUNT(sthpw/note['project_code','%s'])" % sobject . get_code ( ) ) work_hours = Search . eval ( "@GET(sthpw/work_hour['project_code','%s'].straight_time)" % sobject . get_code ( ) ) else : num_tasks = Search . eval ( "@COUNT(sthpw/task['project_code',$PROJECT])" , sobjects = [ sobject ] ) num_snapshots = Search . eval ( "@COUNT(sthpw/snapshot['project_code',$PROJECT])" , sobjects = [ sobject ] ) num_notes = Search . eval ( "@COUNT(sthpw/note['project_code',$PROJECT])" , sobjects = [ sobject ] ) work_hours = Search . eval ( "@GET(sthpw/work_hour['project_code',$PROJECT].straight_time)" , sobjects = [ sobject ] ) line_div = DivWdg ( ) top . add ( line_div ) line_div . add_style ( "padding: 3px" ) icon = IconWdg ( "Number of task" , IconWdg . CALENDAR ) line_div . add ( icon ) #num_tasks = len(tasks) if not num_tasks : num_tasks = 0 line_div . add_style ( "opacity: 0.15" ) line_div . add_style ( "font-style: italic" ) line_div . add ( "%s task(s)<br/>" % num_tasks ) kwargs = { "search_type" : 'sthpw/task' , "view" : 'table' , "search_key" : sobject . get_search_key ( ) , "show_shelf" : False } line_div . generate_widget_key ( 'tactic.ui.panel.ViewPanelWdg' , inputs = kwargs ) line_div . add_behavior ( { 'type' : 'click_up' , 'search_key' : sobject . get_search_key ( ) , 'cbjs_action' : '''
            var row = bvr.src_el.getParent(".spt_table_row");
            var class_name = 'tactic.ui.panel.ViewPanelWdg';
            var class_name = bvr.src_el.getElement("SPT_WIDGET_KEY");
            var kwargs = {
                 "search_type": 'sthpw/task',
                "view": 'table',
                "search_key": bvr.search_key,
                "show_shelf": false
            }
            spt.table.remove_hidden_row(row);
            spt.table.add_hidden_row(row, class_name, kwargs);
            ''' } ) line_div = DivWdg ( ) top . add ( line_div ) line_div . add_style ( "padding: 3px" ) icon = IconWdg ( "Number of check-in(s)" , IconWdg . PUBLISH ) line_div . add ( icon ) #num_snapshots = len(snapshots) if not num_snapshots : num_snapshots = 0 line_div . add_style ( "opacity: 0.15" ) line_div . add_style ( "font-style: italic" ) line_div . add ( "%s check-in(s)<br/>" % num_snapshots ) line_div . add_behavior ( { 'type' : 'click_up' , 'search_key' : sobject . get_search_key ( ) , 'cbjs_action' : '''
            var row = bvr.src_el.getParent(".spt_table_row");
            var class_name = 'tactic.ui.panel.ViewPanelWdg';
            var kwargs = {
                search_type: 'sthpw/snapshot',
                view: 'table',
                search_key: bvr.search_key,
                show_shelf: false
            }
            spt.table.remove_hidden_row(row);
            spt.table.add_hidden_row(row, class_name, kwargs);
            ''' } ) line_div = DivWdg ( ) top . add ( line_div ) line_div . add_style ( "padding: 3px" ) icon = IconWdg ( "Number of notes" , IconWdg . NOTE ) line_div . add ( icon ) #num_notes = len(notes) if not num_notes : num_notes = 0 line_div . add_style ( "opacity: 0.15" ) line_div . add_style ( "font-style: italic" ) line_div . add ( "%s note(s)<br/>" % num_notes ) line_div = DivWdg ( ) top . add ( line_div ) line_div . add_style ( "padding: 3px" ) icon = IconWdg ( "Work Hours" , IconWdg . CLOCK ) line_div . add ( icon ) total = 0 for work_hour in work_hours : straight_time = work_hour if straight_time : total += straight_time if not work_hours : work_hours = 0 line_div . add_style ( "opacity: 0.15" ) line_div . add_style ( "font-style: italic" ) line_div . add ( "%s work hours<br/>" % total ) return top