Scarab commit: svn commit: r10805 - trunk/src/webapp/WEB-INF/templates: macros viewIssue
Hussayn Dabbous <[email protected]>
| Newsgroups | gmane.comp.java.scarab.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: dabbous
Date: 2009-07-17 14:08:54-0700
New Revision: 10805
Modified:
trunk/src/webapp/WEB-INF/templates/macros/GlobalMacros.vm
trunk/src/webapp/WEB-INF/templates/viewIssue/ViewIssueTab1.vm
Log:
SCB2986:
- Finalized the GUI. Now inlined attributes are technically fully supported in a convenient way:
If an attribute name starts with "append:" it will be appended to the current attribute row instead of rendering it
into the next row. There are still some subtleties which need to be documented. The most inconvenient property
is that text areas will shrink significantly in width when you try to append the following attribute.
- Reworked the Issue entry wizzard to also support all new features introduced to the gui recently:
- correct display of required attributes.
- support for inlined attributes.
- support for attribute style (width, css ...
IMHO The issue SCB2986 can be closed now.
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&pathrev=10805&r1=10804&r2=10805
==============================================================================
--- trunk/src/webapp/WEB-INF/templates/macros/GlobalMacros.vm (original)
+++ trunk/src/webapp/WEB-INF/templates/macros/GlobalMacros.vm 2009-07-17 14:08:54-0700
@@ -47,6 +47,22 @@
$count
#end
+## ===================================================================
+## Helper macro
+## $string : A string
+## $sub : A substring to be searched for in $string
+## returns : The string right after the first occurance of $sub
+## ===================================================================
+#macro (substringAfter $string $sub)
+ #set ($index = $rma.DisplayValue.indexOf( $sub ) + $sub.length() )
+ #if ($index >= $sub.length() )
+ #set ($displayValue = $rma.DisplayValue.substring($index))
+ #else
+ #set ($displayValue = $rma.DisplayValue)
+ #end
+$displayValue
+#end
+
#macro (attrValueLeafSelect $attrValue $optionFieldName $size $multiple $required)
#set ($attrInput = $intake.AttributeValue.mapTo($attrValue))
#set ($attr = $attrValue.Attribute)
@@ -60,10 +76,11 @@
#set ($newValues = '')
#set ($newValues = $attrInput.get($optionFieldName).Value)
#set ( $count = "#AllowedTransitionsForOption ( $attrValue $optionFieldName $size $multiple )")
-
+ #set ($cssId = "#substringAfter($attVal.RModuleAttribute.DisplayValue 'append:')")
+ #set ($cssId = $cssId.trim())
#if ($count.trim() == "0" )
- <input id="$attVal.RModuleAttribute.DisplayValue" type="hidden" name="$attrInput.get($optionFieldName).Key" value="$newValues"/>
- <span id="$attVal.RModuleAttribute.DisplayValue:Display">$newValues</span>
+ <input id="$cssId" type="hidden" name="$attrInput.get($optionFieldName).Key" value="$newValues"/>
+ <span id="$cssId:Display">$newValues</span>
#elseif ($count.trim() == "1" )
#foreach ($option in $module.getOptionTree($attr, $issueType, false))
@@ -71,7 +88,7 @@
#if ($canMakeTransition.trim()=="true")
#if ($templateInfo || (!$required && $newValues && $newValues.toString() == ''))
- <input id="$attVal.RModuleAttribute.DisplayValue" type="hidden" name="$attrInput.get($optionFieldName).Key" value="$newValues"/>
+ <input id="$cssId" type="hidden" name="$attrInput.get($optionFieldName).Key" value="$newValues"/>
#if ($newValues > 0)
#set ($checked = "checked")
#end
@@ -80,9 +97,9 @@
name="${attrInput.get($optionFieldName).Key}_tmp"
onclick="$oc" ${checked} />
#else
- <input id="$attVal.RModuleAttribute.DisplayValue" type="hidden" name="$attrInput.get($optionFieldName).Key" value="$option.optionId"/>
+ <input id="$cssId" type="hidden" name="$attrInput.get($optionFieldName).Key" value="$option.optionId"/>
#end
- #if (!$option.Active)[I]#end <span id="$attVal.RModuleAttribute.DisplayValue:Display">$option.DisplayValue</span>
+ #if (!$option.Active)[I]#end <span id="$cssId:Display">$option.DisplayValue</span>
#end
#end
@@ -91,7 +108,10 @@
<input id="$attrInput.get($optionFieldName).Key" value="$newValues" name="$attrInput.get($optionFieldName).Key" type="hidden"/>
<input id="$attrInput.get($optionFieldName).Key:Display" type="text" size="$attr.FieldSize" readonly="" name="$attrInput.get($optionFieldName).Key:Display"/>
- <a class="treeview_button" id="$attrInput.get($optionFieldName).Key:Anchor" href="javascript:toggleTreePopup('$attrInput.get($optionFieldName).Key')"> </a>
+ <a class="treeview_button"
+ id="$attrInput.get($optionFieldName).Key:Anchor"
+ href="javascript:toggleTreePopup('$attrInput.get($optionFieldName).Key')"
+ > </a>
#set ($attributeTreePopup = [])
#set ($dummy = $attributeTreePopup.add($attrInput.get($optionFieldName).Key) )
@@ -822,11 +842,11 @@
#showAsterisk() ## unconditionally required.
#elseif ($rma.Conditions.size() > 0)
#set ($isRequired = $issue.isRequiredAttributeFor($attribute, $user))
- #set ($visibility = "hidden")
+ #set ($visibility = "none")
#if ($isRequired)
- #set ($visibility = "visible")
+ #set ($visibility = "inline")
#end
- <b class="asterisk" id="conditional:${rma.DisplayValue}" style="visibility:$visibility;">*</b>
+ <b class="asterisk" id="conditional:${rma.DisplayValue}" style="display:$visibility;">*</b>
#else
## atribute is neither required nor has it conditional attributres. Nothing TODO
#end
@@ -1077,13 +1097,19 @@
$user.setLastEnteredIssueType($issueType)
#end
+ ## ===============================================================================
+ ## The Attribute-groups area
+ ## ===============================================================================
+
<div class="axial">
#foreach ($group in $moduleAttributeGroups)
- #if (!$group.Attributes.isEmpty() && $group.isVisible4User($user))
+ #set ($attributes = $group.Attributes)
+ #if ($attributes && !$attributes.isEmpty() && $group.isVisible4User($user))
<h4>$group.Name #asterisk()</h4>
<table cellpadding="3" cellspacing="2" border="0" width="100%">
#set ($appendToNextLine = "")
- #foreach ($att in $group.Attributes)
+ #set ($linecount = 0)
+ #foreach ($att in $attributes)
#set ($rma = $module.getRModuleAttribute($att, $issueType))
#if ($rma.Active)
## reset to a new $attVal in the event the issue/template does not
@@ -1093,24 +1119,67 @@
#set ($attVal = $issue.getAttributeValue($att))
#if (!$attVal.Attribute.isUserAttribute())
- #if ($attVal.Attribute.AttributeType.ValidationKey)
+ #if ($att.AttributeType.ValidationKey)
#set ($field = $attVal.Attribute.AttributeType.ValidationKey)
- #elseif ($attVal.Attribute.AttributeType.Name == $scarabG.Constant.DROPDOWN_LIST)
+ #elseif ($att.isOptionAttribute())
#set ($field = "OptionId")
#else
#set ($field = "Value")
#end
- #set ($index = $attVal.RModuleAttribute.DisplayValue.indexOf(":") + 1)
- #if ($index > 1)
- #set ($displayValue = $attVal.RModuleAttribute.DisplayValue.substring($index))
- #set ($appendToNextLine = [$attVal, $att, $field, $displayValue])
+ #set ($fieldSize = 0)
+ #set ($fieldSize = $!attVal.Attribute.FieldSize)
+ #set ($fieldHint = "")
+ #set ($fieldHint = $!attVal.Attribute.Hint)
+ #set ($fieldStyle = "")
+ #set ($fieldStyle = $!attVal.Attribute.Style)
+
+ #set ($fieldExtraHeader = "")
+ #if ($!attVal.Attribute.Description.startsWith("hint:"))
+ #set ($fieldExtraHeader = "$!attVal.Attribute.Description.substring(5)")
+ #end
+
+ #set ($isHidden = !( $currentIssue.isRequiredAttributeFor($att, $user) || $rma.Visible ) )
+ #set ($index = $rma.DisplayValue.indexOf("append:") + 7)
+ #if ($linecount > 0 && $index > 6)
+ #set ($displayValue = $rma.DisplayValue.substring($index))
#else
+ #set ($displayValue = $rma.DisplayValue)
+ #end
+
+ #set ($display = true)
+ #set ($isOptionAttr = $attVal.Attribute.isOptionAttribute())
+ #if ($isOptionAttr)
+ #set ($fieldStyle = $!attVal.AttributeOption.Style)
+ #if ($attVal.AttributeOption.Deleted.toString().equals("true"))
+ #set ($display = false)
+ #end
+ #end
+
+ #if ($linecount > 0 && $index > 6)
+ #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
+ #if ($linecount > 0)
+ </td>
+ </tr>
+ #end
+ #set ($linecount = $linecount + 1)
<tr>
- <th> #drawRequiredMarkupAsNeeded($user $issue $att)$attVal.RModuleAttribute.DisplayValue</th>
+ <th>
+ <span style="white-space:nowrap;display:inline;margin-left:0px; margin-right:0px;width:95%;">#drawRequiredMarkupAsNeeded($user $currentIssue $att)$displayValue</span>
+ #if($fieldExtraHeader)
+ <pre>$fieldExtraHeader</pre>
+ #end
+ </th>
<td>
- #if ($attVal.Attribute.isOptionAttribute())
+ #set ($newline = false)
+ #end
+ <span style="white-space:nowrap;display:inline;margin-left:0px; margin-right:10px;width:95%;">
+
+ #if ($att.isOptionAttribute())
#if ($templ)
#set ($templAttVal = $scarabR.getNewAttributeValue($att, $templ))
## this may leave the previous value, if RHS is null
@@ -1120,10 +1189,6 @@
#attrValueLeafSelect ($attVal $field "" false $attVal.isRequired())
#end
#else
- #set ($fieldSize = 0)
- #set ($fieldSize = $!attVal.Attribute.FieldSize)
- #set ($fieldHint = "")
- #set ($fieldHint = $!attVal.Attribute.Hint)
#if ($templ)
#set ($templAttVal = $scarabR.getNewAttributeValue($att, $templ))
## this may leave the previous value, if RHS is null
@@ -1138,58 +1203,12 @@
#end
#end
#attrValueErrorMsg ($attVal $field)
-
- #if ($appendToNextLine != "")
- #set ($AttributeIsRequired = $issue.isRequiredAttributeFor($appendToNextLine.get(1), $user))
- #set ($visibility="hidden")
- #if ($AttributeIsRequired)
- #set ($visibility="block")
#end
-
- <span id="$appendToNextLine.get(3)" style="visibility:$visibility;">
- #drawRequiredMarkupAsNeeded($user $issue $appendToNextLine.get(1))$appendToNextLine.get(3)
-
- #if ($appendToNextLine.get(0).Attribute.isOptionAttribute())
- #if ($templ)
- #set ($templAttVal = $scarabR.getNewAttributeValue($appendToNextLine.get(1), $templ))
- ## this may leave the previous value, if RHS is null
- #set ($templAttVal = $templ.getAttributeValue($appendToNextLine.get(1)))
- #templateAttrValueLeafSelect ($appendToNextLine.get(0) $templAttVal $field "" false)
- #else
- #attrValueLeafSelect ($appendToNextLine.get(0) $appendToNextLine.get(2) "" false $appendToNextLine.get(0).isRequired())
- #end
- #else
- #set ($fieldSize = 0)
- #set ($fieldSize = $!$appendToNextLine.get(0).Attribute.FieldSize)
- #set ($fieldHint = "")
- #set ($fieldHint = $!$appendToNextLine.get(0).Attribute.Hint)
- #if ($templ)
- #set ($templAttVal = $scarabR.getNewAttributeValue($appendToNextLine.get(1), $templ))
- ## this may leave the previous value, if RHS is null
- #set ($templAttVal = $templ.getAttributeValue($appendToNextLine.get(1)))
- #if ($templAttVal.Value)
- #templateAttrValueText ( $appendToNextLine.get(0) $appendToNextLine.get(0) $fieldSize $templAttVal )
- #else
- #attrValueText ( $appendToNextLine.get(0) $appendToNextLine.get(0) $fieldSize $fieldHint)
#end
- #else
- #attrValueText ( $appendToNextLine.get(0) $appendToNextLine.get(0) $fieldSize $fieldHint)
- #end
- #end
- #attrValueErrorMsg ($appendToNextLine.get(0) $field)
- </span>
- #end
- </td>
- </tr>
- #set ($appendToNextLine = "")
- #end
- #end
- #end
#end
</table>
#end
#end
</div>
-#end
-
-#end
+#end ## if
+#end ## macro
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=10805&r1=10804&r2=10805
==============================================================================
--- trunk/src/webapp/WEB-INF/templates/viewIssue/ViewIssueTab1.vm (original)
+++ trunk/src/webapp/WEB-INF/templates/viewIssue/ViewIssueTab1.vm 2009-07-17 14:08:54-0700
@@ -74,9 +74,9 @@
## ===============================================================================
## The Attribute-groups area
## ===============================================================================
-
+ #set ($moduleAttributeGroups = $issueType.getAttributeGroups($module, true))
<div class="axial">
- #foreach ($group in $issueType.getAttributeGroups($module, true))
+ #foreach ($group in $moduleAttributeGroups)
#set ($attributes = $group.Attributes)
#if ($attributes && !$attributes.isEmpty() && $group.isVisible4User($user))
<h4>$group.Name #if ($isEditAttributes)#asterisk()#end</h4>
@@ -86,8 +86,10 @@
#foreach ($att in $attributes)
#set ($rma = $module.getRModuleAttribute($att, $issueType))
#if ($rma.Active)
+
#set ($attVal = $attrValues.get($att.getName().toUpperCase()))
#set ($attrInput = $intake.AttributeValue.mapTo($attVal))
+
#if ($att.AttributeType.ValidationKey)
#set ($field = $attVal.Attribute.AttributeType.ValidationKey)
#elseif ($att.isOptionAttribute())
@@ -95,24 +97,43 @@
#else
#set ($field = "Value")
#end
- #if ($isEditAttributes)
- #set ($fieldSize = 0)
- #set ($fieldSize = $!attVal.Attribute.FieldSize)
- #set ($fieldHint = "")
- #set ($fieldHint = $!attVal.Attribute.Hint)
- #set ($fieldExtraHeader = "")
- #if ($!attVal.Attribute.Description.startsWith("hint:"))
- #set ($fieldExtraHeader = "$!attVal.Attribute.Description.substring(5)")
+
+ #set ($fieldSize = 0)
+ #set ($fieldSize = $!attVal.Attribute.FieldSize)
+ #set ($fieldHint = "")
+ #set ($fieldHint = $!attVal.Attribute.Hint)
+ #set ($fieldStyle = "")
+ #set ($fieldStyle = $!attVal.Attribute.Style)
+
+ #set ($fieldExtraHeader = "")
+ #if ($!attVal.Attribute.Description.startsWith("hint:"))
+ #set ($fieldExtraHeader = "$!attVal.Attribute.Description.substring(5)")
+ #end
+
+ #set ($isHidden = !( $currentIssue.isRequiredAttributeFor($att, $user) || $rma.Visible ) )
+ #set ($index = $rma.DisplayValue.indexOf("append:") + 7)
+ #if ($linecount > 0 && $index > 6)
+ #set ($displayValue = $rma.DisplayValue.substring($index))
+ #else
+ #set ($displayValue = $rma.DisplayValue)
+ #end
+
+ #set ($display = true)
+ #set ($isOptionAttr = $attVal.Attribute.isOptionAttribute())
+ #if ($isOptionAttr)
+ #set ($fieldStyle = $!attVal.AttributeOption.Style)
+ #if ($attVal.AttributeOption.Deleted.toString().equals("true"))
+ #set ($display = false)
#end
+ #end
+
+ #if ($isEditAttributes)
- #set ($index = $rma.DisplayValue.indexOf("append:") + 7)
#if ($linecount > 0 && $index > 6)
- #set ($displayValue = $rma.DisplayValue.substring($index))
#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)
#if ($linecount > 0)
</td>
</tr>
@@ -128,7 +149,7 @@
<td>
#set ($newline = false)
#end
- <span style="white-space:nowrap;display:inline;margin-left:0px; margin-right:0px;width:95%;">
+ <span style="white-space:nowrap;display:inline;margin-left:0px; margin-right:10px;width:95%;">
#if ($att.isOptionAttribute())
#attrValueLeafSelect ($attVal $field "" false $attVal.isRequired())
#attrValueErrorMsg ($attVal $field)
@@ -145,59 +166,60 @@
#end
#elseif ($attVal.isSet())
-
- #set ($displayValue = $attVal.RModuleAttribute.DisplayValue)
- #set ($index = $displayValue.indexOf(":") + 1)
- #if ($index > 1)
- #set ($displayValue = $displayValue.substring($index))
- #end
-
-
- #set ($display = true)
- #set ($isOptionAttr = $attVal.Attribute.isOptionAttribute())
- #set ($fieldStyle = "")
- #set ($fieldStyle = $!attVal.Attribute.Style)
- #if ($isOptionAttr)
- #set ($fieldStyle = $!attVal.AttributeOption.Style)
- #if ($attVal.AttributeOption.Deleted.toString().equals("true"))
- #set ($display = false)
- #end
- #end
#if ($display)
- <tr>
- <th>$displayValue</th>
- <td $fieldStyle >
- #set ($attrInput = $intake.AttributeValue.mapTo($attVal))
-
- ## Output the value of the attribute. How this is done
- ## depends on the attribute type.
- #if ($isOptionAttr)
- #if (!$attVal.AttributeOption)
+ #if ($linecount > 0 && $index > 6)
+ #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%;">$displayValue</span>
+ #else
+ #if ($linecount > 0)
+ </td>
+ </tr>
+ #end
+ #set ($linecount = $linecount + 1)
+ <tr>
+ <th>
+ <span style="white-space:nowrap;display:inline;margin-left:0px; margin-right:0px;width:95%;">$displayValue</span>
+ #if($fieldExtraHeader)
+ <pre>$fieldExtraHeader</pre>
+ #end
+ </th>
+ <td $fieldStyle>
+ #set ($newline = false)
+ #end
+ <span style="white-space:nowrap;display:inline;margin-left:0px; margin-right:10px;width:95%;">
+ #if ($att.isOptionAttribute())
+ #if (!$attVal.AttributeOption)
--
- #else
+ #else
#if ($module.getRModuleOption($attVal.AttributeOption, $issueType).Active)
$!module.getRModuleOption($attVal.AttributeOption, $issueType).DisplayValue
#else
[I]$!module.getRModuleOption($attVal.AttributeOption, $issueType).DisplayValue
#end
- #end
- #elseif ($att.AttributeType.Name == "long-string")
- ## Convert the raw text to formatted HTML before
- ## displaying it.
- $!scarabG.textToHTML($attrInput.Value.toString(), $link, $scarabR.CurrentModule)
- #elseif ($att.AttributeType.Name == "date")
- $scarabR.formatDate($!attrInput.Value.value)
- #elseif ($att.AttributeType.Name == "integer")
- $!attrInput.NumericValue.value
- #else
- ## Just output the raw value directly.
- $!attrInput.Value
#end
- </td>
- </tr>
- #end
+ #elseif ($att.AttributeType.Name == "long-string")
+ ## Convert the raw text to formatted HTML before
+ ## displaying it.
+ $!scarabG.textToHTML($attrInput.Value.toString(), $link, $scarabR.CurrentModule)
+ #elseif ($att.isIntegerAttribute())
+ #attrValueErrorMsg($attVal "NumericValue")
+ #attrValueText($attVal $attrInput.NumericValue $fieldSize $fieldHint)
+ #elseif ($att.AttributeType.Name == "date")
+ $scarabR.formatDate($!attrInput.Value.value)
+ #elseif ($att.AttributeType.Name == "integer")
+ $!attrInput.NumericValue.value
+ #else
+ ## Just output the raw value directly.
+ $!attrInput.Value
+ #end
+ </span>
+ #if ($linecount > 0 && $index > 6)
+ </span>
+ #end
+ #end
#end
-
+
#else
#set ($allAttrValues = $currentIssue.getModuleAttributeValuesMap(false))
#set ($attVal = $allAttrValues.get($att.getName().toUpperCase()))
------------------------------------------------------
http://scarab.tigris.org/ds/viewMessage.do?dsForumId=3577&dsMessageId=2372164