Scarab commit: svn commit: r10804 - trunk/src: conf/classes conf/conf schema sql/upgrade webapp/WEB-INF/templates/screens/admin webapp/WEB-INF/templates/viewIssue

Hussayn Dabbous <[email protected]>
Newsgroups gmane.comp.java.scarab.cvs
Message-ID <[email protected]>
Author: dabbous
Date: 2009-07-16 05:19:40-0700
New Revision: 10804

Modified:
   trunk/src/conf/classes/ScarabBundle_de.properties
   trunk/src/conf/classes/ScarabBundle_en.properties
   trunk/src/conf/conf/intake.xml
   trunk/src/schema/scarab-schema.xml
   trunk/src/sql/upgrade/upgrade-0.23-attribute.sql
   trunk/src/webapp/WEB-INF/templates/screens/admin/AttributeGroupEdit.vm
   trunk/src/webapp/WEB-INF/templates/viewIssue/ViewIssueTab1.vm

Log:
SCB2987:
- Added l10N elements for new column in issueType editor
- Modified intake to add a new visibility attribute for the issueType editor
- modified scarabschema to add a new database column to scarab_r_module_attribute and scarab_r_issuetype_attribute
  i am not sure if the later is realy needed though!
- added column add statements into the sql-upgrade scripts
- cleaned up the AttributeGroupEdit.vm and added a new column for attribute visibility
- Added the "visible when required" check to the IssueEditor

TODO: also apply the feature to the issueViewer (which currently does not take care about the new feature)

Modified: trunk/src/conf/classes/ScarabBundle_de.properties
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/conf/classes/ScarabBundle_de.properties?view=diff&pathrev804&r1803&r2804
=============================================================================--- trunk/src/conf/classes/ScarabBundle_de.properties	(original)
+++ trunk/src/conf/classes/ScarabBundle_de.properties	2009-07-16 05:19:40-0700
@@ -933,7 +933,6 @@
 AttributesInGroup=Attribute in dieser Gruppe
 PerProjectName=Pro Projekt-Name
 Required=Erforderlich
-IncludedInCustomQuery=In Benutzer-Abfrage enthalten
 DefaultTxt=Standard-Text
 GlobalAttributeOptions=Globale Attribut-Eigenschaften
 NoGlobalAttributeOptions=Keine globalen Attribut-Eigenschaften mehr verfügbar, die mit diesem Attribut in diesem Modul verknüpft werden könnten.
@@ -1146,6 +1145,8 @@
 ## AttributeGroupEdit title
 EditAttributeGroup=Attribut-Gruppe ''{0}'' ändern
 AddAttributeGroup=Attribut-Gruppe hinzufügen
+VisibleIfRequired=Sichtbar
+IncludedInCustomQuery�nutzer-Abfrage

 ## AttributeOptionSelect title
 AddGlobalAttributeOptionToAttribute=Globale Attribut-Eigenschaften bei Attribut ''{0}'' hinzufügen

Modified: trunk/src/conf/classes/ScarabBundle_en.properties
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/conf/classes/ScarabBundle_en.properties?view=diff&pathrev804&r1803&r2804
=============================================================================--- trunk/src/conf/classes/ScarabBundle_en.properties	(original)
+++ trunk/src/conf/classes/ScarabBundle_en.properties	2009-07-16 05:19:40-0700
@@ -1235,6 +1235,7 @@
 ## AttributeGroupEdit title
 EditAttributeGroup�it attribute group "{0}"
 AddAttributeGroup�d attribute group
+VisibleIfRequired=Visible

 ## AttributeOptionSelect title
 AddGlobalAttributeOptionToAttribute�d global attribute option to attribute "{0}"

Modified: trunk/src/conf/conf/intake.xml
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/conf/conf/intake.xml?view=diff&pathrev804&r1803&r2804
=============================================================================--- trunk/src/conf/conf/intake.xml	(original)
+++ trunk/src/conf/conf/intake.xml	2009-07-16 05:19:40-0700
@@ -179,6 +179,7 @@
         </field>
         <field name="Active" key="active" type="boolean"/>
         <field name="Required" key="req" type="boolean"/>
+        <field name="Visible" key="vis" type="boolean"/>
         <field name="QuickSearch" key="qs" type="boolean"/>
         <field name="IsDefaultText" key="dt" type="boolean"/>
         <field name="Order" key="order" type="int"
@@ -193,6 +194,7 @@
         </field>
         <field name="Active" key="active" type="boolean"/>
         <field name="Required" key="req" type="boolean"/>
+        <field name="Visible" key="vis" type="boolean"/>
         <field name="QuickSearch" key="qs" type="boolean"/>
         <field name="IsDefaultText" key="dt" type="boolean"/>
         <field name="Locked" key="loc" type="boolean"/>

Modified: trunk/src/schema/scarab-schema.xml
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/schema/scarab-schema.xml?view=diff&pathrev804&r1803&r2804
=============================================================================--- trunk/src/schema/scarab-schema.xml	(original)
+++ trunk/src/schema/scarab-schema.xml	2009-07-16 05:19:40-0700
@@ -499,13 +499,16 @@
 			<reference local="QA_CONTACT_ID" foreign="USER_ID"/>
 		</foreign-key>
 	</table>
+	
+	
 	<table name="SCARAB_R_MODULE_ATTRIBUTE" idMethod="none" javaName="RModuleAttribute" description="Attributes that are applicable to issues of the particular module.">
 		<column name="MODULE_ID" primaryKey="true" required="true" type="INTEGER" description="Module."/>
 		<column name="ATTRIBUTE_ID" primaryKey="true" required="true" type="INTEGER" description="Attribute."/>
 		<column name="ISSUE_TYPE_ID" primaryKey="true" required="true" type="INTEGER" description="Issue type."/>
 		<column name="DISPLAY_VALUE" required="true" type="VARCHAR" size="255" description="Value that represents the attribute in the UI."/>
-		<column name="ACTIVE" required="true" type="BOOLEANINT" default="1" javaType="primitive" description="Flag, which marks that module attribute is not used."/>
+		<column name="ACTIVE"   required="true" type="BOOLEANINT" default="1" javaType="primitive" description="Flag, which marks that module attribute is not used."/>
 		<column name="REQUIRED" required="true" type="BOOLEANINT" default="0" javaType="primitive" description="Flag, which marks that issues entered for this module must have this attribute set."/>
+		<column name="VISIBLE"  required="false" type="BOOLEANINT" default="1" javaType="primitive" description="Flag, which marks that this attribute is only visible when required."/>
 		<column name="PREFERRED_ORDER" javaName="Order" required="true" default="0" type="INTEGER" javaType="primitive" description="Column order."/>
 		<column name="QUICK_SEARCH" required="true" type="BOOLEANINT" default="0" javaType="primitive" description="Flag, which marks this attribute as being eligible for quick search."/>
 		<column name="DEFAULT_TEXT_FLAG" required="true" type="BOOLEANINT" default="0" javaType="primitive" description="Flag, which marks that this attribute should be used in the email subject line, when an issue is created. May be used in other contexts as well"/>
@@ -530,6 +533,7 @@
 		<column name="ISSUE_TYPE_ID" primaryKey="true" required="true" type="INTEGER" description="Issue type."/>
 		<column name="ACTIVE" required="true" type="BOOLEANINT" default="1" javaType="primitive" description="Flag, which marks that module attribute is not used."/>
 		<column name="REQUIRED" required="true" type="BOOLEANINT" default="0" javaType="primitive" description="Flag, which marks that issues entered for this module must have this attribute set."/>
+		<column name="VISIBLE"  required="false" type="BOOLEANINT" default="1" javaType="primitive" description="Flag, which marks that this attribute is only visible when required."/>
 		<column name="PREFERRED_ORDER" javaName="Order" required="true" default="0" type="INTEGER" javaType="primitive" description="Column order."/>
 		<column name="QUICK_SEARCH" required="true" type="BOOLEANINT" default="0" javaType="primitive" description="Flag, which marks this attribute as being eligible for quick search."/>
 		<column name="DEFAULT_TEXT_FLAG" required="true" type="BOOLEANINT" default="0" javaType="primitive" description="Flag, which marks that this attribute should be used in the email subject line, when an issue is created. May be used in other contexts as well"/>
@@ -547,6 +551,8 @@
 			<index-column name="QUICK_SEARCH"/>
 		</index>
 	</table>
+
+
 	<table name="SCARAB_R_MODULE_OPTION" idMethod="none" javaName="RModuleOption" description="Options that are applicable to issues of the particular module.">
 		<column name="MODULE_ID" primaryKey="true" required="true" type="INTEGER" description="Module."/>
 		<column name="ISSUE_TYPE_ID" primaryKey="true" required="true" type="INTEGER" description="Issue Type."/>

Modified: trunk/src/sql/upgrade/upgrade-0.23-attribute.sql
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/sql/upgrade/upgrade-0.23-attribute.sql?view=diff&pathrev804&r1803&r2804
=============================================================================--- trunk/src/sql/upgrade/upgrade-0.23-attribute.sql	(original)
+++ trunk/src/sql/upgrade/upgrade-0.23-attribute.sql	2009-07-16 05:19:40-0700
@@ -17,3 +17,12 @@
 ALTER TABLE SCARAB_ATTRIBUTE ADD ( HINT VARCHAR(255) );
 ALTER TABLE SCARAB_ATTRIBUTE ADD ( FIELDSIZE INTEGER );
 ALTER TABLE SCARAB_ATTRIBUTE ADD ( MULTI_VALUE INTEGER NOT NULL DEFAULT 0);
+
+/*
+ * The following rows are needed to enable attribute visibility.
+ * Basically we added the feature to hide atributes from the view unless
+ * they are required.
+ */
+
+ALTER TABLE SCARAB_R_MODULE_ATTRIBUTE    ADD ( VISIBLE INTEGER default 1);
+ALTER TABLE SCARAB_R_ISSUETYPE_ATTRIBUTE ADD ( VISIBLE INTEGER default 1);
\ No newline at end of file

Modified: trunk/src/webapp/WEB-INF/templates/screens/admin/AttributeGroupEdit.vm
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/webapp/WEB-INF/templates/screens/admin/AttributeGroupEdit.vm?view=diff&pathrev804&r1803&r2804
=============================================================================--- trunk/src/webapp/WEB-INF/templates/screens/admin/AttributeGroupEdit.vm	(original)
+++ trunk/src/webapp/WEB-INF/templates/screens/admin/AttributeGroupEdit.vm	2009-07-16 05:19:40-0700
@@ -29,6 +29,13 @@
 <input type="submit" value="$l10n.Cancel"  name="eventSubmit_doCancel" />
 </div>

+## =============================================================================+## The Group Header
+## Group name
+## Description
+## role dependent visibility
+## =============================================================================+
 <h3>$l10n.AttributeGroupInfo</h3>

 #set ($agGroup = $intake.AttributeGroup.mapTo($group))
@@ -66,6 +73,18 @@
  </table>
 </div>

+## =============================================================================+## All attributes available in this group
+## - global attribute name (the"root" attribute from where properties are inherited)
+## - module/issue type specific name
+## - is active (can be modified)
+## - is always required
+## - only visible if required
+## - Can be used within custom queries
+## - Default text (visible in the breadcrumb header)
+## Sequence (order of appearance)
+## =============================================================================+
 #if (!$issueTypeLocked && !$immutable)
 <div class="functnbar3">
 <input type="submit" value="$l10n.Save" name="eventSubmit_doSaveinfo" />&#160;
@@ -74,92 +93,99 @@

 <h3>$l10n.AttributesInGroup</h3>
 #if (!$group.Attributes.isEmpty())
-<table width="100%" border="1" cellspacing="2" cellpadding="3">
-<tr>
-#if (!$issueTypeLocked && !$immutable)
-  <th>$l10n.Select</th>
-#end
-<th>$l10n.Name</th>
-<th>$l10n.PerProjectName</th>
-<th>$l10n.Active</th>
-<th>$l10n.Required</th>
-<th>$l10n.IncludedInCustomQuery</th>
-<th>$l10n.DefaultTxt</th>
-<!--th>isStatus</th-->
-<th>$l10n.Sequence</th>
-</tr>
-#foreach ($attribute in $group.Attributes)
-   #set ($rma = $scarabR.CurrentModule.getRModuleAttribute($attribute, $group.IssueType))
-   #set ($rmaGroup = $intake.RModuleAttribute.mapTo($rma))
-   #set ($raag = $group.getRAttributeAttributeGroup($attribute))
-   #set ($raagGroup = $intake.RAttributeAttributeGroup.mapTo($raag))
-   #set ($ria = "")
-   #set ($ria = $group.IssueType.getRIssueTypeAttribute($attribute))
-   #set ($locked = ($issueTypeLocked) || (!$ria.equals("") && $ria.Locked) || $immutable)
- #indexedRows($velocityCount)
- #if (!$issueTypeLocked && !$immutable) <td> #if (!$locked) <input type="checkbox" name="att_delete_$attribute.AttributeId" /> #end</td>#end
- <td>$link.setPage("admin,ModuleAttributeEdit.vm").addPathInfo("$scarabG.Constant.CANCEL_TEMPLATE","admin,AttributeGroupEdit.vm").addPathInfo("att_0id", "$attribute.AttributeId").addPathInfo("key", "groupId").addPathInfo("groupId", $groupId).addPathInfo("issueTypeId", $group.IssueTypeId).setLabel("$attribute.Name")</td>
- <td>
-    #if ($rmaGroup.DisplayValue.toString().length() > 0)
-          #set ($value="$rmaGroup.DisplayValue" )
-    #else
-          #set ($value="$attribute.Name")
-    #end
-    #if (!$locked)
-         <input type="text" size="15" name="$rmaGroup.DisplayValue.Key" value="$value" />
-    #else
-         $value
-    #end
-    </td>
- <td>#booleanCheckboxLock ($rmaGroup.Active $locked)</td>
- <td>#booleanCheckboxLock ($rmaGroup.Required $locked)</td>
- <td>#booleanCheckboxLock ($rmaGroup.QuickSearch $locked)</td>
- <td>
-#if ($rma.Attribute.isTextAttribute())
-    #set ($defaultText = $data.Parameters.getString("default_text",""))
-    #if ($defaultText.length() > 0)
-        #if($defaultText == $rma.Attribute.QueryKey)
-            #set ($checked = true)
-        #end
-    #elseif ($rma.IsDefaultText)
-        #set ($checked = true)
-    #end
-    <input type="radio"
-           #if($checked)checked="checked"#end
-           #if($locked)disabled="disabled"#end
-           name="default_text"
-           value="$rma.Attribute.QueryKey"/>
-    #set ($checked = false)
-#else
-    N/A
-#end
-</td>
+  <table width="100%" border="1" cellspacing="2" cellpadding="3">

- <!--td>
-#if ($rma.Attribute.isTextAttribute())
-    N/A
-#else
-    #set ($key = "status_attribute_$issueType.getIssueTypeId()")
-    #set ($statusAttribute = $scarabG.Parameter.getString("$key",$module))
-    #if  ($statusAttribute.length() > 0)
-        #if( $statusAttribute == $rma.Attribute.QueryKey )
-            #set ($checked = true)
-        #end
-    #end
-    <input type="radio"
-           #if($checked)checked="checked"#end
-           #if($locked)disabled="disabled"#end
-           name="$key"
-           value="$rma.Attribute.QueryKey"/>
-    #set ($checked = false)
-#end
-</td-->
+    ## --------------------------------------------------------------
+    ## List header for attributes in group
+    ## --------------------------------------------------------------
+    <tr>
+      #if (!$issueTypeLocked && !$immutable)
+        <th>$l10n.Select</th>
+      #end
+      <th>$l10n.Name</th>
+      <th>$l10n.PerProjectName</th>
+      <th>$l10n.Active</th>
+      <th>$l10n.Required</th>
+      <th>$l10n.VisibleIfRequired</th>
+      <th>$l10n.IncludedInCustomQuery</th>
+      <th>$l10n.DefaultTxt</th>
+      <!--th>isStatus</th-->
+      <th>$l10n.Sequence</th>
+    </tr>
+
+    #foreach ($attribute in $group.Attributes)
+      #set ($rma = $scarabR.CurrentModule.getRModuleAttribute($attribute, $group.IssueType))
+      #set ($rmaGroup = $intake.RModuleAttribute.mapTo($rma))
+      #set ($raag = $group.getRAttributeAttributeGroup($attribute))
+      #set ($raagGroup = $intake.RAttributeAttributeGroup.mapTo($raag))
+      #set ($ria = "")
+      #set ($ria = $group.IssueType.getRIssueTypeAttribute($attribute))
+      #set ($locked = ($issueTypeLocked) || (!$ria.equals("") && $ria.Locked) || $immutable)
+      #indexedRows($velocityCount)
+        #if (!$issueTypeLocked && !$immutable) <td> #if (!$locked) <input type="checkbox" name="att_delete_$attribute.AttributeId" /> #end</td>#end
+        <td>$link.setPage("admin,ModuleAttributeEdit.vm").addPathInfo("$scarabG.Constant.CANCEL_TEMPLATE","admin,AttributeGroupEdit.vm").addPathInfo("att_0id", "$attribute.AttributeId").addPathInfo("key", "groupId").addPathInfo("groupId", $groupId).addPathInfo("issueTypeId", $group.IssueTypeId).setLabel("$attribute.Name")</td>
+        <td>
+          #if ($rmaGroup.DisplayValue.toString().length() > 0)
+              #set ($value="$rmaGroup.DisplayValue" )
+          #else
+              #set ($value="$attribute.Name")
+          #end
+          #if (!$locked)
+            <input type="text" size="15" name="$rmaGroup.DisplayValue.Key" value="$value" />
+          #else
+            $value
+          #end
+        </td>
+        <td>#booleanCheckboxLock ($rmaGroup.Active      $locked)</td>
+        <td>#booleanCheckboxLock ($rmaGroup.Required    $locked)</td>
+        <td>#booleanCheckboxLock ($rmaGroup.Visible     $locked)</td>
+        <td>#booleanCheckboxLock ($rmaGroup.QuickSearch $locked)</td>
+        <td>
+          #if ($rma.Attribute.isTextAttribute())
+            #set ($defaultText = $data.Parameters.getString("default_text",""))
+            #if ($defaultText.length() > 0)
+              #if($defaultText == $rma.Attribute.QueryKey)
+                #set ($checked = true)
+              #end
+            #elseif ($rma.IsDefaultText)
+              #set ($checked = true)
+            #end
+            <input type="radio"
+               #if($checked)checked="checked"#end
+               #if($locked)disabled="disabled"#end
+               name="default_text"
+               value="$rma.Attribute.QueryKey"/>
+            #set ($checked = false)
+          #else
+            N/A
+          #end
+        </td>
+
+        <!--td>
+          #if ($rma.Attribute.isTextAttribute())
+            N/A
+          #else
+            #set ($key = "status_attribute_$issueType.getIssueTypeId()")
+            #set ($statusAttribute = $scarabG.Parameter.getString("$key",$module))
+            #if  ($statusAttribute.length() > 0)
+              #if( $statusAttribute == $rma.Attribute.QueryKey )
+                #set ($checked = true)
+              #end
+            #end
+            <input type="radio"
+               #if($checked)checked="checked"#end
+               #if($locked)disabled="disabled"#end
+               name="$key"
+               value="$rma.Attribute.QueryKey"/>
+            #set ($checked = false)
+          #end
+        </td-->

- <td>#if ($locked) $raag.Order #else #numericOrderSelect($group.Name "$raagGroup.Order.Key" 1 $group.Attributes.size() $raagGroup.Order.Value 1 ) #end</td>
- </tr>
-#end
-</table>
-<p><small>$l10n.DefaultText </small></p>
+        <td>#if ($locked) $raag.Order #else #numericOrderSelect($group.Name "$raagGroup.Order.Key" 1 $group.Attributes.size() $raagGroup.Order.Value 1 ) #end</td>
+      </tr>
+    #end
+  </table>
+  <p><small>$l10n.DefaultText </small></p>
 #else
   <p><em>$l10n.ClickAddButton</em></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&pathrev804&r1803&r2804
=============================================================================--- trunk/src/webapp/WEB-INF/templates/viewIssue/ViewIssueTab1.vm	(original)
+++ trunk/src/webapp/WEB-INF/templates/viewIssue/ViewIssueTab1.vm	2009-07-16 05:19:40-0700
@@ -108,7 +108,8 @@
                 #set ($index = $rma.DisplayValue.indexOf("append:") + 7)
                 #if ($linecount > 0 && $index > 6)
                   #set ($displayValue = $rma.DisplayValue.substring($index))
-                  <span id="${displayValue}:Container">
+                  #set ($isHidden =  !( $currentIssue.isRequiredAttributeFor($att, $user) || $rma.Visible ) )
+                  <span id="${displayValue}:Container" #if ($isHidden) style="display:none;" #end>
                   <span class="displayValue" style="white-space:nowrap;display:inline;margin-left:0px; margin-right:0px;width:95%;">#drawRequiredMarkupAsNeeded($user $currentIssue $att)$displayValue</span>
                 #else
                   #set ($displayValue = $rma.DisplayValue)

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