Scarab commit: svn commit: r10604 - trunk/src: java/org/tigris/scarab/tools webapp/WEB-INF/templates/macros

[email protected]
Newsgroups gmane.comp.java.scarab.cvs
Message-ID <[email protected]>
Author: hair
Date: 2008-08-12 09:54:25-0700
New Revision: 10604

Modified:
   trunk/src/java/org/tigris/scarab/tools/ScarabRequestTool.java
   trunk/src/webapp/WEB-INF/templates/macros/GlobalMacros.vm

Log:
rabbit hole in r10602
 ScarabRequestTool.getRmoduleAttributeDisplayName(..) was hardcoded against the user's mitList but the userList macro has a mitList parameter.


Modified: trunk/src/java/org/tigris/scarab/tools/ScarabRequestTool.java
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/java/org/tigris/scarab/tools/ScarabRequestTool.java?view=diff&rev=10604&p1=trunk/src/java/org/tigris/scarab/tools/ScarabRequestTool.java&p2=trunk/src/java/org/tigris/scarab/tools/ScarabRequestTool.java&r1=10603&r2=10604
==============================================================================
--- trunk/src/java/org/tigris/scarab/tools/ScarabRequestTool.java	(original)
+++ trunk/src/java/org/tigris/scarab/tools/ScarabRequestTool.java	2008-08-12 09:54:25-0700
@@ -693,9 +693,10 @@
     
     /**
      * Find the best name for an attribute against the current mitList.
-     * If all issuetypes current in the mitList use the same name for the attribute this name is returned.
+     * If all issuetypes current in the user's mitList use the same name for the attribute this name is returned.
      * Otherwise the global name is returned.
-     * 
+     *
+     *
      * @param attribute the attribute a name is requested for
      * @return the name to use
      * @throws TorqueException 
@@ -703,17 +704,32 @@
     public String getRModuleAttributeDisplayName(final Attribute attribute) throws TorqueException
     {
         
+        final ScarabUser user = (ScarabUser)data.getUser();
+
+        return getRModuleAttributeDisplayName(attribute, user.getCurrentMITList());
+    }
+
+    /**
+     * Find the best name for an attribute against the current mitList.
+     * If all issuetypes current in the mitList use the same name for the attribute this name is returned.
+     * Otherwise the global name is returned.
+     * 
+     * @param attribute the attribute a name is requested for
+     * @param mitlist use a custom MITList instead of the user's current mitlist
+     * @return the name to use
+     * @throws TorqueException 
+     */
+    public String getRModuleAttributeDisplayName(final Attribute attribute, final MITList mitlist)
+            throws TorqueException
+    {
         String result = null;
-        
+
         final String globalName = attribute.getName();
-        final ScarabUser user = (ScarabUser)data.getUser();
-        final MITList mitlist = user.getCurrentMITList();
-        
+
         for(Iterator it = mitlist.getIssueTypeIds().iterator(); it.hasNext();)
         {
             final IssueType issueType = IssueTypeManager.getInstance((Integer) it.next());
 
-
             final Module m = mitlist.getModule();
 
             if(null != m && null != m.getRModuleAttribute(attribute, issueType))

Modified: trunk/src/webapp/WEB-INF/templates/macros/GlobalMacros.vm
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/webapp/WEB-INF/templates/macros/GlobalMacros.vm?view=diff&rev=10604&p1=trunk/src/webapp/WEB-INF/templates/macros/GlobalMacros.vm&p2=trunk/src/webapp/WEB-INF/templates/macros/GlobalMacros.vm&r1=10603&r2=10604
==============================================================================
--- trunk/src/webapp/WEB-INF/templates/macros/GlobalMacros.vm	(original)
+++ trunk/src/webapp/WEB-INF/templates/macros/GlobalMacros.vm	2008-08-12 09:54:25-0700
@@ -897,7 +897,7 @@
     #end
      #foreach ($userAttr in $userAttrs)
       #if ($user.hasPermission($userAttr.Permission, $modules))
-       #set($userAttrName = $scarabR.getRModuleAttributeDisplayName($userAttr))
+       #set($userAttrName = $scarabR.getRModuleAttributeDisplayName($userAttr,$mitList))
        <option value="$userAttr.AttributeId">$userAttrName</option>
       #end
      #end
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.