def _go_graph(self, req):
     #search all artifacts.
     artifacts = ArtifactManager.find_all(self.env)
     
     milestones = [m for m in Milestone.select(self.env)
                   if 'MILESTONE_VIEW' in req.perm(m.resource)]
     
     #add artifacts to milestone.
     for m in milestones:
         artifacts_of_m = [artifact for artifact in artifacts
                if artifact.milestone == m.name]
         setattr(m, 'artifacts', artifacts_of_m)
     
     manager = SCMManager(self.env, req)
     nodes = manager.artifacts_to_nodes(artifacts)
     
     roots = manager.get_roots(nodes)
     
     gm = GraphManager(self.env)
     nodes = gm.to_graphnode(roots)
     
     gm.to_s(nodes)
     
     graph = gm.to_graphviz(nodes, milestones)
     
     self.env.log.info('graphviz graph:\n%s' % graph)
     
     data = {'milestones':milestones, 'artifacts':artifacts, 'graph':graph}
     return 'releaseartifactgraph.html', data, None
    def _update_release_artifacts(self, req):
        # current name of milestone
        old_milestone_name = req.args.get('id')
        # new milestone name
        milestone_name = req.args.get('name')
        
        keywords = req.args.get('keywords')
        tags = self._to_list(req.args.get('tag'))
        urls = self._to_list(req.args.get('url'))
        
        artifacts = []
        
        count = len(tags)
        for index in range(count):
            if tags[index] == '':
                continue;
            artifact = Artifact(self.env, milestone_name, tags[index], urls[index], keywords)
            artifacts.append(artifact)

        ArtifactManager.update_all(self.env, artifacts, old_milestone_name)
 def _go_list(self, req):
     #search all artifacts.
     artifacts = ArtifactManager.find_all(self.env)
     
     milestones = [m for m in Milestone.select(self.env)
                   if 'MILESTONE_VIEW' in req.perm(m.resource)]
     
     #add artifacts to milestone.
     for m in milestones:
         artifacts_of_m = [artifact for artifact in artifacts
                if artifact.milestone == m.name]
         setattr(m, 'artifacts', artifacts_of_m)
     
     data = {'milestones':milestones, 'artifacts':artifacts}        
     return 'releaseartifactgraph.html', data, None
 def _get_artifacts_by_milestone(self, req):
     milestone_name = self._get_milestone_name(req.path_info)
     artifacts = ArtifactManager.find_by_milestone_name(self.env, milestone_name)
     return artifacts