Scarab commit: svn commit: r10761 - trunk/src: java/org/tigris/scarab/om webapp/WEB-INF/templates/screens/entry webapp/WEB-INF/templates/viewIssue

Hussayn Dabbous <[email protected]>
Newsgroups gmane.comp.java.scarab.cvs
Message-ID <[email protected]>
Author: dabbous
Date: 2009-06-21 06:21:23-0700
New Revision: 10761

Modified:
   trunk/src/java/org/tigris/scarab/om/ScarabModule.java
   trunk/src/webapp/WEB-INF/templates/screens/entry/Wizard3.vm
   trunk/src/webapp/WEB-INF/templates/viewIssue/ViewIssueTab1.vm

Log:
SCB2818: Fixed the visibility controll of the ReasonField. (was only controlled during issue create, now during full lifetime of issue)

Modified: trunk/src/java/org/tigris/scarab/om/ScarabModule.java
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/java/org/tigris/scarab/om/ScarabModule.java?view=diff&pathrev=10761&r1=10760&r2=10761
==============================================================================
--- trunk/src/java/org/tigris/scarab/om/ScarabModule.java	(original)
+++ trunk/src/java/org/tigris/scarab/om/ScarabModule.java	2009-06-21 06:21:23-0700
@@ -1000,7 +1000,42 @@
             getLog().error("isIssueReasonRequired(): " + te);
         }
         return result;
-    }    
+    }
+
+    /**
+     * Provides the flag, whether the reason field shall be hidden
+     * from the interface. Note: This method returns false only,
+     * if the corresponding flag has been set in the module editor AND 
+     * the global parameter ISSUE_REASON_REQUIRED has been set to false!
+     * @return
+     */
+    public boolean isIssueReasonVisible()
+    {
+        // Due to history this information is stored as
+        // ISSUE_REASON_HIDDEN where it would have been 
+        // more straight forward to use ISSUE_REASON_VISIBLE.
+        // In order to not break existing implementations
+        // we keep with the negative logic for now.
+        String key = GlobalParameter.ISSUE_REASON_HIDDEN;
+        
+        boolean result = true; // per default show the issue reason field
+        
+        if (!isIssueReasonRequired())
+        {
+            try
+            {
+                result = !GlobalParameterManager.
+                    getBooleanFromHierarchy(key, this, true); 
+            }
+            catch (TorqueException te)
+            {
+                getLog().error("isIssueReasonVisible(): " + te);
+            }
+        }
+        return result;
+    }
+    
+    
 
     /**
      * Determines if the value of isIssueReasonRequired is due to the configuration

Modified: trunk/src/webapp/WEB-INF/templates/screens/entry/Wizard3.vm
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/webapp/WEB-INF/templates/screens/entry/Wizard3.vm?view=diff&pathrev=10761&r1=10760&r2=10761
==============================================================================
--- trunk/src/webapp/WEB-INF/templates/screens/entry/Wizard3.vm	(original)
+++ trunk/src/webapp/WEB-INF/templates/screens/entry/Wizard3.vm	2009-06-21 06:21:23-0700
@@ -98,25 +98,22 @@
 
 <h4>$l10n.SubmitNewIssue</h4>
 
-#set ($name = $scarabG.ParameterName.ISSUE_REASON_HIDDEN)
-#set ($selected = $scarabG.Parameter.getBoolean($name, $module))
-
   <div class="axial">
   <table width="100%" cellpadding="3" cellspacing="2" border="1">
 
-    #set ($intakeAttachment = $intake.Attachment.setKey("_1"))
-    #if ($selected == false)
+    #set ($intakeAttachment = $intake.Attachment.setKey("_1") )
+    #set ($reasonIsVisible  = $module.isIssueReasonVisible()  )
+    #if ($reasonIsVisible)
+      #set ($reasonIsRequired = $module.isIssueReasonRequired() )
       <tr>
         <th nowrap="nowrap">   
-          #if (!$module.isIssueReasonRequired())
-            #set ($reasonOptional = true)
-          #else
+          #if ($reasonIsRequired)
             #showAsterisk()
           #end
           $l10n.Reason 
         </th>
         <td>
-          #if (!$reasonOptional)
+          #if ($reasonIsRequired)
             #fieldErrorMsg($intakeAttachment.Data "")
             <p><small><strong>$l10n.MissedRequired1</strong> $l10n.MissedRequired2</small></p>
           #end

Modified: trunk/src/webapp/WEB-INF/templates/viewIssue/ViewIssueTab1.vm
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/webapp/WEB-INF/templates/viewIssue/ViewIssueTab1.vm?view=diff&pathrev=10761&r1=10760&r2=10761
==============================================================================
--- trunk/src/webapp/WEB-INF/templates/viewIssue/ViewIssueTab1.vm	(original)
+++ trunk/src/webapp/WEB-INF/templates/viewIssue/ViewIssueTab1.vm	2009-06-21 06:21:23-0700
@@ -110,7 +110,7 @@
                 #end
               #end
             #else
-	          #set ($allAttrValues = $currentIssue.getModuleAttributeValuesMap(false))		
+	              #set ($allAttrValues = $currentIssue.getModuleAttributeValuesMap(false))		
               #set ($attVal = $allAttrValues.get($att.getName().toUpperCase()))
               #set ($attrInput = $intake.AttributeValue.mapTo($attVal))
               #set ($isOptionAttr = $attVal.Attribute.isOptionAttribute())
@@ -119,11 +119,11 @@
               	  <th>[I] $rma.DisplayValue</th>
                   <td>
                     #if ($isOptionAttr)
-			          #if ($module.getRModuleOption($attVal.AttributeOption, $issueType).Active)
-                       	$!module.getRModuleOption($attVal.AttributeOption, $issueType).DisplayValue
-			          #else
-                       	[I]$!module.getRModuleOption($attVal.AttributeOption, $issueType).DisplayValue
-			          #end
+			                      #if ($module.getRModuleOption($attVal.AttributeOption, $issueType).Active)
+                        	$!module.getRModuleOption($attVal.AttributeOption, $issueType).DisplayValue
+			                      #else
+                        	[I]$!module.getRModuleOption($attVal.AttributeOption, $issueType).DisplayValue
+			                      #end
                     #elseif ($att.AttributeType.Name == "integer")
                       $!attrInput.NumericValue.value
                     #else
@@ -131,7 +131,7 @@
                     #end 
                   </td>
                 </tr>
-	          #end
+	              #end
             #end 
           #end
         </table>
@@ -139,35 +139,33 @@
     #end
   </div>
  
-  #if ($isEditAttributes)
-    <h4>$l10n.SaveChanges#if($module.isIssueReasonRequired()) #asterisk()#end</h4>
+  #set ($reasonIsVisible  = $module.isIssueReasonVisible()  )
+  #if ($isEditAttributes && $reasonIsVisible)
+    #set ($reasonIsRequired = $module.isIssueReasonRequired() )    
+    <h4>$l10n.SaveChanges#if($reasonIsRequired) #asterisk()#end</h4>
     <div class="axial">
       #set ($attCommentGroup = $intake.Attachment.setKey("attCommentKey$currentIssue.QueryKey"))
 
       <table cellpadding="3" cellspacing="2" border="0" width="100%">
         <tr>
-            <th nowrap="nowrap">#if($module.isIssueReasonRequired())#showAsterisk()#end$l10n.ReasonSavedAs</th>
+            <th nowrap="nowrap">#if($reasonIsRequired)#showAsterisk()#end$l10n.ReasonSavedAs</th>
             <td>
-                #if ($isEditAttributes)
-                    <input type="radio" name="saveReasonAs" value="history" checked="checked"> $l10n.History</input>
-                    #if ($canAddComment)
-                        <input type="radio" name="saveReasonAs" value="comment" > $l10n.Comment </input>
-                    #end
-                #else
-                    <input type="radio" name="saveReasonAs" value="comment" checked="checked"> $l10n.Comment </input>
+                <input type="radio" name="saveReasonAs" value="history" checked="checked"> $l10n.History</input>
+                #if ($canAddComment)
+                    <input type="radio" name="saveReasonAs" value="comment" > $l10n.Comment </input>
                 #end
                 $l10n.EnterReasonAs
 
-              #fieldErrorMsg($attCommentGroup.Data "")
-              <p>#textAreaMedium("$attCommentGroup.Data.Key" $attCommentGroup.Data.Value)</p>
-              <input type="hidden" name="$attCommentGroup.Name.Key" value="comment" />
+                #fieldErrorMsg($attCommentGroup.Data "")
+                <p>#textAreaMedium("$attCommentGroup.Data.Key" $attCommentGroup.Data.Value)</p>
+                <input type="hidden" name="$attCommentGroup.Name.Key" value="comment" />
             </td>
         </tr>
       </table>
     </div>
-   #end
+  #end
 
-   #if($canEdit)
+  #if($canEdit)
     <div class="functnbar3">
      #if(!$isEditAttributes)
         <input type="submit" value="$l10n.Edit" name="eventSubmit_doEditattributespage" />

------------------------------------------------------
http://scarab.tigris.org/ds/viewMessage.do?dsForumId=3577&dsMessageId=2363940
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.