Hi I'm doing a project tab panel and I can't retrieve (or put) parameters from velocity context.
Here is my class and plugin.xml
package it.pride.jira.plugins; import java.util.Map; import com.atlassian.jira.plugin.projectpanel.impl.GenericProjectTabPanel; import com.atlassian.jira.project.browse.BrowseContext; import com.atlassian.jira.security.JiraAuthenticationContext; import com.atlassian.jira.web.FieldVisibilityManager; import com.atlassian.jira.plugin.projectpanel.ProjectTabPanel; public class StatsTabPanel extends GenericProjectTabPanel implements ProjectTabPanel { public StatsTabPanel(JiraAuthenticationContext jiraAuthenticationContext, FieldVisibilityManager fieldVisibilityManager) { super(jiraAuthenticationContext, fieldVisibilityManager); // TODO Auto-generated constructor stub } public String testvalue="112002"; public Map<String, Object> createVelocityParams (BrowseContext context) { Map<String, Object> contextMap = createVelocityParams(context); contextMap.put("testvalue", testvalue); contextMap.put("currentProject", new CurrentProject()); contextMap.put("utility", new UtilityStatsPanel()); return contextMap; } }
<atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${project.name}" plugins-version="2"> <plugin-info> <description>${project.description}</description> <version>${project.version}</version> <vendor name="${project.organization.name}" url="${project.organization.url}"/> </plugin-info> <project-tabpanel key="stats-tab-panel" name="Stats Tab Panel" i18n-name-key="stats-tab-panel.name" class="it.pride.jira.plugins.StatsTabPanel"> <description key="stats-tab-panel.description">The Stats Tab Panel Plugin</description> <label key="stats-tab-panel.label"></label> <order>10</order> <resource type="velocity" name="view" location="templates/tabpanels/stats-tab-panel.vm"/> </project-tabpanel> <resource type="i18n" name="i18n" location="atlassian-plugin"/> </atlassian-plugin>
Community moderators have prevented the ability to post new answers.
The class must extedend AbstractProjectTabPanel and must implement the getHtml method as follows:
import java.util.HashMap; import java.util.Map; import com.atlassian.jira.plugin.projectpanel.impl.AbstractProjectTabPanel; import com.atlassian.jira.project.browse.BrowseContext; import com.atlassian.jira.security.JiraAuthenticationContext; public class StatsTabPanel extends AbstractProjectTabPanel { public StatsTabPanel(JiraAuthenticationContext jiraAuthenticationContext ) { super(jiraAuthenticationContext); // TODO Auto-generated constructor stub } final String testvalue="112002"; @Override public boolean showPanel(BrowseContext context){ return true; } /*@Override public Map<String, Object> createVelocityParams (BrowseContext context) { Map<String, Object> contextMap = createVelocityParams(context); contextMap.put("testvalue", testvalue); return contextMap; }*/ public String getHtml(BrowseContext context){ Map<String,Object> tmpParams =new HashMap<String,Object>(); tmpParams.put("testvalue", testvalue); return descriptor.getHtml("view",tmpParams); } }
Hi ,
i am trying to do something similar , can you please provide your vm file ? i want to add a new field in the version tab . right now i am creating a new project tab panel exactly similar to the version tab of a project and add my new field because i have no idea how i can add a new field in the version tab.
thanx :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.