Scarab commit: svn commit: r10777 - trunk/src: java/org/tigris/scarab/om webapp/WEB-INF/templates/layouts webapp/WEB-INF/templates/macros webapp/scripts webapp/skins
Hussayn Dabbous <[email protected]>
| Newsgroups | gmane.comp.java.scarab.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: dabbous
Date: 2009-07-10 08:56:25-0700
New Revision: 10777
Modified:
trunk/src/java/org/tigris/scarab/om/AbstractScarabModule.java
trunk/src/webapp/WEB-INF/templates/layouts/Default.vm
trunk/src/webapp/WEB-INF/templates/macros/GlobalMacros.vm
trunk/src/webapp/scripts/sstree.js
trunk/src/webapp/skins/custom.css
Log:
SCB2979: Introducing a treeview based Attribute options hierarchy (work in progress)
Modified: trunk/src/java/org/tigris/scarab/om/AbstractScarabModule.java
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/java/org/tigris/scarab/om/AbstractScarabModule.java?view=diff&pathrev=10777&r1=10776&r2=10777
==============================================================================
--- trunk/src/java/org/tigris/scarab/om/AbstractScarabModule.java (original)
+++ trunk/src/java/org/tigris/scarab/om/AbstractScarabModule.java 2009-07-10 08:56:25-0700
@@ -47,46 +47,43 @@
*/
// JDK classes
-import com.workingdogs.village.DataSetException;
-import java.util.List;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.Collections;
import java.util.ArrayList;
-import java.util.Map;
+import java.util.Collections;
import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
import java.util.Locale;
+import java.util.Map;
import java.util.Vector;
+import org.apache.fulcrum.localization.Localization;
+import org.apache.fulcrum.security.entity.Group;
import org.apache.regexp.RECompiler;
import org.apache.regexp.REProgram;
import org.apache.regexp.RESyntaxException;
-import com.workingdogs.village.Record;
-
-// Turbine classes
import org.apache.torque.NoRowsException;
import org.apache.torque.TorqueException;
+import org.apache.torque.manager.MethodResultCache;
+import org.apache.torque.om.BaseObject;
import org.apache.torque.om.ComboKey;
import org.apache.torque.om.SimpleKey;
-import org.apache.torque.om.BaseObject;
-import org.apache.torque.manager.MethodResultCache;
import org.apache.torque.util.Criteria;
-import org.apache.fulcrum.security.entity.Group;
-import org.apache.fulcrum.localization.Localization;
import org.apache.turbine.Turbine;
+import org.tigris.scarab.reports.ReportBridge;
+import org.tigris.scarab.services.cache.ScarabCache;
+import org.tigris.scarab.services.security.ScarabSecurity;
import org.tigris.scarab.tools.localization.L10NKey;
-
-// Scarab classes
import org.tigris.scarab.tools.localization.L10NKeySet;
import org.tigris.scarab.tools.localization.L10NMessage;
import org.tigris.scarab.tools.localization.Localizable;
+import org.tigris.scarab.util.ScarabConstants;
import org.tigris.scarab.util.ScarabException;
import org.tigris.scarab.util.ValidationException;
-import org.tigris.scarab.util.ScarabConstants;
-import org.tigris.scarab.services.security.ScarabSecurity;
-import org.tigris.scarab.services.cache.ScarabCache;
import org.tigris.scarab.workflow.WorkflowFactory;
-import org.tigris.scarab.reports.ReportBridge;
+
+import com.workingdogs.village.DataSetException;
+import com.workingdogs.village.Record;
/**
* <p>
@@ -1535,6 +1532,54 @@
return moduleOptions;
}
+
+ public String getOptionsTreeAsJSON(Attribute attribute, IssueType issueType, boolean activeOnly) throws TorqueException {
+ List<RModuleOption> moduleOptions = (List<RModuleOption>) getRModuleOptions(attribute, issueType, activeOnly);
+ if (moduleOptions == null) {
+ return null;
+ }
+
+ StringBuffer json = new StringBuffer("{ 'optionId' : 0, 'displayValue' : 'root', '_children': [");
+
+ boolean first = true;
+
+ for (RModuleOption moduleOption : moduleOptions) {
+ if (moduleOption.getAttributeOption().getAncestors().size() == 1) {
+ if (!first) {
+ json.append(", ");
+ }
+ json.append(this.getModuleOptionAsJSON(moduleOption));
+ first = false;
+ }
+ }
+
+ json.append("]}");
+
+ return json.toString();
+ }
+
+ private String getModuleOptionAsJSON(RModuleOption moduleOption) throws TorqueException {
+ StringBuffer json = new StringBuffer("{ 'optionId': ");
+ json.append(moduleOption.getOptionId());
+ json.append(", 'displayValue': '");
+ json.append(moduleOption.getDisplayValue());
+ json.append("', '_children': [");
+
+ boolean first = true;
+
+ for (RModuleOption rmo : (List<RModuleOption>) moduleOption.getDescendants(moduleOption.getIssueType())) {
+ if (!first) {
+ json.append(", ");
+ }
+ json.append(this.getModuleOptionAsJSON(rmo));
+ first = false;
+ }
+
+ json.append("]}");
+
+ return json.toString();
+ }
+
/**
* This method is implemented in ScarabModule
Modified: trunk/src/webapp/WEB-INF/templates/layouts/Default.vm
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/webapp/WEB-INF/templates/layouts/Default.vm?view=diff&pathrev=10777&r1=10776&r2=10777
==============================================================================
--- trunk/src/webapp/WEB-INF/templates/layouts/Default.vm (original)
+++ trunk/src/webapp/WEB-INF/templates/layouts/Default.vm 2009-07-10 08:56:25-0700
@@ -1,316 +1,321 @@
-<!DOCTYPE html PUBLIC "-//Tigris//DTD XHTML 1.0 Transitional//EN"
- "$staticLink.setPath("/style/tigris_transitional.dtd")">
-<html>
- <head>
- #if ($currentIssue)
- ## Use the current issue ID for the page title
- #set ($title = $currentIssue.UniqueId)
- #end
- <title>${l10n.ScarabWordMark}#if ($title): ${title}#end</title>
- <meta http-equiv="Content-type" content="$data.ContentType" />
- <link rel="shortcut icon" href="/scarab/images/favicon.ico" type="image/x-icon" />
- <link rel="icon" type="image/x-icon" href="/scarab/images/favicon.ico" />
- #if ($updateFrequency && $updateFrequency.length() > 0)
- <meta http-equiv="refresh" content="$updateFrequency" />
- #end
- <link rel="stylesheet" type="text/css" href="$staticLink.setPath("/skins/classic.css")" />
- <link rel="stylesheet" type="text/css" href="$staticLink.setPath("/skins/custom.css")" />
-
- <script src="$staticLink.setPath("/scripts/debug.js")" type="text/javascript"></script>
- <script src="$staticLink.setPath("/scripts/inputs.js")" type="text/javascript"></script>
- <script src="$staticLink.setPath("/scripts/main.js")" type="text/javascript"></script>
- <script src="$staticLink.setPath("/scripts/CalendarPopup.js")"></script>
- <script src="$staticLink.setPath("/scripts/sstree.js")"></script>
- <script src="$staticLink.setPath("/scripts/tooltips.js")"></script>
- <script src="$staticLink.setPath("/scripts/guiUtils.js")"></script>
-
- <script language="Javascript" id="js1">
- var calPopup = new CalendarPopup("datePopupDiv");
- calPopup.showNavigationDropdowns();
- calPopup.setMonthNames("$l10n.January", "$l10n.February", "$l10n.March", "$l10n.April", "$l10n.May", "$l10n.June", "$l10n.July", "$l10n.August", "$l10n.September", "$l10n.October", "$l10n.November", "$l10n.December");
- calPopup.setWeekStartDay($l10n.DateFirstWeekDay);
- calPopup.setDayHeaders($l10n.DateWeekDays);
- calPopup.setTodayText("$l10n.DateToday");
- calPopup.setCleanText("$l10n.DateClean");
- </script>
-
- #set ($hide_bars = $scarabG.getTurbineConfiguration().getString("scarab.dhtml.hide_bars").toLowerCase().equals("true"))
- #set ($autoresize = $scarabG.getTurbineConfiguration().getString("scarab.dhtml.autoresize_textarea").toLowerCase().equals("true"))
- #set ($iconCollapse="/images/icon_expand3.gif")
- #set ($iconExpand="/images/icon_collapse3.gif")
-
- <script src="$staticLink.setPath("/scripts/scarabutil.js")"></script>
- <script language="Javascript">
-
- function hideScarableftNav() {
- document.getElementById('leftcol').style.display="none"
- #if ($scarabR.CurrentModule)
- document.getElementById('closing-slider').style.display="none"
- #end
- document.getElementById('showleftcol').style.display=""
- setCookieScarableftNav("ScarableftNav","0")
- }
-
- function showScarableftNav() {
- document.getElementById('leftcol').style.display=""
- #if ($scarabR.CurrentModule)
- document.getElementById('closing-slider').style.display=""
- #end
- document.getElementById('showleftcol').style.display="none"
- setCookieScarableftNav("ScarableftNav","1")
- }
-
- function initializeAll() {
- #if ($hide_bars)
- setLeftcolAndBanner()
- #end
- #if ($autoresize)
- initialRows()
- #end
- initializeTreeview()
- }
- </script>
-
- </head>
-
-
- ################################################################
- ## Top row
- ################################################################
- <body marginwidth="0"
- marginheight="0"
- class="scb_page"
- #if($hide_bars || $autoresize) onload="initializeAll()" #else onload="initializeTreeview()" #end>
-
-
- <div id="datePopupDiv" class="scb_calendar"></div>
-
- ################################################################
- ## The banner row
- ################################################################
-
- <div id="scb_banner" #if($hide_bars) ondblclick="hideBanner()" #end>
- <table>
- <tr>
- <td>
- <a href="$link.setPage("Index.vm")"><img src="$staticLink.setPath("/images/logo.gif")" alt="Scarab" width="118" height="23" border="0" /></a>
- </td>
- <td valign="middle">
- <table border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td>$scarabG.SiteName</td>
- <td>
- #if($scarabG.SiteLogo.trim().length() > 0)
- <img hspace="10"
- src="$staticLink.setPath("$scarabG.SiteLogo")"
- border="0"/>
- #end
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </div>
-
- #########################################################################
- ## Bread crumb row, only when logged in ??
- #########################################################################
- #if ($data.User.hasLoggedIn())
- <div id="breadcrumbs" #if($hide_bars) ondblclick="showBanner()" #end>
- <table border="0" cellspacing="0" cellpadding="4" width="100%">
- <tr>
- <td class="location">
- #if ($scarabR.CurrentModule)
- $scarabR.CurrentModule.Name
- #set ($currentIssueId = $data.parameters.getString('id', ''))
- #if ($currentIssueId != '')
- #set ($currentIssue = $scarabR.getIssue($currentIssueId))
- #if ($currentIssue)
- > <span class="issueId">$l10n.Issue $currentIssue.UniqueId:</span>
- (<span class="issueText">$currentIssue.DefaultText</span>)
- #end
- #end
- #end
- </td>
-
- <td>
- <div align="right">
- <div>
- #if ($data.User.isUserAnonymous())
- #if ($currentIssueId && ($currentIssueId.length()>0) )
- $link.omitModule().setPage("Login.vm").setAction("Logout").setLabel("$l10n.Login").setPathInfo("viewIssueId", $currentIssueId)
- #else
- $link.omitModule().setPage("Login.vm").setAction("Logout").setLabel("$l10n.Login")
- #end
- #else
- <span class="logout">$link.omitModule().setPage("Login.vm").setAction("Logout").setLabel("$l10n.Logout")</span>
- <span class="username">$!data.User.FirstName $!data.User.LastName
- #set ($roleNames = $!data.User.currentRoleNames)
- #set ($roleCounter = 0)
- #if ($roleNames.size() >0)
- (#foreach ($roleName in $roleNames)#if ($roleCounter > 0)|#end#set ($roleCounter=$roleCounter+1)$roleName#end)
- #end
- </span>
- #end
- </div>
- </div>
- </td>
-
- <td width="1">
- <img src="$staticLink.setPath('/images/icon_help_sml.gif')"
- onClick="showDelayedTooltip('scarab.help',0)"
- >
- <div class="scarab-tooltip" id="scarab.help" onclick="hideTooltip()">
- <div class="scarab-toolgroup">
- <div class="label"><strong>$l10n.HowDoI</strong></div>
- <div class="body">
- $renderer.render("navigations", "Help.vm")
- </div>
- </div>
- </div>
- </td>
-
- </tr>
- </table>
- </div>
- #end
-
- #######################################################################
- ## Main Canvas
- #######################################################################
-
- <table width="100%"
- height="100%"
- style="height:100%;"
- cellspacing="0"
- cellpadding="0"
- id="main">
-
- <tr valign="top">
-
-
- ######
- ## The clickable left column
- ######
- <td height="100%"
- #if ($scarabR.CurrentModule)
- background="$staticLink.setPath("/images/opening-separator.gif")"
- #end
- style="height:100%;background-image:url($staticLink.setPath("/images/opening-separator.gif"));"
- id="showleftcol"
- #if($hide_bars) onclick="showScarableftNav()" #end>
- <table height="100%"
- style="height:100%;"
- border="0"
- cellpadding="0"
- cellspacing="0">
- <tr>
- <td>
- #if($hide_bars)
- <img style="margin-left:0px; margin-top:50px;" src="$staticLink.setPath("/images/opening-slider.gif")" border="0"/>
- #end
- </td>
- </tr>
- </table>
- </td>
-
- ######
- ## The navigation column
- ######
- <td width="1"
- id="leftcol"
- style="height:100%;" >
- <table height="100%"
- border="0"
- cellspacing="0"
- cellpadding="0"
- style="height:100%;">
- <tr>
- <td>
- <div id="navcolumn" style="margin:4px;height:100%">
- <div style="text-align:left;white-space:nowrap;height:100%">
- $renderer.render("navigations", $template, "Default.vm")
- </div>
-
- ## This is temporary: Control whether to place an issue
- ## navigation box into the left navigation column of the
- ## screen. If the left navigation bar survives the ongoing
- ## layout transition, we should think about a more general
- ## approach.[HD]
- #if ($currentIssue)
- #viewIssueTab()
-
- #if ($tab.equals("all"))
- <div style="white-space:nowrap;height:100%">
- $renderer.render("navigations", "Issue.vm")
- </div>
- #end
- #end
- ## End of issue navigation bar calculations
- </div>
- </td>
- </tr>
- </table>
- </td>
-
- #if ($scarabR.CurrentModule && $hide_bars)
- <td style="height:100%;background-repeat:repeat-y;background-image:url($staticLink.setPath("/images/closing-separator.gif"));"
- #if($hide_bars) onclick="hideScarableftNav()" #end
- id="closing-slider"
- >
- <img style="margin-left:0px; margin-top:50px;" src="$staticLink.setPath("/images/closing-slider.gif")" border="0"/>
- </td>
- #end
-
- <td width="100%">
- <table width="100%" cellspacing="0" cellpadding="0">
- <tr>
-
- ######
- ## The main canvas column
- ######
- <td width="*" >
- #if (!$data.Parameters.getString("nonav") && !$data.Parameters.getString("nosearchnav"))
- $renderer.render("navigations", "SearchNav.vm")
- #end
- <div id="bodycol">
- <!-- Scarab - App -->
- $renderer.render("layouts", "MainContent.vm")
- <!-- Structural Elements -->
- </div>
- </td>
-
- #######
- ## The initial hint column (only rendered in SelectModule.vm)
- #######
- #if ($template.equals("SelectModule.vm"))
- <td id="rightcol" width="20%" >
- $renderer.render("layouts", "/ModuleHelp.vm")
- </td>
- #end
-
- </tr>
- </table>
- </td>
- </tr>
- </table>
- #############################################################
- ## End of canvas
- #############################################################
-
- #############################################################
- ## functional buttons
- #############################################################
- $renderer.render("navigations", "/ScarabBottom.vm")
-
- <script language="Javascript">
- // Sticky navigation is not yet fully implemented.
- // Therefore the statement below is currently
- // commented out.[HD]
- // stickyNavigationBar();
- </script>
-
-
-</body>
-</html>
+<!DOCTYPE html PUBLIC "-//Tigris//DTD XHTML 1.0 Transitional//EN"
+ "$staticLink.setPath("/style/tigris_transitional.dtd")">
+<html>
+ <head>
+ #if ($currentIssue)
+ ## Use the current issue ID for the page title
+ #set ($title = $currentIssue.UniqueId)
+ #end
+ <title>${l10n.ScarabWordMark}#if ($title): ${title}#end</title>
+ <meta http-equiv="Content-type" content="$data.ContentType" />
+ <link rel="shortcut icon" href="/scarab/images/favicon.ico" type="image/x-icon" />
+ <link rel="icon" type="image/x-icon" href="/scarab/images/favicon.ico" />
+ #if ($updateFrequency && $updateFrequency.length() > 0)
+ <meta http-equiv="refresh" content="$updateFrequency" />
+ #end
+ <link rel="stylesheet" type="text/css" href="$staticLink.setPath("/skins/classic.css")" />
+ <link rel="stylesheet" type="text/css" href="$staticLink.setPath("/skins/custom.css")" />
+
+ <script src="$staticLink.setPath("/scripts/debug.js")" type="text/javascript"></script>
+ <script src="$staticLink.setPath("/scripts/inputs.js")" type="text/javascript"></script>
+ <script src="$staticLink.setPath("/scripts/main.js")" type="text/javascript"></script>
+ <script src="$staticLink.setPath("/scripts/CalendarPopup.js")"></script>
+ <script src="$staticLink.setPath("/scripts/sstree.js")"></script>
+ <script src="$staticLink.setPath("/scripts/tooltips.js")"></script>
+ <script src="$staticLink.setPath("/scripts/guiUtils.js")"></script>
+
+ <script language="Javascript" id="js1">
+ var calPopup = new CalendarPopup("datePopupDiv");
+ calPopup.showNavigationDropdowns();
+ calPopup.setMonthNames("$l10n.January", "$l10n.February", "$l10n.March", "$l10n.April", "$l10n.May", "$l10n.June", "$l10n.July", "$l10n.August", "$l10n.September", "$l10n.October", "$l10n.November", "$l10n.December");
+ calPopup.setWeekStartDay($l10n.DateFirstWeekDay);
+ calPopup.setDayHeaders($l10n.DateWeekDays);
+ calPopup.setTodayText("$l10n.DateToday");
+ calPopup.setCleanText("$l10n.DateClean");
+ </script>
+
+ #set ($hide_bars = $scarabG.getTurbineConfiguration().getString("scarab.dhtml.hide_bars").toLowerCase().equals("true"))
+ #set ($autoresize = $scarabG.getTurbineConfiguration().getString("scarab.dhtml.autoresize_textarea").toLowerCase().equals("true"))
+ #set ($iconCollapse="/images/icon_expand3.gif")
+ #set ($iconExpand="/images/icon_collapse3.gif")
+
+ <script src="$staticLink.setPath("/scripts/scarabutil.js")"></script>
+ <script language="Javascript">
+
+ function hideScarableftNav() {
+ document.getElementById('leftcol').style.display="none"
+ #if ($scarabR.CurrentModule)
+ document.getElementById('closing-slider').style.display="none"
+ #end
+ document.getElementById('showleftcol').style.display=""
+ setCookieScarableftNav("ScarableftNav","0")
+ }
+
+ function showScarableftNav() {
+ document.getElementById('leftcol').style.display=""
+ #if ($scarabR.CurrentModule)
+ document.getElementById('closing-slider').style.display=""
+ #end
+ document.getElementById('showleftcol').style.display="none"
+ setCookieScarableftNav("ScarableftNav","1")
+ }
+
+ function initializeAll() {
+ #if ($hide_bars)
+ setLeftcolAndBanner()
+ #end
+ #if ($autoresize)
+ initialRows()
+ #end
+ initializeTreeview()
+ }
+ </script>
+
+ </head>
+
+
+ ################################################################
+ ## Top row
+ ################################################################
+ <body marginwidth="0"
+ marginheight="0"
+ class="scb_page"
+ #if($hide_bars || $autoresize) onload="initializeAll()" #else onload="initializeTreeview()" #end>
+
+
+ <div id="datePopupDiv" class="scb_calendar"></div>
+
+ ################################################################
+ ## The banner row
+ ################################################################
+
+ <div id="scb_banner" #if($hide_bars) ondblclick="hideBanner()" #end>
+ <table>
+ <tr>
+ <td>
+ <a href="$link.setPage("Index.vm")"><img src="$staticLink.setPath("/images/logo.gif")" alt="Scarab" width="118" height="23" border="0" /></a>
+ </td>
+ <td valign="middle">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td>$scarabG.SiteName</td>
+ <td>
+ #if($scarabG.SiteLogo.trim().length() > 0)
+ <img hspace="10"
+ src="$staticLink.setPath("$scarabG.SiteLogo")"
+ border="0"/>
+ #end
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </div>
+
+ #########################################################################
+ ## Bread crumb row, only when logged in ??
+ #########################################################################
+ #if ($data.User.hasLoggedIn())
+ <div id="breadcrumbs" #if($hide_bars) ondblclick="showBanner()" #end>
+ <table border="0" cellspacing="0" cellpadding="4" width="100%">
+ <tr>
+ <td class="location">
+ #if ($scarabR.CurrentModule)
+ $scarabR.CurrentModule.Name
+ #set ($currentIssueId = $data.parameters.getString('id', ''))
+ #if ($currentIssueId != '')
+ #set ($currentIssue = $scarabR.getIssue($currentIssueId))
+ #if ($currentIssue)
+ > <span class="issueId">$l10n.Issue $currentIssue.UniqueId:</span>
+ (<span class="issueText">$currentIssue.DefaultText</span>)
+ #end
+ #end
+ #end
+ </td>
+
+ <td>
+ <div align="right">
+ <div>
+ #if ($data.User.isUserAnonymous())
+ #if ($currentIssueId && ($currentIssueId.length()>0) )
+ $link.omitModule().setPage("Login.vm").setAction("Logout").setLabel("$l10n.Login").setPathInfo("viewIssueId", $currentIssueId)
+ #else
+ $link.omitModule().setPage("Login.vm").setAction("Logout").setLabel("$l10n.Login")
+ #end
+ #else
+ <span class="logout">$link.omitModule().setPage("Login.vm").setAction("Logout").setLabel("$l10n.Logout")</span>
+ <span class="username">$!data.User.FirstName $!data.User.LastName
+ #set ($roleNames = $!data.User.currentRoleNames)
+ #set ($roleCounter = 0)
+ #if ($roleNames.size() >0)
+ (#foreach ($roleName in $roleNames)#if ($roleCounter > 0)|#end#set ($roleCounter=$roleCounter+1)$roleName#end)
+ #end
+ </span>
+ #end
+ </div>
+ </div>
+ </td>
+
+ <td width="1">
+ <img src="$staticLink.setPath('/images/icon_help_sml.gif')"
+ onClick="showDelayedTooltip('scarab.help',0)"
+ >
+ <div class="scarab-tooltip" id="scarab.help" onclick="hideTooltip()">
+ <div class="scarab-toolgroup">
+ <div class="label"><strong>$l10n.HowDoI</strong></div>
+ <div class="body">
+ $renderer.render("navigations", "Help.vm")
+ </div>
+ </div>
+ </div>
+ </td>
+
+ </tr>
+ </table>
+ </div>
+ #end
+
+ #######################################################################
+ ## Main Canvas
+ #######################################################################
+
+ <table width="100%"
+ height="100%"
+ style="height:100%;"
+ cellspacing="0"
+ cellpadding="0"
+ id="main">
+
+ <tr valign="top">
+
+
+ ######
+ ## The clickable left column
+ ######
+ <td height="100%"
+ #if ($scarabR.CurrentModule)
+ background="$staticLink.setPath("/images/opening-separator.gif")"
+ #end
+ style="height:100%;background-image:url($staticLink.setPath("/images/opening-separator.gif"));"
+ id="showleftcol"
+ #if($hide_bars) onclick="showScarableftNav()" #end>
+ <table height="100%"
+ style="height:100%;"
+ border="0"
+ cellpadding="0"
+ cellspacing="0">
+ <tr>
+ <td>
+ #if($hide_bars)
+ <img style="margin-left:0px; margin-top:50px;" src="$staticLink.setPath("/images/opening-slider.gif")" border="0"/>
+ #end
+ </td>
+ </tr>
+ </table>
+ </td>
+
+ ######
+ ## The navigation column
+ ######
+ <td width="1"
+ id="leftcol"
+ style="height:100%;" >
+ <table height="100%"
+ border="0"
+ cellspacing="0"
+ cellpadding="0"
+ style="height:100%;">
+ <tr>
+ <td>
+ <div id="navcolumn" style="margin:4px;height:100%">
+ <div style="text-align:left;white-space:nowrap;height:100%">
+ $renderer.render("navigations", $template, "Default.vm")
+ </div>
+
+ ## This is temporary: Control whether to place an issue
+ ## navigation box into the left navigation column of the
+ ## screen. If the left navigation bar survives the ongoing
+ ## layout transition, we should think about a more general
+ ## approach.[HD]
+ #if ($currentIssue)
+ #viewIssueTab()
+
+ #if ($tab.equals("all"))
+ <div style="white-space:nowrap;height:100%">
+ $renderer.render("navigations", "Issue.vm")
+ </div>
+ #end
+ #end
+ ## End of issue navigation bar calculations
+ </div>
+ </td>
+ </tr>
+ </table>
+ </td>
+
+ #if ($scarabR.CurrentModule && $hide_bars)
+ <td style="height:100%;background-repeat:repeat-y;background-image:url($staticLink.setPath("/images/closing-separator.gif"));"
+ #if($hide_bars) onclick="hideScarableftNav()" #end
+ id="closing-slider"
+ >
+ <img style="margin-left:0px; margin-top:50px;" src="$staticLink.setPath("/images/closing-slider.gif")" border="0"/>
+ </td>
+ #end
+
+ <td width="100%">
+ <table width="100%" cellspacing="0" cellpadding="0">
+ <tr>
+
+ ######
+ ## The main canvas column
+ ######
+ <td width="*" >
+ #if (!$data.Parameters.getString("nonav") && !$data.Parameters.getString("nosearchnav"))
+ $renderer.render("navigations", "SearchNav.vm")
+ #end
+ <div id="bodycol">
+ <!-- Scarab - App -->
+ #set ($attributeTreePopupHelper = [])
+ $renderer.render("layouts", "MainContent.vm")
+ <!-- Structural Elements -->
+ </div>
+ </td>
+
+ #######
+ ## The initial hint column (only rendered in SelectModule.vm)
+ #######
+ #if ($template.equals("SelectModule.vm"))
+ <td id="rightcol" width="20%" >
+ $renderer.render("layouts", "/ModuleHelp.vm")
+ </td>
+ #end
+
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ #############################################################
+ ## End of canvas
+ #############################################################
+
+ #############################################################
+ ## functional buttons
+ #############################################################
+ $renderer.render("navigations", "/ScarabBottom.vm")
+
+ <script language="Javascript">
+ // Sticky navigation is not yet fully implemented.
+ // Therefore the statement below is currently
+ // commented out.[HD]
+ // stickyNavigationBar();
+ </script>
+
+ ## render the popup used to display selection trees
+ #foreach ($attributeTreePopup in $attributeTreePopupHelper)
+ <script type="text/javascript">renderJSONTreePopup('$attributeTreePopup.get(0)', '$attributeTreePopup.get(1)', $attributeTreePopup.get(2));</script>
+ #end
+
+</body>
+</html>
\ No newline at end of file
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=10777&r1=10776&r2=10777
==============================================================================
--- trunk/src/webapp/WEB-INF/templates/macros/GlobalMacros.vm (original)
+++ trunk/src/webapp/WEB-INF/templates/macros/GlobalMacros.vm 2009-07-10 08:56:25-0700
@@ -1,1148 +1,1117 @@
-#macro (markup $type)
-#set ($pseudoHTML = $scarabG.getTurbineConfiguration().getString("system.mail.pseudohtml").toLowerCase().equals("true"))
-#if($pseudoHTML && $type=='b')*#end#if($pseudoHTML && $type=='u')_#end#if($pseudoHTML && $type=='i')/#end#if(!$pseudoHTML && $type=='s')****#end
-#end
-
-#macro (CanMakeTransitionForOption $fromValue $option $issue $multiple)
- #set ($selected = false)
- #set ($canMakeTransition = true)
- #if ($fromValue && $fromValue.toString() != '')
- #if (!$multiple.equals("true"))
- #if ($issue.isTemplate())
- #set ($canMakeTransition = $scarabG.Workflow.canMakeTransition($data.User, $scarabR.getAttributeOption("0"), $option.getAttributeOption(), $issue))
- #else
- #if ($issue.isNew())
- #set ($values = '0')
- #else
- #set ($values = $fromValue)
- #end
- #set ($canMakeTransition = $scarabG.Workflow.canMakeTransition($data.User, $scarabR.getAttributeOption($values), $option.getAttributeOption(), $issue))
- #end
- #end
- #else
- #set ($canMakeTransition = $scarabG.Workflow.canMakeTransition($data.User, $scarabR.getAttributeOption("0"), $option.getAttributeOption(), $issue))
- #end
-$canMakeTransition
-#end
-
-#macro (AllowedTransitionsForOption $attrValue $optionFieldName $size $multiple)
- #set ($count=0)
- #set ($attrInput = $intake.AttributeValue.mapTo($attrValue))
- #set ($attr = $attrValue.Attribute)
- #set ($issue = $attrValue.Issue)
- #set ($module = $issue.Module)
- #set ($issueType = $issue.IssueType)
- #if ($issueType.ParentId > 0)
- #set ($issueType = $issueType.IssueTypeForTemplateType)
- #end
- ## Initialize $newValues in case the second #set has a null RHS.
- #set ($newValues = '')
- #set ($newValues = $attrInput.get($optionFieldName).Value)
- #foreach ($option in $module.getOptionTree($attr, $issueType, false))
- #set ($canMakeTransition = "#CanMakeTransitionForOption ($newValues $option $issue $multiple)")
- #if ($canMakeTransition.trim()=="true")
- #set ($count=$count+1)
- #end
- #end
- $count
-#end
-
-#macro (attrValueLeafSelect $attrValue $optionFieldName $size $multiple $required)
- #set ($attrInput = $intake.AttributeValue.mapTo($attrValue))
- #set ($attr = $attrValue.Attribute)
- #set ($issue = $attrValue.Issue)
- #set ($module = $issue.Module)
- #set ($issueType = $issue.IssueType)
- #if ($issueType.ParentId > 0)
- #set ($issueType = $issueType.IssueTypeForTemplateType)
- #end
- ## Initialize $newValues in case the second #set has a null RHS.
- #set ($newValues = '')
- #set ($newValues = $attrInput.get($optionFieldName).Value)
- #set ( $count = "#AllowedTransitionsForOption ( $attrValue $optionFieldName $size $multiple )")
-
- #if ($count.trim() == "0" )
- <input type="hidden" name="$attrInput.get($optionFieldName).Key" value="$newValues"/>
- $newValues
- #elseif ($count.trim() == "1" )
-
- #foreach ($option in $module.getOptionTree($attr, $issueType, false))
- #set ($canMakeTransition = "#CanMakeTransitionForOption ($newValues $option $issue $multiple)")
-
- #if ($canMakeTransition.trim()=="true")
- #if ($templateInfo || (!$required && $newValues && $newValues.toString() == ''))
- <input type="hidden" name="$attrInput.get($optionFieldName).Key" value="$newValues"/>
- #if ($newValues > 0)
- #set ($checked = "checked")
- #end
- #set ($oc = "javascript:this.form.${attrInput.get($optionFieldName).Key}.value=(this.checked)?$option.OptionId:''")
- <input type="checkbox"
- name="${attrInput.get($optionFieldName).Key}_tmp"
- onclick="$oc" ${checked} />
- #else
- <input type="hidden" name="$attrInput.get($optionFieldName).Key" value="$option.optionId"/>
- #end
- #if ($option.Active)
- $option.DisplayValue
- #else
- [I] $option.DisplayValue
- #end
- #end
- #end
-
-
- #else
-
-
- <select name="$attrInput.get($optionFieldName).Key"
- #if($size.length())size="$size"#end #if($multiple.equals("true"))multiple="multiple"#end>
- #if ($size.length() == 0 && (!$required || $newValues == '' ))
- <option value="">$l10n.Choose</option>
- #end
- #foreach ($option in $module.getOptionTree($attr, $issueType, false))
- #set ($canMakeTransition = "#CanMakeTransitionForOption ($newValues $option $issue $multiple)")
-
- #if ($canMakeTransition.trim()=="true")
-
- #set ($selected = false)
- #if ($newValues && $newValues.toString() != '')
- #if ($multiple.equals("true"))
- #foreach ($value in $newValues)
- #if ($value.equals($option.OptionId))
- #set ($selected=true)
- #end
- #end
- #else
- #if ($newValues.equals($option.OptionId))
- #set ($selected=true)
- #end
- #end
- #end
-
- #if($selected)
- <option value="$option.OptionId"#selected($selected)>
- #foreach ($i in [0..$option.Level])#if($i != 0) #end#end
- #if ($option.Active)
- $option.DisplayValue</option>
- #else
- [I] $option.DisplayValue</option>
- #end
- #elseif($option.Active)
- <option value="$option.OptionId"#selected($selected)>
- #foreach ($i in [0..$option.Level])#if($i != 0) #end#end
- $option.DisplayValue</option>
- #end
- #end
- #end
- </select>
- #end
-#end
-
-#macro (templateAttrValueLeafSelect $attrValue $templAttrValue $optionFieldName $size $multiple)
- #set ($attrInput = $intake.AttributeValue.mapTo($attrValue))
- #set ($templAttrInput = $intake.AttributeValue.mapTo($templAttrValue))
- #set ($attr = $attrValue.Attribute)
- #set ($issue = $attrValue.Issue)
- #set ($module = $issue.Module)
- #if ($attrInput.get($optionFieldName).Value)
- #set($currentValue = $attrInput.get($optionFieldName).Value)
- #elseif ($templAttrInput.get($optionFieldName).Value)
- #set($currentValue = $templAttrInput.get($optionFieldName).Value)
- #end
-<select name="$attrInput.get($optionFieldName).Key"
- #if($size.length())size="$size"#end #if($multiple)multiple="multiple"#end>
- #if ($size.length() == 0)
- <option value="">$l10n.Choose</option>
- #end
- #foreach ($option in $module.getOptionTree($attr, $issue.IssueType))
- #set ($selected = false)
- #if ($currentValue && $option.OptionId == $currentValue)
- #set ($selected = true)
- #end
- #set ($canMakeTransition = true)
- #set ($canMakeTransition = $scarabG.Workflow.canMakeTransition($data.User, $scarabR.getAttributeOption("0"), $option.getAttributeOption(), $issue))
- #if ($canMakeTransition)
- <option value="$option.OptionId"#selected($selected)>
- #foreach ($i in [0..$option.Level])#if($i != 0) #end#end
- $option.DisplayValue</option>
- #end
- #end
-</select>
-#end
-
-#macro (dependTypeLeafSelect $childIssue $type)
-<select name="$type_depend_type_id_$childIssue.IssueId">
- <option>Choose dependency type</option>
- #foreach ($dependType in $currentIssue.getAllDependencyTypes())
- #if ($currentIssue.getDependency($childIssue).TypeId.toString().equals($dependType.DependTypeId.toString()))
- <option selected="selected" value="$dependType.DependTypeId">$dependType.Name</option>
- #else
- <option value="$dependType.DependTypeId">$dependType.Name</option>
- #end
- #end
- <option value="none">$l10n.RemoveDependency</option>
-</select>
-#end
-
-#macro (attrValueText $attrValue $size $hint)
-#set ($attrInput = $intake.AttributeValue.mapTo($attrValue))
- #if ($attVal.Attribute.AttributeType.Name == "long-string")
- #textAreaMedium("$attrInput.Value.Key" $attrInput.Value)
- #elseif ($attVal.Attribute.AttributeType.Name == "date")
- #if ($scarabG.getTurbineConfiguration().getString("scarab.datefields.editable") == "false")
- #set ($readonly = "readonly")
- #else
- #set ($readonly = "")
- #end
- #set ($ref = $attrInput.Value.Key)
- #set ($datevalue = $scarabR.formatDate($attrInput.Value.value))
- <input
- type="text"
- id="$ref"
- name="$ref"
- $readonly
- value="$datevalue"
- size="20" />
- <a
- id="dateAnchor$ref"
- name="dateAnchor$ref"
- href="javascript:;"
- onClick="calPopup.select(document.getElementById('$ref'),'dateAnchor$ref','$l10n.ShortDatePattern');return false;">
- <img src="$staticLink.setPath('/images/date.gif')" border="0"/>
- </a>
- #else
- #if ($attVal.Attribute.AttributeType.Name == "integer")
- #set ( $fieldName = $attrInput.NumericValue.Key )
- #set ( $fieldValue= $!attrInput.NumericValue )
- #else
- #set ( $fieldName = $attrInput.Value.Key )
- #set ( $fieldValue= $!attrInput.Value )
- #end
- #* #if ($fieldValue.toString().equals("")) #set ($fieldValue = $hint) #end *#
- <input
- type="text"
- name="$fieldName"
- value="$fieldValue"
- #if($size > 0) size="$size" #else class="fullWidth" #end />
- #if ( !$fieldValue.toString().equals($hint) ) <span class="hint">$hint</span> #end
-
- #end
-#end
-
-#macro (templateAttrValueText $attrValue $size $templAttrValue)
-#set ($attrInput = $intake.AttributeValue.mapTo($attrValue))
-#set ($value = $templAttrValue.Value)
-#set ($currentValue = "")
-#if ($attrInput.Value.toString().length() > 0)
- #set ($currentValue = $attrInput.Value)
-#elseif ($value.length() > 0)
- #set ($currentValue = $value)
-#end
-#if ($attVal.Attribute.AttributeType.Name == "long-string")
- #textAreaMedium("$attrInput.Value.Key" $currentValue)
-#else
- <input class="fullWidth" type="text" name="$attrInput.Value.Key" value="$!currentValue" />
-#end
-#end
-
-#macro (attrValueHierarchySelect $attrValue $optionFieldName $size $multiple)
-#set ($attrInput = $intake.AttributeValue.mapTo($attrValue))
-#set ($attr = $attrValue.Attribute)
-#set ($module = $attrValue.Issue.Module)
-## initialize in case the second #set has null RHS
-#set ($values = "")
-#set ($values = $attrInput.get($optionFieldName).Value)
-#set ($selectedEmpty=false)
-#foreach ($value in $values)
- #if ($value.intValue()==0)
- #set ($selectedEmpty=true)
- #end
-#end
-<select name="$attrInput.get($optionFieldName).Key"
-#if($size.length() != 0)size="$size"#end #if($multiple)multiple="multiple"#end>
- #if($size.length() == 0 || $size == "1")
- <option value="">$l10n.Choose</option>
- #end
- <option value="0" #if ($selectedEmpty) selected="selected"#end>$l10n.EmptyOption</option>
- #foreach ($option in $module.getOptionTree($attr, $attrValue.Issue.IssueType))
- #set ($selected = false)
- #if ($values && $values.toString().length() > 0)
- #if ($multiple.toString().equals("true"))
- #foreach ($value in $values)
- #if ($value.equals($option.OptionId))
- #set ($selected=true)
- #end
- #end
- #else
- #if ($values.equals($option.OptionId))
- #set ($selected=true)
- #end
- #end
- #end
- <option value="$option.OptionId"#selected($selected)>
-#foreach ($i in [0..$option.Level])#if($i != 0) #end#end
- $option.DisplayValue</option>
- #end
-</select>
-#end
-
-#macro (attrValueErrorMsg $attrValue $fieldName)
- #set ($attrInput = $intake.AttributeValue.mapTo($attrValue))
- #if (!$attrInput.get($fieldName).isValid())
- <p class="warningmark">
- ## we ignore the missing resource error because there is no easy way yet
- ## to provide a parameterized message here. In this situation the java code
- ## (action or screen class) performs the parameterized localization and the
- ## line below should simply redisplay the key.
- <strong>$l10n.getIgnoreMissingResource($attrInput.get($fieldName).Message)</strong>
- </p>
- #end
-#end
-
-#macro (confirm $text)
- <p class="donemark"><em>$text</em></p>
-#end
-
-#macro (info $text)
- <p class="infomark"><em>$text</em></p>
-#end
-
-#macro (alert $text)
- <p><strong><pre class="warningmark">$l10n.Alert $text</pre></strong></p>
-#end
-
-#macro (fieldErrorMsg $field $br)
-#if ($field && $field.Message.length() > 0 && !$field.isValid())
-<p class="warningmark"><strong>$l10n.get($field.Message)</strong></p>$br
-#end
-#end
-
-#macro (fieldHint $field)
-#if ($field && $field.Message.length() > 0 && !$field.isValid())
-<div class="warningmark"><strong>$l10n.get($field.Message)</strong></div>
-#end
-#end
-
-
-#macro (actionMessage)
-#if ($data.Message)
- #confirm($data.Message)
-#end
-#if($scarabR.ConfirmMessage)
- #confirm($scarabR.ConfirmMessage)
-#end
-#if($scarabR.InfoMessage)
- #info($scarabR.InfoMessage)
-#end
-#if($scarabR.AlertMessage)
- #alert($scarabR.AlertMessage)
-#end
-#end
-
-#macro (stdIntakeMsg)
-#if (!$intake.isAllValid())
-<p class="warningmark"><strong>$l10n.CheckForErrors</strong></p>
-#end
-#end
-
-#macro (numericSelect $name $first $last $selected $size)
- <select name="$name" size="$size">
- #foreach ($i in [$first..$last])
- <option value="$i" #if ($i==$selected)selected="selected" #end>$i</option>
- #end
- </select>
-#end
-
-#macro (numericOrderSelect $attribute $name $first $last $selected $size)
- <select id="$name" name="$name" size="$size" onchange="javascript: updatePreferredOrderList(this, '$attribute', '$name'); return true;">
- #foreach ($i in [$first..$last])
- <option value="$i" #if ($i==$selected)selected="selected" #end>$i</option>
- #end
- <script type="text/javascript"><!--
- initialisePreferredOrderList("$attribute", "$name", $selected);
- // -->
- </script>
- </select>
-#end
-
-#macro (booleanCheckbox $booleanField)
-#if ($booleanField.Value)
-<input type="checkbox" name="$booleanField.Key" value="true" checked="checked" />
-#else
-<input type="checkbox" name="$booleanField.Key" value="true" />
-#end
-<input type="hidden" name="$booleanField.ValueIfAbsent" value="false" />
-#end
-
-#macro (booleanCheckboxLock $booleanField $locked)
-#if ($locked)
- #set ($disabled = "disabled=disabled")
-#else
- #set ($disabled = "")
-#end
-#if ($booleanField.Value)
-<input type="checkbox" name="$booleanField.Key" value="true" checked="checked" $disabled/>
-#else
-<input type="checkbox" name="$booleanField.Key" value="true" $disabled/>
-#end
-<input type="hidden" name="$booleanField.ValueIfAbsent" value="false" $disabled />
-#end
-
-#macro (booleanRadio $booleanField)
-#if ($booleanField.Value)
-<input type="radio" name="$booleanField.Key" value="true" checked="checked" />
-#else
-<input type="radio" name="$booleanField.Key" value="true" />
-#end
-<input type="hidden" name="$booleanField.ValueIfAbsent" value="false" />
-#end
-
-#macro (Radio $field $value $default)
-#if ($field.Value.equals($value))
-<input type="radio" name="$field.Key" value="$value" checked="checked" />
-#elseif (!$field.Value && $value.equals($default))
-<input type="radio" name="$field.Key" value="$value" checked="checked" />
-#else
-<input type="radio" name="$field.Key" value="$value" />
-#end
-#end
-
-#macro (textField $field $size)
-#if ($field.Validator.MaxLength && $field.Validator.MaxLength > 0)
-#set ($maxLength = $field.Validator.MaxLength)
-#end
-<input type="text" name="$field.Key" value="$!field.Value"#if($maxLength) maxlength="$maxLength"#end#if($size.length()) size="$size"#end />
-#end
-
-#macro (userSelectBox $attrValue $size $multiple)
-#set ($attrInput = $intake.AttributeValue.mapTo($attrValue))
-#set ($attr = $attrValue.Attribute)
-#set ($module = $attrValue.Issue.Module)
-#if ($multiple == "true" || $multiple == "multiple")
-<select name="$attrInput.get("UserIds").Key"
- #if($size.length())size="$size"#end multiple="multiple">
-#else
-<select name="$attrInput.get("UserId").Key"
- #if($size.length())size="$size"#end>
-#end
- #if ($size.length() == 0)
- <option value="">$l10n.Choose</option>
- #end
- #foreach ($user in $module.getUsers($attr.Permission))
- #if ($attrInput.UserId.Value && $user.PrimaryKey == $attrInput.UserId.Value)
- <option selected="selected" value="$user.PrimaryKey">$user.UserName</option>
- #else
- <option value="$user.PrimaryKey">$user.UserName</option>
- #end
- #end
-</select>
-#end
-
-#macro (templateUserSelectBox $attrValue $templAttrValue $size $multiple)
-#set ($attrInput = $intake.AttributeValue.mapTo($attrValue))
-#set ($templAttrInput = $intake.AttributeValue.mapTo($templAttrValue))
-#set ($attr = $attrValue.Attribute)
-#set ($module = $attrValue.Issue.Module)
- #set($currentValue = "")
- #if ($attrInput.UserId.toString().length() > 0)
- #set($currentValue = $attrInput.UserId)
- #elseif ($templAttrInput.UserId.toString().length() > 0)
- #set($currentValue = $templAttrInput.UserId)
- #end
-#if ($multiple == "true" || $multiple == "multiple")
-<select name="$attrInput.UserId.Key"
- #if($size.length())size="$size"#end multiple="multiple">
-#else
-<select name="$attrInput.UserId.Key"
- #if($size.length())size="$size"#end>
-#end
- #if ($size.length() == 0)
- <option value="">$l10n.Choose</option>
- #end
- #foreach ($user in $module.getUsers($attr.Permission))
- #if ($user.PrimaryKey.toString().equals($currentValue.toString()))
- <option selected="selected" value="$user.PrimaryKey">$user.UserName</option>
- #else
- <option value="$user.PrimaryKey">$user.UserName</option>
- #end
- #end
-</select>
-#end
-
-#macro (queryTypeSelectBox $query)
- #set ($queryGroup = $intake.Query.mapTo($query))
- <select name="$queryGroup.ScopeId.Key">
- #foreach ($scope in $scarabR.getScopes())
- <option value = "$scope.ScopeId" #if($scope.ScopeId.toString().equals("$queryGroup.ScopeId.Value")) selected="selected" #end>
- $scope.Name
- </option>
- #end
- </select>
-#end
-
-#macro (templateTypeSelectBox $templateInfo)
- #set ($group = $intake.IssueTemplateInfo.mapTo($templateInfo))
- <select name="$group.ScopeId.Key">
- #foreach ($scope in $scarabR.getScopes())
- <option value = "$scope.ScopeId" #if($scope.ScopeId.toString().equals("$group.ScopeId.Value")) selected="selected" #end>
- $scope.Name
- </option>
- #end
- </select>
-#end
-
-#macro (frequencySelectBox $id)
-<option value="" >$l10n.Choose</option>
- #foreach ($frequency in $scarabR.Frequencies)
- <option value = "$frequency.FrequencyId" #if($frequency.FrequencyId.equals($id)) selected="selected" #end>
- $frequency.Name
- </option>
- #end
-#end
-
-#macro (indexedRows $count)
- #if ($count % 2 > 0)
- <tr class="a">
- #else
- <tr class="b">
- #end
-#end
-
-#macro (indexedRowsWithStyle $count $style)
- #if ($count % 2 > 0)
- <tr class="a" style=$style">
- #else
- <tr class="b" style="$style">
- #end
-#end
-
-#macro (indexedRows2 $count)
- #if ($count % 2 > 0)
- <tr class="b">
- #else
- <tr class="a">
- #end
-#end
-
-#macro (rows)
- #indexedRows($velocityCount)
-#end
-
-
-#macro (datatitle $title)
-<h3>$title</h3>
-#end
-
-#macro (selected $boolean)
-#if ($boolean) selected="selected"#end
-#end
-
-#macro (checked $boolean)
-#if ($boolean) checked="checked"#end
-#end
-
-
-#macro (option $optionModel)
-<option #selected($optionModel.isSelected())
- value="$optionModel.Value">$optionModel.Name</option>
-#end
-
-#macro (resultsPerPageRadioSelect $resultsPerPage $showAll)
-#if (!$resultsPerPage || $resultsPerPage == 0)
- #set ($resultsPerPage = 25)
-#end
-#foreach ($num in [25, 50, 75, 100])
- <input type="radio" value="$num" name="resultsPerPage" #if ($resultsPerPage == $num) checked="checked" #end /> $num
-#end
-#if ($showAll.toString().equals("true"))
- <input type="radio" value="-1" name="resultsPerPage" #if ($resultsPerPage == -1) checked="checked" #end /> $l10n.All
-#end
-#end
-
-#macro (paginate $resultsPerPage $pageNum $sortColumn $sortPolarity)
- <p class="paginate">
- #if($scarabR.PrevPage != 0)
- #set ($prevLink = $link.setPathInfo("resultsperpage", "$resultsPerPage").setPathInfo("pageNum", "$scarabR.PrevPage").setPathInfo("sortColumn", "$sortColumn").setPathInfo("sortPolarity", "$sortPolarity").setPage($scarabR.getCurrentTemplate()))
- <a href="$prevLink">$l10n.PaginatePrevious</a> |
- #end
- $pageNum of $scarabR.NbrPages
- #if ($scarabR.NextPage != 0)
- #set ($nextLink = $link.setPathInfo("resultsperpage", "$resultsPerPage").setPathInfo("pageNum", "$scarabR.NextPage").setPathInfo("sortColumn", "$sortColumn").setPathInfo("sortPolarity", "$sortPolarity").setPage($scarabR.getCurrentTemplate()))
- | <a href="$nextLink">$l10n.PaginateNext</a>
- #end
- </p>
-#end
-
-## Writes the pagination links for an issue list: "<< Pervious | n of N | Next >>"
-#macro (paginateIssueList $resultsPerPage $pageNum $sortColumn $sortPolarity $searchType)
- #if (!$sortColumn)
- #set ($sortColumn='null')
- #end
- <p class="paginate">
- #if($scarabR.PrevPage != 0)
- #set ($prevLink = $link.setPathInfo("resultsperpage", "$resultsPerPage").setPathInfo("pageNum", "$scarabR.PrevPage").setPathInfo("sortColumn", "$sortColumn").setPathInfo("sortPolarity", "$sortPolarity").setPathInfo("searchType", "$searchType").setPage($scarabR.getCurrentTemplate()))
- <a href="$prevLink">$l10n.PaginatePrevious</a> |
- #end
- $pageNum of $scarabR.NbrPages
- #if ($scarabR.NextPage != 0)
- #set ($nextLink = $link.setPathInfo("resultsperpage", "$resultsPerPage").setPathInfo("pageNum", "$scarabR.NextPage").setPathInfo("sortColumn", "$sortColumn").setPathInfo("sortPolarity", "$sortPolarity").setPathInfo("searchType", "$searchType").setPage($scarabR.getCurrentTemplate()))
- | <a href="$nextLink">$l10n.PaginateNext</a>
- #end
- </p>
-#end
-
-#macro (paginateWithSearch $resultsPerPage $pageNum $sortColumn $sortPolarity $searchString $searchField $parameters)
-#set ($cancelTemplate = $data.Parameters.getString("$scarabG.Constant.CANCEL_TEMPLATE", "ViewIssue.vm"))
- <p class="paginate">
- #if($scarabR.PrevPage != 0)
- #set ($prevLink = $link.setPathInfo("resultsperpage", "$resultsPerPage.toString()").addPathInfo("pageNum", "$scarabR.PrevPage").addPathInfo("sortColumn", "$sortColumn").addPathInfo("sortPolarity", "$sortPolarity").setPage($scarabR.getCurrentTemplate()).addPathInfo("searchString", $searchString).addPathInfo("searchField", $searchField).addPathInfo($scarabG.Constant.CANCEL_TEMPLATE, $cancelTemplate))
- #foreach ($parameter in $parameters)
- #set ($paramKey = $parameter.get(0))
- #if ($paramKey.length() > 0)
- #set ($dummy = $prevLink.addPathInfo($paramKey, $parameter.get(1)))
- #end
- #end
- <a href="$prevLink">$l10n.PaginatePrevious</a> |
- #end
- $pageNum of $scarabR.NbrPages
- #if ($scarabR.NextPage != 0)
- #set ($nextLink = $link.setPathInfo("resultsperpage", "$resultsPerPage.toString()").addPathInfo("pageNum", "$scarabR.NextPage").addPathInfo("sortColumn", "$sortColumn").addPathInfo("sortPolarity", "$sortPolarity").setPage($scarabR.getCurrentTemplate()).addPathInfo("searchString", $searchString).addPathInfo("searchField", $searchField).addPathInfo($scarabG.Constant.CANCEL_TEMPLATE, $cancelTemplate))
-
- #foreach ($parameter in $parameters)
- #set ($paramKey = $parameter.get(0))
- #if ($paramKey.length() > 0)
- #set ($dummy = $nextLink.addPathInfo($paramKey, $parameter.get(1)))
- #end
- #end
- | <a href="$nextLink">$l10n.PaginateNext</a>
- #end
- </p>
-#end
-
-## ---------------------------------------------------------------------------
-## Issue listing and reporting related macros
-## ---------------------------------------------------------------------------
-
-#macro (navigate)
- #if ($scarabR.isIssuePartOfList())
- <p class="paginate">
- #set ($prevIssue=$scarabR.PrevIssue)
- #if($prevIssue)
- #set ($prevLink = $link.setPathInfo("id", "$prevIssue").setPage($scarabR.getCurrentTemplate()).addPathInfo("posInList", $scarabR.PrevIssuePosInList))
- <a href="$prevLink">$l10n.PaginatePrevious</a> |
- #end
- $scarabR.IssuePosInList of $scarabR.CurrentSearchResultsSize
- #set ($nextIssue=$scarabR.NextIssue)
- #if ($nextIssue)
- #set ($nextLink = $link.setPathInfo("id", "$nextIssue").setPage($scarabR.getCurrentTemplate()).addPathInfo("posInList", $scarabR.NextIssuePosInList))
- | <a href="$nextLink">$l10n.PaginateNext</a>
- #end
- </p>
- #end
-#end
-
-#macro (processQueryResults $action $listSize)
-<select name="next"
- onchange="javascript:submitFormTo(this.form, '$action');">
-<option value="" selected="selected">$l10n.ProcessResults:</option>
-#set ($module = $scarabR.CurrentModule)
-#if ($user.hasPermission($scarabG.Permission.ISSUE__VIEW, $module))
- #if ($listSize <= $scarabG.Constant.ISSUE_MAX_VIEW)
- <option value="viewAll">$l10n.ViewAll</option>
- #end
- <option value="viewSelected">$l10n.ViewSelected</option>
-#end
-#if ($user.hasPermission($scarabG.Permission.ISSUE__ASSIGN, $module))
- #if ($listSize <= $scarabG.Constant.ISSUE_MAX_ASSIGN)
- <option value="assignAll">$l10n.AssignAll</option>
- #end
- <option value="assignSelected">$l10n.AssignSelected</option>
-#end
-#if ($user.hasPermission($scarabG.Permission.ISSUE__ENTER, $module))
- #if ($listSize <= $scarabG.Constant.ISSUE_MAX_COPY)
- <option value="copyAll">$l10n.CopyAll</option>
- #end
- <option value="copySelected">$l10n.CopySelected</option>
-#end
-#if ($user.hasPermission($scarabG.Permission.ISSUE__MOVE, $module))
- #if ($listSize <= $scarabG.Constant.ISSUE_MAX_MOVE)
- <option value="moveAll">$l10n.MoveAll</option>
- #end
- <option value="moveSelected">$l10n.MoveSelected</option>
-#end
-</select>
-<noscript>
-<input type="submit" name="$action" value="$l10n.Go" />
-</noscript>
-#end
-
-#macro (exportFormats $action)
-<select name="format"
- onchange="javascript:submitFormTo(this.form, '$action');">
-<option value="" selected="selected">$l10n.ExportResultsTo</option>
-<option value="excel">$l10n.Excel</option>
-<option value="tsv">$l10n.TabSeparatedValues</option>
-##<option value="xml">XML</option>
-</select>
-<noscript>
-<input type="submit" name="$action" value="$l10n.Go" />
-</noscript>
-#end
-
-#* -------------------------------------------------------------------------
-$paramName - The name to use for the form field.
-
-$format - The current value for the form field which indicates
-selected the radio button.
-------------------------------------------------------------------------- *#
-#macro (exportFormatsRow $paramName $format)
-<tr>
-<th>$l10n.Format</th>
-<td>
- <input type="radio" name="$paramName" value=""
- #if ($!format == '')checked="checked"#end />$l10n.Web
- <input type="radio" name="$paramName" value="excel"
- #if ($format.equalsIgnoreCase('excel'))checked="checked"#end />$l10n.Excel
- <input type="radio" name="$paramName" value="tsv"
- #if ($format.equalsIgnoreCase('tsv'))checked="checked"#end
- />$l10n.TabSeparatedValues
- #* <input type="radio" name="$paramName" value="xml"
- #if ($format.equalsIgnoreCase('xml'))checked="checked"#end />XML *#
-</td>
-</tr>
-#end
-
-#set ($autoresize = $scarabG.getTurbineConfiguration().getString("scarab.dhtml.autoresize_textarea").toLowerCase().equals("true"))
-
-#macro (textAreaSmall $key $value)
- <textarea class="fullWidth" rows="2" wrap="virtual" name="$key">#if ($value)$value#end</textarea>
-#end
-
-#macro (textAreaMedium $key $value)
- <textarea class="fullWidth" #if($autoresize) onblur="outTextArea(this)" onfocus="onTextArea(this)" #else rows="10" #end wrap="virtual" name="$key">#if ($value)$value#end</textarea>
-#end
-
-#macro (textAreaLarge $key $value)
- <textarea class="fullWidth" #if($autoresize) onblur="outTextArea(this)" onfocus="onTextArea(this)" #else rows="10" #end wrap="virtual" name="$key">#if ($value)$value#end</textarea>
-#end
-
-#macro (attributeCreatedBy $attribute)
-## FIXME: getUser() takes an Object param, not an int (the return type
-## of getCreatedBy()). Post Beta milestone,
-## SCARAB_ATTRIBUTE.CREATED_BY needs to have its FK reference to
-## TURBINE_USER.USER_ID defined.
-#set ($creatorID = "0")
-#set ($creatorID = $attribute.CreatedBy)
-#if ($creatorID == "0")
- Default
-#else
- #set ($createdUser = $scarabR.getUser($attribute.CreatedBy))
- <a href="mailTo:$createdUser.Email">$!createdUser.Name</a>
-#end
-#end
-
-#macro (userSort $shortName $longName $linkPage $parameters)
- #if (!$resultsPerPage) #set ($resultsPerPage = 25) #end
- #if ($sortColumn.equals($shortName))
- #if ($sortPolarity.equals("desc"))
- #set ($arrowLink = $link.setPage($linkPage).setPathInfo("sortColumn", "$shortName").setPathInfo("pageNum",$pageNum.toString()).setPathInfo("resultsPerPage", $resultsPerPage.toString()).setPathInfo("sortPolarity", "asc").setPathInfo("searchString", $searchString).setPathInfo("searchField", $searchField))
- #foreach ($parameter in $parameters)
- #set ($paramKey = $parameter.get(0))
- #if ($paramKey.length() > 0)
- #set ($dummy = $arrowLink.setPathInfo($paramKey, $parameter.get(1)))
- #end
- #end
- <a href="$arrowLink"><img src="$staticLink.setPath("/images/icon_downarrow_on.gif")" width="13" height="8" alt="sort descending" title="sort descending" border="0" /></a> 
- #else
- #set ($arrowLink = $link.setPage($linkPage).setPathInfo("sortPolarity", "desc").setPathInfo("sortColumn", "$shortName").setPathInfo("pageNum", $pageNum.toString()).setPathInfo("resultsPerPage", $resultsPerPage.toString()).setPathInfo("searchString", $searchString).setPathInfo("searchField", $searchField))
- #foreach ($parameter in $parameters)
- #set ($paramKey = $parameter.get(0))
- #if ($paramKey.length() > 0)
- #set ($dummy = $arrowLink.setPathInfo($paramKey, $parameter.get(1)))
- #end
- #end
- <a href="$arrowLink"><img src="$staticLink.setPath("/images/icon_uparrow_on.gif")" width="13" height="8" alt="sort ascending" title="sort ascending" border="0" /></a> 
- #end $longName
- #else
- #set ($sortLink = $link.setPage($linkPage).setPathInfo("sortColumn", "$shortName").setPathInfo("sortPolarity", "$sortPolarity").setPathInfo("pageNum", $pageNum.toString()).setPathInfo("resultsPerPage", $resultsPerPage.toString()).setPathInfo("searchString", $searchString).setPathInfo("searchField", $searchField))
- #foreach ($parameter in $parameters)
- #set ($paramKey = $parameter.get(0))
- #if ($paramKey.length() > 0)
- #set ($dummy = $sortLink.setPathInfo($paramKey, $parameter.get(1)))
- #end
- #end
- <a href="$sortLink">$longName</a>
- #end
-#end
-
-#macro (sort $shortName $longName)
-#if (!$resultsPerPage) #set ($resultsPerPage = 25) #end
- #if ($sortColumn.equals($shortName))
- #if ($sortPolarity.equals("desc"))
- #set ($arrowLink = $link.setPage("$scarabR.CurrentTemplate").setPathInfo("sortPolarity", "asc").setPathInfo("sortColumn", "$shortName").setPathInfo("pageNum",$pageNum.toString()).setPathInfo("resultsPerPage", $resultsPerPage.toString()))
- <a href="$arrowLink"><img src="$staticLink.setPath("/images/icon_downarrow_on.gif")" width="13" height="8" alt="sort descending" title="sort descending" border="0" /></a> 
- #else
- #set ($arrowLink = $link.setPage("$scarabR.CurrentTemplate").setPathInfo("sortPolarity", "desc").setPathInfo("sortColumn", "$shortName").setPathInfo("pageNum", $pageNum.toString()).setPathInfo("resultsPerPage", $resultsPerPage.toString()))
- <a href="$arrowLink"><img src="$staticLink.setPath("/images/icon_uparrow_on.gif")" width="13" height="8" alt="sort ascending" title="sort ascending" border="0" /></a> 
- #end $longName
- #else
- #set ($sortLink = $link.setPage("$scarabR.CurrentTemplate").setPathInfo("sortColumn", "$shortName").setPathInfo("sortPolarity", "$sortPolarity").setPathInfo("pageNum", $pageNum.toString()).setPathInfo("resultsPerPage", $resultsPerPage.toString()))
- <a href="$sortLink">$longName</a>
- #end
-#end
-
-#macro (sortWithSearch $shortName $longName $searchString $searchField)
-#if (!$resultsPerPage) #set ($resultsPerPage = 25) #end
- #if ($sortColumn.equals($shortName))
- #if ($sortPolarity.equals("desc"))
- #set ($arrowLink = $link.setPage("$scarabR.CurrentTemplate").setPathInfo("sortPolarity", "asc").setPathInfo("sortColumn", "$shortName").setPathInfo("pageNum",$pageNum.toString()).setPathInfo("resultsPerPage", $resultsPerPage.toString()).setPathInfo("searchString", $searchString).setPathInfo("searchfield", $searchField))
- <a href="$arrowLink"><img src="$staticLink.setPath("/images/icon_downarrow_on.gif")" width="13" height="8" alt="sort descending" title="sort descending" border="0" /></a> 
- #else
- #set ($arrowLink = $link.setPage("$scarabR.CurrentTemplate").setPathInfo("sortPolarity", "desc").setPathInfo("sortColumn", "$shortName").setPathInfo("pageNum", $pageNum.toString()).setPathInfo("resultsPerPage", $resultsPerPage.toString()).setPathInfo("searchString", $searchString).setPathInfo("searchfield", $searchField))
- <a href="$arrowLink"><img src="$staticLink.setPath("/images/icon_uparrow_on.gif")" width="13" height="8" alt="sort ascending" title="sort ascending" border="0" /></a> 
- #end $longName
- #else
- #set ($sortLink = $link.setPage("$scarabR.CurrentTemplate").setPathInfo("sortColumn", "$shortName").setPathInfo("sortPolarity", "$sortPolarity").setPathInfo("pageNum", $pageNum.toString()).setPathInfo("resultsPerPage", $resultsPerPage.toString()).setPathInfo("searchString", $searchString).setPathInfo("searchfield", $searchField))
- <a href="$sortLink">$longName</a>
- #end
-#end
-
-#**
- * Outputs information about issues that have been modified prior to
- * the latest suggested changes. Expects $lastActivities to exist in the
- * context as given by the BaseModifyIssue action.
- *#
-#macro (printCollisionInfo)
-#if ($lastActivities && !$lastActivities.isEmpty())
- <p class="infomark"><em>
- $l10n.LastActivity
- </em></p>
- #foreach ($obj in $lastActivities)
- #set ($issue = $obj.get(0))
- #set ($activitySet = $obj.get(1))
- #set ($user = $scarabR.getUser($activitySet.CreatedBy))
- <p>$l10n.format('IssueLastModifiedBy', "$issue.UniqueId")
- <a href="mailto:$user.Email">$!user.Name</a> </p>
- <ul>
- #foreach ($activity in $activitySet.Activitys)
- <li>$activity.getDescription($l10n)</li>
- #end
- </ul>
- #end
-#end
-#end
-
-#macro (asterisk)
-<small>(</small><b class="asterisk">*</b> <small>$l10n.RequiredFields)</small>
-#end
-
-#macro (showAsterisk)
-<b class="asterisk">*</b>
-#end
-
-
-#macro (userList $mitList $includeAny $includeCommittedBy $parameters $activeOnly)
-#set ($userAttrs = $mitList.getCommonUserAttributes($activeOnly))
-#set ($modules = $mitList.Modules)
-
-
-## SORTING
-#set ($sortColumn = $data.Parameters.getString("sortColumn","username"))
-#set ($sortPolarity = $data.Parameters.getString("sortPolarity","asc"))
-
-## PAGINATION
-## if results exceed limit, get subset list
-#set ($resultsPerPage = $data.Parameters.getInt("resultsPerPage", 25))
-#set ($pageNum = $data.Parameters.getInt("pageNum", 1))
-
-## USER SEARCH
-<h3><a name="add">$l10n.Users</a></h3>
-<div class="axial">
-
-<table border="0" cellspacing="2" cellpadding="3">
- <tr>
- <th>$l10n.FilterThisList</th>
- <td><input type="text" name="searchString" value="$!searchString" />
- <select name="searchField">
- <option value="FullName" #if($searchField.equals("FullName")) selected="selected"#end>$l10n.FullName</option>
- <option value="Username" #if($searchField.equals("Username")) selected="selected"#end>$l10n.Username</option>
- </select> <input type="submit" name="eventSubmit_doRefresh" value="$l10n.Filter" /></td>
- </tr>
-</table>
-</div>
-
-#if ($searchString && $searchString.length() > 0)
- #set ($searchResults = $scarabR.getUserFilteredSearchResults($mitList, $pageNum, $resultsPerPage, $sortColumn, $sortPolarity, $includeCommittedBy))
- #if ( $searchResults.getList().isEmpty())
- <p class="infomark"><em>$l10n.NoUsersMatch</em></p>
- #set ($searchResults = $scarabR.getUserSearchResults($mitList, $pageNum, $resultsPerPage, $sortColumn, $sortPolarity, $includeCommittedBy))
- #end
-#else
- #set ($searchResults = $scarabR.getUserSearchResults($mitList, $pageNum, $resultsPerPage, $sortColumn, $sortPolarity, $includeCommittedBy))
-#end
-
-#set ($searchResultsSize = $searchResults.getTotalListSize())
-#set ($searchResultsList = $searchResults.getList())
-
-#set ($paginated = ($resultsPerPage > 0 && $searchResultsSize > $resultsPerPage))
-#if ($paginated)
- #paginateWithSearch ($resultsPerPage $pageNum $sortColumn $sortPolarity $searchString $searchField $parameters)
-#end
-
-#if (!$searchResultsList || $searchResultsList.isEmpty())
- <p><em>$l10n.NoUsersAvailable</em></p>
-#else
-
- <table width="100%" border="1" cellspacing="2" cellpadding="3">
- <tr>
- <th nowrap="nowrap">$l10n.Select</th>
- #set ($linkPage = $scarabG.replace($data.Target, '/', ','))
-
- <th>#userSort ("username" "$l10n.Username" $linkPage $parameters)</th>
- <th>#userSort ("name" "$l10n.FullName" $linkPage $parameters)</th>
- <th>$l10n.Association</th>
- </tr>
- #foreach ($user in $searchResultsList)
- #indexedRows($velocityCount)
- <td><input type="checkbox" name="add_user" value="$user.UserId" /></td>
- <td><a href="mailTo:$user.Email">$user.UserName</a></td>
- <td>$user.Name</td>
- <td><select name="user_attr_$user.UserId">
- #if ($includeAny)
- <option value="any">$l10n.Any</option>
- #end
- #if ($includeCommittedBy && $user.hasPermission($scarabG.Permission.ISSUE__ENTER, $modules))
- <option value="created_by">$l10n.CreatedBy</option>
- #end
- #foreach ($userAttr in $userAttrs)
- #if ($user.hasPermission($userAttr.Permission, $modules))
- #set($userAttrName = $scarabR.getRModuleAttributeDisplayName($userAttr,$mitList))
- <option value="$userAttr.AttributeId">$userAttrName</option>
- #end
- #end
- </select></td>
- </tr>
- #end
- </table>
-
-#if ($paginated)
- #paginateWithSearch ($resultsPerPage $pageNum $sortColumn $sortPolarity $searchString $searchField $parameters)
-#end
-
-<div class="axial">
- <table cellpadding="3" cellspacing="2" border="0">
- <tr>
- <th>$l10n.MaxPerPage</th>
- <td>
- #resultsPerPageRadioSelect($resultsPerPage false)
-  <input type="submit" name="eventSubmit_doRefreshresultsperpage" value="$l10n.Refresh" />
- <input type="hidden" name="oldResultsPerPage" value="$resultsPerPage" />
- </td>
- </tr>
- </table>
-</div>
-
-## keep track of state of the list, resultsPerPage should come after the
-## chance to change it, because we will use the first value
-<input type="hidden" name="sortColumn" value="$sortColumn" />
-<input type="hidden" name="sortPolarity" value="$sortPolarity" />
-<input type="hidden" name="pageNum" value="$pageNum" />
-<input type="hidden" name="resultsPerPage" value="$resultsPerPage" />
-
-##end ## ends the if (!$searchResultsList || $searchResultsList.isEmpty()) statement
-#end ## ends the if (!$userAttrs || $userAttrs.isEmpty()) statement
-#end
-
-
-## ---------------------------------------------------------------------------
-## Date related macros
-## ---------------------------------------------------------------------------
-
-#macro(selectDay $defaultDay)
- #foreach ($i in [1..31])
- <option value="$i"#if("$defaultDay" == "$i") selected="selected"#end>$i</option>
- #end
-#end
-
-#macro(selectHour $defaultHour)
- #foreach ($i in [0..23])
- <option value="$i"#if("$defaultHour" == "$i") selected="selected"#end>$i:00</option>
- #end
-#end
-
-#macro(printMonth $i $name $defaultMonth)
- <option value="$i"#if( $defaultMonth == $i ) selected="selected"#end>$name</option>
-#end
-
-#macro(selectMonth $defaultMonth)
- #printMonth(1 $l10n.January $defaultMonth)
- #printMonth(2 $l10n.February $defaultMonth)
- #printMonth(3 $l10n.March $defaultMonth)
- #printMonth(4 $l10n.April $defaultMonth)
- #printMonth(5 $l10n.May $defaultMonth)
- #printMonth(6 $l10n.June $defaultMonth)
- #printMonth(7 $l10n.July $defaultMonth)
- #printMonth(8 $l10n.August $defaultMonth)
- #printMonth(9 $l10n.September $defaultMonth)
- #printMonth(10 $l10n.October $defaultMonth)
- #printMonth(11 $l10n.November $defaultMonth)
- #printMonth(12 $l10n.December $defaultMonth)
-#end
-
-#macro(selectYear $currentYear $selectedYear)
- #set ($minYear = $selectedYear - 4)
- #set ($maxYear = $selectedYear + 4)
- #selectYear2($minYear $maxYear $selectedYear)
-#end
-
-#macro(selectYear2 $minYear $maxYear $selectedYear)
- #foreach ($year in [$minYear..$maxYear])
- <option value="$year"
- #if("$selectedYear" == "$year")selected="selected"#end
- >$year</option>
- #end
-#end
-
-#* -------------------------------------------------------------------------
-Prints out a date entry form.
-------------------------------------------------------------------------- *#
-#macro(dateEntry $yearField $currentYear $selectedYear $monthField $selectedMonth $dayField $selectedDay $hourField $selectedHour)
- <input name="$yearField" value="$selectedYear"></input> $l10n.YearMark
-
- <select name="$monthField">
- #selectMonth($selectedMonth)
- </select> $l10n.MonthMark
-
- <select name="$dayField">
- #selectDay($selectedDay)
- </select> $l10n.DayMark
- -
- <select name="$hourField">
- #selectHour($selectedHour)
- </select> $l10n.TimeMark
-#end
-
-## ---------------------------------------------------------------------------
-
-
-
-#macro(entryTemplateAndAttributes $issue $moduleAttributeGroups $buttonName $buttonEvent $showTemplates)
-#set ($module = $issue.Module)
-#set ($issueType = $issue.IssueType)
-
-#if ($moduleAttributeGroups.isEmpty())
-<h3>$title</h3>
-<p><em>$l10n.format('NoAttributesDefinedForIssueType',$issueType.getName())</em></p>
-#else
-
-#if ($showTemplates)
-#set ($allTemplates = $scarabR.getAllIssueTemplates($issueType))
-#if ($allTemplates.size() > 0)
-<h3>$l10n.format("ApplyTemplate", $module.getRModuleIssueType($issueType).DisplayName.toLowerCase())</h3>
-<div class="axial">
- <table cellpadding="3" cellspacing="2" border="0">
- <tr>
- <th>$l10n.Templates</th>
- <td>
-<select name="templateId"
- onchange="javascript:submitFormTo(this.form, 'eventSubmit_doUsetemplates');">
- <option value="">$l10n.Choose</option>
-#foreach ($template in $allTemplates)
- <option value="$template.Issue.IssueId"#if ($template.IssueId.toString().equals($data.Parameters.getString("templateId"))) selected="selected"#end>$template.Name</option>
-#end
-</select>
-<noscript>
- 
-<input type="submit" value="$l10n.Select" name="eventSubmit_doUsetemplates" />
-</noscript>
- 
-$link.setPage("TemplateList.vm").setLabel($l10n.format("ViewAllTemplates", $module.getRModuleIssueType($issueType).DisplayName.toLowerCase()))
- </td>
- </tr>
- </table>
-</div>
-#end
-#end
-
-
-<div class="functnbar">
-<input type="submit" value="$buttonName" name="$buttonEvent" /> 
-<input type="reset" value="$l10n.Reset" name="eventSubmit_doRefresh" />
-</div>
-
-#set ($templateId = $data.Parameters.getString("templateId"))
-#if ($templateId && $templateId.trim().length() > 0)
- #set ($templ = $scarabR.getIssueTemplate($templateId))
- $user.setLastEnteredTemplate($templ)
- <input type="hidden" name="templateId" value="$templateId"/>
-#else
- $user.setLastEnteredIssueType($issueType)
-#end
-
-<div class="axial">
-#foreach ($group in $moduleAttributeGroups)
- #if (!$group.Attributes.isEmpty() && $group.isVisible4User($user))
- <h4>$group.Name #asterisk()</h4>
- <table cellpadding="3" cellspacing="2" border="0" width="100%">
- #foreach ($att in $group.Attributes)
- #set ($rma = $module.getRModuleAttribute($att, $issueType))
- #if ($rma.Active)
- ## reset to a new $attVal in the event the issue/template does not
- ## have it defined
- #set ($attVal = $scarabR.getNewAttributeValue($att, $issue))
- ## this may leave the previous value, if RHS is null
- #set ($attVal = $issue.getAttributeValue($att))
-
- #if (!$attVal.Attribute.isUserAttribute())
- #if ($attVal.Attribute.AttributeType.ValidationKey)
- #set ($field = $attVal.Attribute.AttributeType.ValidationKey)
- #elseif ($attVal.Attribute.AttributeType.Name == $scarabG.Constant.DROPDOWN_LIST)
- #set ($field = "OptionId")
- #else
- #set ($field = "Value")
- #end
- <tr>
- <th> #if ($attVal.isRequired()) #showAsterisk() #end
- $attVal.RModuleAttribute.DisplayValue
- </th>
- <td>
- #if ($attVal.Attribute.isOptionAttribute())
- #if ($templ)
- #set ($templAttVal = $scarabR.getNewAttributeValue($att, $templ))
- ## this may leave the previous value, if RHS is null
- #set ($templAttVal = $templ.getAttributeValue($att))
- #templateAttrValueLeafSelect ($attVal $templAttVal $field "" false)
- #else
- #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
- #set ($templAttVal = $templ.getAttributeValue($att))
- #if ($templAttVal.Value)
- #templateAttrValueText ( $attVal $fieldSize $templAttVal )
- #else
- #attrValueText ( $attVal $fieldSize $fieldHint)
- #end
- #else
- #attrValueText ( $attVal $fieldSize $fieldHint)
- #end
- #end
- #attrValueErrorMsg ($attVal $field)
- </td>
- </tr>
- #end
- #end
- #end
- </table>
- #end
-#end
-</div>
-#end
-
-#end
+#macro (markup $type)
+#set ($pseudoHTML = $scarabG.getTurbineConfiguration().getString("system.mail.pseudohtml").toLowerCase().equals("true"))
+#if($pseudoHTML && $type=='b')*#end#if($pseudoHTML && $type=='u')_#end#if($pseudoHTML && $type=='i')/#end#if(!$pseudoHTML && $type=='s')****#end
+#end
+
+#macro (CanMakeTransitionForOption $fromValue $option $issue $multiple)
+ #set ($selected = false)
+ #set ($canMakeTransition = true)
+ #if ($fromValue && $fromValue.toString() != '')
+ #if (!$multiple.equals("true"))
+ #if ($issue.isTemplate())
+ #set ($canMakeTransition = $scarabG.Workflow.canMakeTransition($data.User, $scarabR.getAttributeOption("0"), $option.getAttributeOption(), $issue))
+ #else
+ #if ($issue.isNew())
+ #set ($values = '0')
+ #else
+ #set ($values = $fromValue)
+ #end
+ #set ($canMakeTransition = $scarabG.Workflow.canMakeTransition($data.User, $scarabR.getAttributeOption($values), $option.getAttributeOption(), $issue))
+ #end
+ #end
+ #else
+ #set ($canMakeTransition = $scarabG.Workflow.canMakeTransition($data.User, $scarabR.getAttributeOption("0"), $option.getAttributeOption(), $issue))
+ #end
+$canMakeTransition
+#end
+
+#macro (AllowedTransitionsForOption $attrValue $optionFieldName $size $multiple)
+ #set ($count=0)
+ #set ($attrInput = $intake.AttributeValue.mapTo($attrValue))
+ #set ($attr = $attrValue.Attribute)
+ #set ($issue = $attrValue.Issue)
+ #set ($module = $issue.Module)
+ #set ($issueType = $issue.IssueType)
+ #if ($issueType.ParentId > 0)
+ #set ($issueType = $issueType.IssueTypeForTemplateType)
+ #end
+ ## Initialize $newValues in case the second #set has a null RHS.
+ #set ($newValues = '')
+ #set ($newValues = $attrInput.get($optionFieldName).Value)
+ #foreach ($option in $module.getOptionTree($attr, $issueType, false))
+ #set ($canMakeTransition = "#CanMakeTransitionForOption ($newValues $option $issue $multiple)")
+ #if ($canMakeTransition.trim()=="true")
+ #set ($count=$count+1)
+ #end
+ #end
+ $count
+#end
+
+#macro (attrValueLeafSelect $attrValue $optionFieldName $size $multiple $required)
+ #set ($attrInput = $intake.AttributeValue.mapTo($attrValue))
+ #set ($attr = $attrValue.Attribute)
+ #set ($issue = $attrValue.Issue)
+ #set ($module = $issue.Module)
+ #set ($issueType = $issue.IssueType)
+ #if ($issueType.ParentId > 0)
+ #set ($issueType = $issueType.IssueTypeForTemplateType)
+ #end
+ ## Initialize $newValues in case the second #set has a null RHS.
+ #set ($newValues = '')
+ #set ($newValues = $attrInput.get($optionFieldName).Value)
+ #set ( $count = "#AllowedTransitionsForOption ( $attrValue $optionFieldName $size $multiple )")
+
+ #if ($count.trim() == "0" )
+ <input type="hidden" name="$attrInput.get($optionFieldName).Key" value="$newValues"/>
+ $newValues
+ #elseif ($count.trim() == "1" )
+
+ #foreach ($option in $module.getOptionTree($attr, $issueType, false))
+ #set ($canMakeTransition = "#CanMakeTransitionForOption ($newValues $option $issue $multiple)")
+
+ #if ($canMakeTransition.trim()=="true")
+ #if ($templateInfo || (!$required && $newValues && $newValues.toString() == ''))
+ <input type="hidden" name="$attrInput.get($optionFieldName).Key" value="$newValues"/>
+ #if ($newValues > 0)
+ #set ($checked = "checked")
+ #end
+ #set ($oc = "javascript:this.form.${attrInput.get($optionFieldName).Key}.value=(this.checked)?$option.OptionId:''")
+ <input type="checkbox"
+ name="${attrInput.get($optionFieldName).Key}_tmp"
+ onclick="$oc" ${checked} />
+ #else
+ <input type="hidden" name="$attrInput.get($optionFieldName).Key" value="$option.optionId"/>
+ #end
+ #if ($option.Active)
+ $option.DisplayValue
+ #else
+ [I] $option.DisplayValue
+ #end
+ #end
+ #end
+
+
+ #else
+
+ <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="20" readonly="" name="$attrInput.get($optionFieldName).Key:Display"/><a id="$attrInput.get($optionFieldName).Key:Anchor" href="javascript:toggleTreePopup('$attrInput.get($optionFieldName).Key')">show</a>
+
+ #set ($attributeTreePopup = [])
+ #set ($dummy = $attributeTreePopup.add($attrInput.get($optionFieldName).Key) )
+ #set ($dummy = $attributeTreePopup.add($newValues) )
+ #set ($dummy = $attributeTreePopup.add($module.getOptionsTreeAsJSON($attr, $attrValue.Issue.IssueType, false)) )
+
+ #set ($dummy = $attributeTreePopupHelper.add($attributeTreePopup) )
+
+ #end
+#end
+
+#macro (templateAttrValueLeafSelect $attrValue $templAttrValue $optionFieldName $size $multiple)
+ #set ($attrInput = $intake.AttributeValue.mapTo($attrValue))
+ #set ($templAttrInput = $intake.AttributeValue.mapTo($templAttrValue))
+ #set ($attr = $attrValue.Attribute)
+ #set ($issue = $attrValue.Issue)
+ #set ($module = $issue.Module)
+ #if ($attrInput.get($optionFieldName).Value)
+ #set($currentValue = $attrInput.get($optionFieldName).Value)
+ #elseif ($templAttrInput.get($optionFieldName).Value)
+ #set($currentValue = $templAttrInput.get($optionFieldName).Value)
+ #end
+<select name="$attrInput.get($optionFieldName).Key"
+ #if($size.length())size="$size"#end #if($multiple)multiple="multiple"#end>
+ #if ($size.length() == 0)
+ <option value="">$l10n.Choose</option>
+ #end
+ #foreach ($option in $module.getOptionTree($attr, $issue.IssueType))
+ #set ($selected = false)
+ #if ($currentValue && $option.OptionId == $currentValue)
+ #set ($selected = true)
+ #end
+ #set ($canMakeTransition = true)
+ #set ($canMakeTransition = $scarabG.Workflow.canMakeTransition($data.User, $scarabR.getAttributeOption("0"), $option.getAttributeOption(), $issue))
+ #if ($canMakeTransition)
+ <option value="$option.OptionId"#selected($selected)>
+ #foreach ($i in [0..$option.Level])#if($i != 0) #end#end
+ $option.DisplayValue</option>
+ #end
+ #end
+</select>
+#end
+
+#macro (dependTypeLeafSelect $childIssue $type)
+<select name="$type_depend_type_id_$childIssue.IssueId">
+ <option>Choose dependency type</option>
+ #foreach ($dependType in $currentIssue.getAllDependencyTypes())
+ #if ($currentIssue.getDependency($childIssue).TypeId.toString().equals($dependType.DependTypeId.toString()))
+ <option selected="selected" value="$dependType.DependTypeId">$dependType.Name</option>
+ #else
+ <option value="$dependType.DependTypeId">$dependType.Name</option>
+ #end
+ #end
+ <option value="none">$l10n.RemoveDependency</option>
+</select>
+#end
+
+#macro (attrValueText $attrValue $size $hint)
+#set ($attrInput = $intake.AttributeValue.mapTo($attrValue))
+ #if ($attVal.Attribute.AttributeType.Name == "long-string")
+ #textAreaMedium("$attrInput.Value.Key" $attrInput.Value)
+ #elseif ($attVal.Attribute.AttributeType.Name == "date")
+ #if ($scarabG.getTurbineConfiguration().getString("scarab.datefields.editable") == "false")
+ #set ($readonly = "readonly")
+ #else
+ #set ($readonly = "")
+ #end
+ #set ($ref = $attrInput.Value.Key)
+ #set ($datevalue = $scarabR.formatDate($attrInput.Value.value))
+ <input
+ type="text"
+ id="$ref"
+ name="$ref"
+ $readonly
+ value="$datevalue"
+ size="20" />
+ <a
+ id="dateAnchor$ref"
+ name="dateAnchor$ref"
+ href="javascript:;"
+ onClick="calPopup.select(document.getElementById('$ref'),'dateAnchor$ref','$l10n.ShortDatePattern');return false;">
+ <img src="$staticLink.setPath('/images/date.gif')" border="0"/>
+ </a>
+ #else
+ #if ($attVal.Attribute.AttributeType.Name == "integer")
+ #set ( $fieldName = $attrInput.NumericValue.Key )
+ #set ( $fieldValue= $!attrInput.NumericValue )
+ #else
+ #set ( $fieldName = $attrInput.Value.Key )
+ #set ( $fieldValue= $!attrInput.Value )
+ #end
+ #* #if ($fieldValue.toString().equals("")) #set ($fieldValue = $hint) #end *#
+ <input
+ type="text"
+ name="$fieldName"
+ value="$fieldValue"
+ #if($size > 0) size="$size" #else class="fullWidth" #end />
+ #if ( !$fieldValue.toString().equals($hint) ) <span class="hint">$hint</span> #end
+
+ #end
+#end
+
+#macro (templateAttrValueText $attrValue $size $templAttrValue)
+#set ($attrInput = $intake.AttributeValue.mapTo($attrValue))
+#set ($value = $templAttrValue.Value)
+#set ($currentValue = "")
+#if ($attrInput.Value.toString().length() > 0)
+ #set ($currentValue = $attrInput.Value)
+#elseif ($value.length() > 0)
+ #set ($currentValue = $value)
+#end
+#if ($attVal.Attribute.AttributeType.Name == "long-string")
+ #textAreaMedium("$attrInput.Value.Key" $currentValue)
+#else
+ <input class="fullWidth" type="text" name="$attrInput.Value.Key" value="$!currentValue" />
+#end
+#end
+
+#macro (attrValueHierarchySelect $attrValue $optionFieldName $size $multiple)
+#set ($attrInput = $intake.AttributeValue.mapTo($attrValue))
+#set ($attr = $attrValue.Attribute)
+#set ($module = $attrValue.Issue.Module)
+## initialize in case the second #set has null RHS
+#set ($values = "")
+#set ($values = $attrInput.get($optionFieldName).Value)
+#set ($selectedEmpty=false)
+#foreach ($value in $values)
+ #if ($value.intValue()==0)
+ #set ($selectedEmpty=true)
+ #end
+#end
+
+<select name="$attrInput.get($optionFieldName).Key"
+#if($size.length() != 0)size="$size"#end #if($multiple)multiple="multiple"#end>
+ #if($size.length() == 0 || $size == "1")
+ <option value="">$l10n.Choose</option>
+ #end
+ <option value="0" #if ($selectedEmpty) selected="selected"#end>$l10n.EmptyOption</option>
+ #foreach ($option in $module.getOptionTree($attr, $attrValue.Issue.IssueType))
+ #set ($selected = false)
+ #if ($values && $values.toString().length() > 0)
+ #if ($multiple.toString().equals("true"))
+ #foreach ($value in $values)
+ #if ($value.equals($option.OptionId))
+ #set ($selected=true)
+ #end
+ #end
+ #else
+ #if ($values.equals($option.OptionId))
+ #set ($selected=true)
+ #end
+ #end
+ #end
+ <option value="$option.OptionId"#selected($selected)>
+#foreach ($i in [0..$option.Level])#if($i != 0) #end#end
+ $option.DisplayValue</option>
+ #end
+</select>
+#end
+
+#macro (attrValueErrorMsg $attrValue $fieldName)
+ #set ($attrInput = $intake.AttributeValue.mapTo($attrValue))
+ #if (!$attrInput.get($fieldName).isValid())
+ <p class="warningmark">
+ ## we ignore the missing resource error because there is no easy way yet
+ ## to provide a parameterized message here. In this situation the java code
+ ## (action or screen class) performs the parameterized localization and the
+ ## line below should simply redisplay the key.
+ <strong>$l10n.getIgnoreMissingResource($attrInput.get($fieldName).Message)</strong>
+ </p>
+ #end
+#end
+
+#macro (confirm $text)
+ <p class="donemark"><em>$text</em></p>
+#end
+
+#macro (info $text)
+ <p class="infomark"><em>$text</em></p>
+#end
+
+#macro (alert $text)
+ <p><strong><pre class="warningmark">$l10n.Alert $text</pre></strong></p>
+#end
+
+#macro (fieldErrorMsg $field $br)
+#if ($field && $field.Message.length() > 0 && !$field.isValid())
+<p class="warningmark"><strong>$l10n.get($field.Message)</strong></p>$br
+#end
+#end
+
+#macro (fieldHint $field)
+#if ($field && $field.Message.length() > 0 && !$field.isValid())
+<div class="warningmark"><strong>$l10n.get($field.Message)</strong></div>
+#end
+#end
+
+
+#macro (actionMessage)
+#if ($data.Message)
+ #confirm($data.Message)
+#end
+#if($scarabR.ConfirmMessage)
+ #confirm($scarabR.ConfirmMessage)
+#end
+#if($scarabR.InfoMessage)
+ #info($scarabR.InfoMessage)
+#end
+#if($scarabR.AlertMessage)
+ #alert($scarabR.AlertMessage)
+#end
+#end
+
+#macro (stdIntakeMsg)
+#if (!$intake.isAllValid())
+<p class="warningmark"><strong>$l10n.CheckForErrors</strong></p>
+#end
+#end
+
+#macro (numericSelect $name $first $last $selected $size)
+ <select name="$name" size="$size">
+ #foreach ($i in [$first..$last])
+ <option value="$i" #if ($i==$selected)selected="selected" #end>$i</option>
+ #end
+ </select>
+#end
+
+#macro (numericOrderSelect $attribute $name $first $last $selected $size)
+ <select id="$name" name="$name" size="$size" onchange="javascript: updatePreferredOrderList(this, '$attribute', '$name'); return true;">
+ #foreach ($i in [$first..$last])
+ <option value="$i" #if ($i==$selected)selected="selected" #end>$i</option>
+ #end
+ <script type="text/javascript"><!--
+ initialisePreferredOrderList("$attribute", "$name", $selected);
+ // -->
+ </script>
+ </select>
+#end
+
+#macro (booleanCheckbox $booleanField)
+#if ($booleanField.Value)
+<input type="checkbox" name="$booleanField.Key" value="true" checked="checked" />
+#else
+<input type="checkbox" name="$booleanField.Key" value="true" />
+#end
+<input type="hidden" name="$booleanField.ValueIfAbsent" value="false" />
+#end
+
+#macro (booleanCheckboxLock $booleanField $locked)
+#if ($locked)
+ #set ($disabled = "disabled=disabled")
+#else
+ #set ($disabled = "")
+#end
+#if ($booleanField.Value)
+<input type="checkbox" name="$booleanField.Key" value="true" checked="checked" $disabled/>
+#else
+<input type="checkbox" name="$booleanField.Key" value="true" $disabled/>
+#end
+<input type="hidden" name="$booleanField.ValueIfAbsent" value="false" $disabled />
+#end
+
+#macro (booleanRadio $booleanField)
+#if ($booleanField.Value)
+<input type="radio" name="$booleanField.Key" value="true" checked="checked" />
+#else
+<input type="radio" name="$booleanField.Key" value="true" />
+#end
+<input type="hidden" name="$booleanField.ValueIfAbsent" value="false" />
+#end
+
+#macro (Radio $field $value $default)
+#if ($field.Value.equals($value))
+<input type="radio" name="$field.Key" value="$value" checked="checked" />
+#elseif (!$field.Value && $value.equals($default))
+<input type="radio" name="$field.Key" value="$value" checked="checked" />
+#else
+<input type="radio" name="$field.Key" value="$value" />
+#end
+#end
+
+#macro (textField $field $size)
+#if ($field.Validator.MaxLength && $field.Validator.MaxLength > 0)
+#set ($maxLength = $field.Validator.MaxLength)
+#end
+<input type="text" name="$field.Key" value="$!field.Value"#if($maxLength) maxlength="$maxLength"#end#if($size.length()) size="$size"#end />
+#end
+
+#macro (userSelectBox $attrValue $size $multiple)
+#set ($attrInput = $intake.AttributeValue.mapTo($attrValue))
+#set ($attr = $attrValue.Attribute)
+#set ($module = $attrValue.Issue.Module)
+#if ($multiple == "true" || $multiple == "multiple")
+<select name="$attrInput.get("UserIds").Key"
+ #if($size.length())size="$size"#end multiple="multiple">
+#else
+<select name="$attrInput.get("UserId").Key"
+ #if($size.length())size="$size"#end>
+#end
+ #if ($size.length() == 0)
+ <option value="">$l10n.Choose</option>
+ #end
+ #foreach ($user in $module.getUsers($attr.Permission))
+ #if ($attrInput.UserId.Value && $user.PrimaryKey == $attrInput.UserId.Value)
+ <option selected="selected" value="$user.PrimaryKey">$user.UserName</option>
+ #else
+ <option value="$user.PrimaryKey">$user.UserName</option>
+ #end
+ #end
+</select>
+#end
+
+#macro (templateUserSelectBox $attrValue $templAttrValue $size $multiple)
+#set ($attrInput = $intake.AttributeValue.mapTo($attrValue))
+#set ($templAttrInput = $intake.AttributeValue.mapTo($templAttrValue))
+#set ($attr = $attrValue.Attribute)
+#set ($module = $attrValue.Issue.Module)
+ #set($currentValue = "")
+ #if ($attrInput.UserId.toString().length() > 0)
+ #set($currentValue = $attrInput.UserId)
+ #elseif ($templAttrInput.UserId.toString().length() > 0)
+ #set($currentValue = $templAttrInput.UserId)
+ #end
+#if ($multiple == "true" || $multiple == "multiple")
+<select name="$attrInput.UserId.Key"
+ #if($size.length())size="$size"#end multiple="multiple">
+#else
+<select name="$attrInput.UserId.Key"
+ #if($size.length())size="$size"#end>
+#end
+ #if ($size.length() == 0)
+ <option value="">$l10n.Choose</option>
+ #end
+ #foreach ($user in $module.getUsers($attr.Permission))
+ #if ($user.PrimaryKey.toString().equals($currentValue.toString()))
+ <option selected="selected" value="$user.PrimaryKey">$user.UserName</option>
+ #else
+ <option value="$user.PrimaryKey">$user.UserName</option>
+ #end
+ #end
+</select>
+#end
+
+#macro (queryTypeSelectBox $query)
+ #set ($queryGroup = $intake.Query.mapTo($query))
+ <select name="$queryGroup.ScopeId.Key">
+ #foreach ($scope in $scarabR.getScopes())
+ <option value = "$scope.ScopeId" #if($scope.ScopeId.toString().equals("$queryGroup.ScopeId.Value")) selected="selected" #end>
+ $scope.Name
+ </option>
+ #end
+ </select>
+#end
+
+#macro (templateTypeSelectBox $templateInfo)
+ #set ($group = $intake.IssueTemplateInfo.mapTo($templateInfo))
+ <select name="$group.ScopeId.Key">
+ #foreach ($scope in $scarabR.getScopes())
+ <option value = "$scope.ScopeId" #if($scope.ScopeId.toString().equals("$group.ScopeId.Value")) selected="selected" #end>
+ $scope.Name
+ </option>
+ #end
+ </select>
+#end
+
+#macro (frequencySelectBox $id)
+<option value="" >$l10n.Choose</option>
+ #foreach ($frequency in $scarabR.Frequencies)
+ <option value = "$frequency.FrequencyId" #if($frequency.FrequencyId.equals($id)) selected="selected" #end>
+ $frequency.Name
+ </option>
+ #end
+#end
+
+#macro (indexedRows $count)
+ #if ($count % 2 > 0)
+ <tr class="a">
+ #else
+ <tr class="b">
+ #end
+#end
+
+#macro (indexedRowsWithStyle $count $style)
+ #if ($count % 2 > 0)
+ <tr class="a" style=$style">
+ #else
+ <tr class="b" style="$style">
+ #end
+#end
+
+#macro (indexedRows2 $count)
+ #if ($count % 2 > 0)
+ <tr class="b">
+ #else
+ <tr class="a">
+ #end
+#end
+
+#macro (rows)
+ #indexedRows($velocityCount)
+#end
+
+
+#macro (datatitle $title)
+<h3>$title</h3>
+#end
+
+#macro (selected $boolean)
+#if ($boolean) selected="selected"#end
+#end
+
+#macro (checked $boolean)
+#if ($boolean) checked="checked"#end
+#end
+
+
+#macro (option $optionModel)
+<option #selected($optionModel.isSelected())
+ value="$optionModel.Value">$optionModel.Name</option>
+#end
+
+#macro (resultsPerPageRadioSelect $resultsPerPage $showAll)
+#if (!$resultsPerPage || $resultsPerPage == 0)
+ #set ($resultsPerPage = 25)
+#end
+#foreach ($num in [25, 50, 75, 100])
+ <input type="radio" value="$num" name="resultsPerPage" #if ($resultsPerPage == $num) checked="checked" #end /> $num
+#end
+#if ($showAll.toString().equals("true"))
+ <input type="radio" value="-1" name="resultsPerPage" #if ($resultsPerPage == -1) checked="checked" #end /> $l10n.All
+#end
+#end
+
+#macro (paginate $resultsPerPage $pageNum $sortColumn $sortPolarity)
+ <p class="paginate">
+ #if($scarabR.PrevPage != 0)
+ #set ($prevLink = $link.setPathInfo("resultsperpage", "$resultsPerPage").setPathInfo("pageNum", "$scarabR.PrevPage").setPathInfo("sortColumn", "$sortColumn").setPathInfo("sortPolarity", "$sortPolarity").setPage($scarabR.getCurrentTemplate()))
+ <a href="$prevLink">$l10n.PaginatePrevious</a> |
+ #end
+ $pageNum of $scarabR.NbrPages
+ #if ($scarabR.NextPage != 0)
+ #set ($nextLink = $link.setPathInfo("resultsperpage", "$resultsPerPage").setPathInfo("pageNum", "$scarabR.NextPage").setPathInfo("sortColumn", "$sortColumn").setPathInfo("sortPolarity", "$sortPolarity").setPage($scarabR.getCurrentTemplate()))
+ | <a href="$nextLink">$l10n.PaginateNext</a>
+ #end
+ </p>
+#end
+
+## Writes the pagination links for an issue list: "<< Pervious | n of N | Next >>"
+#macro (paginateIssueList $resultsPerPage $pageNum $sortColumn $sortPolarity $searchType)
+ #if (!$sortColumn)
+ #set ($sortColumn='null')
+ #end
+ <p class="paginate">
+ #if($scarabR.PrevPage != 0)
+ #set ($prevLink = $link.setPathInfo("resultsperpage", "$resultsPerPage").setPathInfo("pageNum", "$scarabR.PrevPage").setPathInfo("sortColumn", "$sortColumn").setPathInfo("sortPolarity", "$sortPolarity").setPathInfo("searchType", "$searchType").setPage($scarabR.getCurrentTemplate()))
+ <a href="$prevLink">$l10n.PaginatePrevious</a> |
+ #end
+ $pageNum of $scarabR.NbrPages
+ #if ($scarabR.NextPage != 0)
+ #set ($nextLink = $link.setPathInfo("resultsperpage", "$resultsPerPage").setPathInfo("pageNum", "$scarabR.NextPage").setPathInfo("sortColumn", "$sortColumn").setPathInfo("sortPolarity", "$sortPolarity").setPathInfo("searchType", "$searchType").setPage($scarabR.getCurrentTemplate()))
+ | <a href="$nextLink">$l10n.PaginateNext</a>
+ #end
+ </p>
+#end
+
+#macro (paginateWithSearch $resultsPerPage $pageNum $sortColumn $sortPolarity $searchString $searchField $parameters)
+#set ($cancelTemplate = $data.Parameters.getString("$scarabG.Constant.CANCEL_TEMPLATE", "ViewIssue.vm"))
+ <p class="paginate">
+ #if($scarabR.PrevPage != 0)
+ #set ($prevLink = $link.setPathInfo("resultsperpage", "$resultsPerPage.toString()").addPathInfo("pageNum", "$scarabR.PrevPage").addPathInfo("sortColumn", "$sortColumn").addPathInfo("sortPolarity", "$sortPolarity").setPage($scarabR.getCurrentTemplate()).addPathInfo("searchString", $searchString).addPathInfo("searchField", $searchField).addPathInfo($scarabG.Constant.CANCEL_TEMPLATE, $cancelTemplate))
+ #foreach ($parameter in $parameters)
+ #set ($paramKey = $parameter.get(0))
+ #if ($paramKey.length() > 0)
+ #set ($dummy = $prevLink.addPathInfo($paramKey, $parameter.get(1)))
+ #end
+ #end
+ <a href="$prevLink">$l10n.PaginatePrevious</a> |
+ #end
+ $pageNum of $scarabR.NbrPages
+ #if ($scarabR.NextPage != 0)
+ #set ($nextLink = $link.setPathInfo("resultsperpage", "$resultsPerPage.toString()").addPathInfo("pageNum", "$scarabR.NextPage").addPathInfo("sortColumn", "$sortColumn").addPathInfo("sortPolarity", "$sortPolarity").setPage($scarabR.getCurrentTemplate()).addPathInfo("searchString", $searchString).addPathInfo("searchField", $searchField).addPathInfo($scarabG.Constant.CANCEL_TEMPLATE, $cancelTemplate))
+
+ #foreach ($parameter in $parameters)
+ #set ($paramKey = $parameter.get(0))
+ #if ($paramKey.length() > 0)
+ #set ($dummy = $nextLink.addPathInfo($paramKey, $parameter.get(1)))
+ #end
+ #end
+ | <a href="$nextLink">$l10n.PaginateNext</a>
+ #end
+ </p>
+#end
+
+## ---------------------------------------------------------------------------
+## Issue listing and reporting related macros
+## ---------------------------------------------------------------------------
+
+#macro (navigate)
+ #if ($scarabR.isIssuePartOfList())
+ <p class="paginate">
+ #set ($prevIssue=$scarabR.PrevIssue)
+ #if($prevIssue)
+ #set ($prevLink = $link.setPathInfo("id", "$prevIssue").setPage($scarabR.getCurrentTemplate()).addPathInfo("posInList", $scarabR.PrevIssuePosInList))
+ <a href="$prevLink">$l10n.PaginatePrevious</a> |
+ #end
+ $scarabR.IssuePosInList of $scarabR.CurrentSearchResultsSize
+ #set ($nextIssue=$scarabR.NextIssue)
+ #if ($nextIssue)
+ #set ($nextLink = $link.setPathInfo("id", "$nextIssue").setPage($scarabR.getCurrentTemplate()).addPathInfo("posInList", $scarabR.NextIssuePosInList))
+ | <a href="$nextLink">$l10n.PaginateNext</a>
+ #end
+ </p>
+ #end
+#end
+
+#macro (processQueryResults $action $listSize)
+<select name="next"
+ onchange="javascript:submitFormTo(this.form, '$action');">
+<option value="" selected="selected">$l10n.ProcessResults:</option>
+#set ($module = $scarabR.CurrentModule)
+#if ($user.hasPermission($scarabG.Permission.ISSUE__VIEW, $module))
+ #if ($listSize <= $scarabG.Constant.ISSUE_MAX_VIEW)
+ <option value="viewAll">$l10n.ViewAll</option>
+ #end
+ <option value="viewSelected">$l10n.ViewSelected</option>
+#end
+#if ($user.hasPermission($scarabG.Permission.ISSUE__ASSIGN, $module))
+ #if ($listSize <= $scarabG.Constant.ISSUE_MAX_ASSIGN)
+ <option value="assignAll">$l10n.AssignAll</option>
+ #end
+ <option value="assignSelected">$l10n.AssignSelected</option>
+#end
+#if ($user.hasPermission($scarabG.Permission.ISSUE__ENTER, $module))
+ #if ($listSize <= $scarabG.Constant.ISSUE_MAX_COPY)
+ <option value="copyAll">$l10n.CopyAll</option>
+ #end
+ <option value="copySelected">$l10n.CopySelected</option>
+#end
+#if ($user.hasPermission($scarabG.Permission.ISSUE__MOVE, $module))
+ #if ($listSize <= $scarabG.Constant.ISSUE_MAX_MOVE)
+ <option value="moveAll">$l10n.MoveAll</option>
+ #end
+ <option value="moveSelected">$l10n.MoveSelected</option>
+#end
+</select>
+<noscript>
+<input type="submit" name="$action" value="$l10n.Go" />
+</noscript>
+#end
+
+#macro (exportFormats $action)
+<select name="format"
+ onchange="javascript:submitFormTo(this.form, '$action');">
+<option value="" selected="selected">$l10n.ExportResultsTo</option>
+<option value="excel">$l10n.Excel</option>
+<option value="tsv">$l10n.TabSeparatedValues</option>
+##<option value="xml">XML</option>
+</select>
+<noscript>
+<input type="submit" name="$action" value="$l10n.Go" />
+</noscript>
+#end
+
+#* -------------------------------------------------------------------------
+$paramName - The name to use for the form field.
+
+$format - The current value for the form field which indicates
+selected the radio button.
+------------------------------------------------------------------------- *#
+#macro (exportFormatsRow $paramName $format)
+<tr>
+<th>$l10n.Format</th>
+<td>
+ <input type="radio" name="$paramName" value=""
+ #if ($!format == '')checked="checked"#end />$l10n.Web
+ <input type="radio" name="$paramName" value="excel"
+ #if ($format.equalsIgnoreCase('excel'))checked="checked"#end />$l10n.Excel
+ <input type="radio" name="$paramName" value="tsv"
+ #if ($format.equalsIgnoreCase('tsv'))checked="checked"#end
+ />$l10n.TabSeparatedValues
+ #* <input type="radio" name="$paramName" value="xml"
+ #if ($format.equalsIgnoreCase('xml'))checked="checked"#end />XML *#
+</td>
+</tr>
+#end
+
+#set ($autoresize = $scarabG.getTurbineConfiguration().getString("scarab.dhtml.autoresize_textarea").toLowerCase().equals("true"))
+
+#macro (textAreaSmall $key $value)
+ <textarea class="fullWidth" rows="2" wrap="virtual" name="$key">#if ($value)$value#end</textarea>
+#end
+
+#macro (textAreaMedium $key $value)
+ <textarea class="fullWidth" #if($autoresize) onblur="outTextArea(this)" onfocus="onTextArea(this)" #else rows="10" #end wrap="virtual" name="$key">#if ($value)$value#end</textarea>
+#end
+
+#macro (textAreaLarge $key $value)
+ <textarea class="fullWidth" #if($autoresize) onblur="outTextArea(this)" onfocus="onTextArea(this)" #else rows="10" #end wrap="virtual" name="$key">#if ($value)$value#end</textarea>
+#end
+
+#macro (attributeCreatedBy $attribute)
+## FIXME: getUser() takes an Object param, not an int (the return type
+## of getCreatedBy()). Post Beta milestone,
+## SCARAB_ATTRIBUTE.CREATED_BY needs to have its FK reference to
+## TURBINE_USER.USER_ID defined.
+#set ($creatorID = "0")
+#set ($creatorID = $attribute.CreatedBy)
+#if ($creatorID == "0")
+ Default
+#else
+ #set ($createdUser = $scarabR.getUser($attribute.CreatedBy))
+ <a href="mailTo:$createdUser.Email">$!createdUser.Name</a>
+#end
+#end
+
+#macro (userSort $shortName $longName $linkPage $parameters)
+ #if (!$resultsPerPage) #set ($resultsPerPage = 25) #end
+ #if ($sortColumn.equals($shortName))
+ #if ($sortPolarity.equals("desc"))
+ #set ($arrowLink = $link.setPage($linkPage).setPathInfo("sortColumn", "$shortName").setPathInfo("pageNum",$pageNum.toString()).setPathInfo("resultsPerPage", $resultsPerPage.toString()).setPathInfo("sortPolarity", "asc").setPathInfo("searchString", $searchString).setPathInfo("searchField", $searchField))
+ #foreach ($parameter in $parameters)
+ #set ($paramKey = $parameter.get(0))
+ #if ($paramKey.length() > 0)
+ #set ($dummy = $arrowLink.setPathInfo($paramKey, $parameter.get(1)))
+ #end
+ #end
+ <a href="$arrowLink"><img src="$staticLink.setPath("/images/icon_downarrow_on.gif")" width="13" height="8" alt="sort descending" title="sort descending" border="0" /></a> 
+ #else
+ #set ($arrowLink = $link.setPage($linkPage).setPathInfo("sortPolarity", "desc").setPathInfo("sortColumn", "$shortName").setPathInfo("pageNum", $pageNum.toString()).setPathInfo("resultsPerPage", $resultsPerPage.toString()).setPathInfo("searchString", $searchString).setPathInfo("searchField", $searchField))
+ #foreach ($parameter in $parameters)
+ #set ($paramKey = $parameter.get(0))
+ #if ($paramKey.length() > 0)
+ #set ($dummy = $arrowLink.setPathInfo($paramKey, $parameter.get(1)))
+ #end
+ #end
+ <a href="$arrowLink"><img src="$staticLink.setPath("/images/icon_uparrow_on.gif")" width="13" height="8" alt="sort ascending" title="sort ascending" border="0" /></a> 
+ #end $longName
+ #else
+ #set ($sortLink = $link.setPage($linkPage).setPathInfo("sortColumn", "$shortName").setPathInfo("sortPolarity", "$sortPolarity").setPathInfo("pageNum", $pageNum.toString()).setPathInfo("resultsPerPage", $resultsPerPage.toString()).setPathInfo("searchString", $searchString).setPathInfo("searchField", $searchField))
+ #foreach ($parameter in $parameters)
+ #set ($paramKey = $parameter.get(0))
+ #if ($paramKey.length() > 0)
+ #set ($dummy = $sortLink.setPathInfo($paramKey, $parameter.get(1)))
+ #end
+ #end
+ <a href="$sortLink">$longName</a>
+ #end
+#end
+
+#macro (sort $shortName $longName)
+#if (!$resultsPerPage) #set ($resultsPerPage = 25) #end
+ #if ($sortColumn.equals($shortName))
+ #if ($sortPolarity.equals("desc"))
+ #set ($arrowLink = $link.setPage("$scarabR.CurrentTemplate").setPathInfo("sortPolarity", "asc").setPathInfo("sortColumn", "$shortName").setPathInfo("pageNum",$pageNum.toString()).setPathInfo("resultsPerPage", $resultsPerPage.toString()))
+ <a href="$arrowLink"><img src="$staticLink.setPath("/images/icon_downarrow_on.gif")" width="13" height="8" alt="sort descending" title="sort descending" border="0" /></a> 
+ #else
+ #set ($arrowLink = $link.setPage("$scarabR.CurrentTemplate").setPathInfo("sortPolarity", "desc").setPathInfo("sortColumn", "$shortName").setPathInfo("pageNum", $pageNum.toString()).setPathInfo("resultsPerPage", $resultsPerPage.toString()))
+ <a href="$arrowLink"><img src="$staticLink.setPath("/images/icon_uparrow_on.gif")" width="13" height="8" alt="sort ascending" title="sort ascending" border="0" /></a> 
+ #end $longName
+ #else
+ #set ($sortLink = $link.setPage("$scarabR.CurrentTemplate").setPathInfo("sortColumn", "$shortName").setPathInfo("sortPolarity", "$sortPolarity").setPathInfo("pageNum", $pageNum.toString()).setPathInfo("resultsPerPage", $resultsPerPage.toString()))
+ <a href="$sortLink">$longName</a>
+ #end
+#end
+
+#macro (sortWithSearch $shortName $longName $searchString $searchField)
+#if (!$resultsPerPage) #set ($resultsPerPage = 25) #end
+ #if ($sortColumn.equals($shortName))
+ #if ($sortPolarity.equals("desc"))
+ #set ($arrowLink = $link.setPage("$scarabR.CurrentTemplate").setPathInfo("sortPolarity", "asc").setPathInfo("sortColumn", "$shortName").setPathInfo("pageNum",$pageNum.toString()).setPathInfo("resultsPerPage", $resultsPerPage.toString()).setPathInfo("searchString", $searchString).setPathInfo("searchfield", $searchField))
+ <a href="$arrowLink"><img src="$staticLink.setPath("/images/icon_downarrow_on.gif")" width="13" height="8" alt="sort descending" title="sort descending" border="0" /></a> 
+ #else
+ #set ($arrowLink = $link.setPage("$scarabR.CurrentTemplate").setPathInfo("sortPolarity", "desc").setPathInfo("sortColumn", "$shortName").setPathInfo("pageNum", $pageNum.toString()).setPathInfo("resultsPerPage", $resultsPerPage.toString()).setPathInfo("searchString", $searchString).setPathInfo("searchfield", $searchField))
+ <a href="$arrowLink"><img src="$staticLink.setPath("/images/icon_uparrow_on.gif")" width="13" height="8" alt="sort ascending" title="sort ascending" border="0" /></a> 
+ #end $longName
+ #else
+ #set ($sortLink = $link.setPage("$scarabR.CurrentTemplate").setPathInfo("sortColumn", "$shortName").setPathInfo("sortPolarity", "$sortPolarity").setPathInfo("pageNum", $pageNum.toString()).setPathInfo("resultsPerPage", $resultsPerPage.toString()).setPathInfo("searchString", $searchString).setPathInfo("searchfield", $searchField))
+ <a href="$sortLink">$longName</a>
+ #end
+#end
+
+#**
+ * Outputs information about issues that have been modified prior to
+ * the latest suggested changes. Expects $lastActivities to exist in the
+ * context as given by the BaseModifyIssue action.
+ *#
+#macro (printCollisionInfo)
+#if ($lastActivities && !$lastActivities.isEmpty())
+ <p class="infomark"><em>
+ $l10n.LastActivity
+ </em></p>
+ #foreach ($obj in $lastActivities)
+ #set ($issue = $obj.get(0))
+ #set ($activitySet = $obj.get(1))
+ #set ($user = $scarabR.getUser($activitySet.CreatedBy))
+ <p>$l10n.format('IssueLastModifiedBy', "$issue.UniqueId")
+ <a href="mailto:$user.Email">$!user.Name</a> </p>
+ <ul>
+ #foreach ($activity in $activitySet.Activitys)
+ <li>$activity.getDescription($l10n)</li>
+ #end
+ </ul>
+ #end
+#end
+#end
+
+#macro (asterisk)
+<small>(</small><b class="asterisk">*</b> <small>$l10n.RequiredFields)</small>
+#end
+
+#macro (showAsterisk)
+<b class="asterisk">*</b>
+#end
+
+
+#macro (userList $mitList $includeAny $includeCommittedBy $parameters $activeOnly)
+#set ($userAttrs = $mitList.getCommonUserAttributes($activeOnly))
+#set ($modules = $mitList.Modules)
+
+
+## SORTING
+#set ($sortColumn = $data.Parameters.getString("sortColumn","username"))
+#set ($sortPolarity = $data.Parameters.getString("sortPolarity","asc"))
+
+## PAGINATION
+## if results exceed limit, get subset list
+#set ($resultsPerPage = $data.Parameters.getInt("resultsPerPage", 25))
+#set ($pageNum = $data.Parameters.getInt("pageNum", 1))
+
+## USER SEARCH
+<h3><a name="add">$l10n.Users</a></h3>
+<div class="axial">
+
+<table border="0" cellspacing="2" cellpadding="3">
+ <tr>
+ <th>$l10n.FilterThisList</th>
+ <td><input type="text" name="searchString" value="$!searchString" />
+ <select name="searchField">
+ <option value="FullName" #if($searchField.equals("FullName")) selected="selected"#end>$l10n.FullName</option>
+ <option value="Username" #if($searchField.equals("Username")) selected="selected"#end>$l10n.Username</option>
+ </select> <input type="submit" name="eventSubmit_doRefresh" value="$l10n.Filter" /></td>
+ </tr>
+</table>
+</div>
+
+#if ($searchString && $searchString.length() > 0)
+ #set ($searchResults = $scarabR.getUserFilteredSearchResults($mitList, $pageNum, $resultsPerPage, $sortColumn, $sortPolarity, $includeCommittedBy))
+ #if ( $searchResults.getList().isEmpty())
+ <p class="infomark"><em>$l10n.NoUsersMatch</em></p>
+ #set ($searchResults = $scarabR.getUserSearchResults($mitList, $pageNum, $resultsPerPage, $sortColumn, $sortPolarity, $includeCommittedBy))
+ #end
+#else
+ #set ($searchResults = $scarabR.getUserSearchResults($mitList, $pageNum, $resultsPerPage, $sortColumn, $sortPolarity, $includeCommittedBy))
+#end
+
+#set ($searchResultsSize = $searchResults.getTotalListSize())
+#set ($searchResultsList = $searchResults.getList())
+
+#set ($paginated = ($resultsPerPage > 0 && $searchResultsSize > $resultsPerPage))
+#if ($paginated)
+ #paginateWithSearch ($resultsPerPage $pageNum $sortColumn $sortPolarity $searchString $searchField $parameters)
+#end
+
+#if (!$searchResultsList || $searchResultsList.isEmpty())
+ <p><em>$l10n.NoUsersAvailable</em></p>
+#else
+
+ <table width="100%" border="1" cellspacing="2" cellpadding="3">
+ <tr>
+ <th nowrap="nowrap">$l10n.Select</th>
+ #set ($linkPage = $scarabG.replace($data.Target, '/', ','))
+
+ <th>#userSort ("username" "$l10n.Username" $linkPage $parameters)</th>
+ <th>#userSort ("name" "$l10n.FullName" $linkPage $parameters)</th>
+ <th>$l10n.Association</th>
+ </tr>
+ #foreach ($user in $searchResultsList)
+ #indexedRows($velocityCount)
+ <td><input type="checkbox" name="add_user" value="$user.UserId" /></td>
+ <td><a href="mailTo:$user.Email">$user.UserName</a></td>
+ <td>$user.Name</td>
+ <td><select name="user_attr_$user.UserId">
+ #if ($includeAny)
+ <option value="any">$l10n.Any</option>
+ #end
+ #if ($includeCommittedBy && $user.hasPermission($scarabG.Permission.ISSUE__ENTER, $modules))
+ <option value="created_by">$l10n.CreatedBy</option>
+ #end
+ #foreach ($userAttr in $userAttrs)
+ #if ($user.hasPermission($userAttr.Permission, $modules))
+ #set($userAttrName = $scarabR.getRModuleAttributeDisplayName($userAttr,$mitList))
+ <option value="$userAttr.AttributeId">$userAttrName</option>
+ #end
+ #end
+ </select></td>
+ </tr>
+ #end
+ </table>
+
+#if ($paginated)
+ #paginateWithSearch ($resultsPerPage $pageNum $sortColumn $sortPolarity $searchString $searchField $parameters)
+#end
+
+<div class="axial">
+ <table cellpadding="3" cellspacing="2" border="0">
+ <tr>
+ <th>$l10n.MaxPerPage</th>
+ <td>
+ #resultsPerPageRadioSelect($resultsPerPage false)
+  <input type="submit" name="eventSubmit_doRefreshresultsperpage" value="$l10n.Refresh" />
+ <input type="hidden" name="oldResultsPerPage" value="$resultsPerPage" />
+ </td>
+ </tr>
+ </table>
+</div>
+
+## keep track of state of the list, resultsPerPage should come after the
+## chance to change it, because we will use the first value
+<input type="hidden" name="sortColumn" value="$sortColumn" />
+<input type="hidden" name="sortPolarity" value="$sortPolarity" />
+<input type="hidden" name="pageNum" value="$pageNum" />
+<input type="hidden" name="resultsPerPage" value="$resultsPerPage" />
+
+##end ## ends the if (!$searchResultsList || $searchResultsList.isEmpty()) statement
+#end ## ends the if (!$userAttrs || $userAttrs.isEmpty()) statement
+#end
+
+
+## ---------------------------------------------------------------------------
+## Date related macros
+## ---------------------------------------------------------------------------
+
+#macro(selectDay $defaultDay)
+ #foreach ($i in [1..31])
+ <option value="$i"#if("$defaultDay" == "$i") selected="selected"#end>$i</option>
+ #end
+#end
+
+#macro(selectHour $defaultHour)
+ #foreach ($i in [0..23])
+ <option value="$i"#if("$defaultHour" == "$i") selected="selected"#end>$i:00</option>
+ #end
+#end
+
+#macro(printMonth $i $name $defaultMonth)
+ <option value="$i"#if( $defaultMonth == $i ) selected="selected"#end>$name</option>
+#end
+
+#macro(selectMonth $defaultMonth)
+ #printMonth(1 $l10n.January $defaultMonth)
+ #printMonth(2 $l10n.February $defaultMonth)
+ #printMonth(3 $l10n.March $defaultMonth)
+ #printMonth(4 $l10n.April $defaultMonth)
+ #printMonth(5 $l10n.May $defaultMonth)
+ #printMonth(6 $l10n.June $defaultMonth)
+ #printMonth(7 $l10n.July $defaultMonth)
+ #printMonth(8 $l10n.August $defaultMonth)
+ #printMonth(9 $l10n.September $defaultMonth)
+ #printMonth(10 $l10n.October $defaultMonth)
+ #printMonth(11 $l10n.November $defaultMonth)
+ #printMonth(12 $l10n.December $defaultMonth)
+#end
+
+#macro(selectYear $currentYear $selectedYear)
+ #set ($minYear = $selectedYear - 4)
+ #set ($maxYear = $selectedYear + 4)
+ #selectYear2($minYear $maxYear $selectedYear)
+#end
+
+#macro(selectYear2 $minYear $maxYear $selectedYear)
+ #foreach ($year in [$minYear..$maxYear])
+ <option value="$year"
+ #if("$selectedYear" == "$year")selected="selected"#end
+ >$year</option>
+ #end
+#end
+
+#* -------------------------------------------------------------------------
+Prints out a date entry form.
+------------------------------------------------------------------------- *#
+#macro(dateEntry $yearField $currentYear $selectedYear $monthField $selectedMonth $dayField $selectedDay $hourField $selectedHour)
+ <input name="$yearField" value="$selectedYear"></input> $l10n.YearMark
+
+ <select name="$monthField">
+ #selectMonth($selectedMonth)
+ </select> $l10n.MonthMark
+
+ <select name="$dayField">
+ #selectDay($selectedDay)
+ </select> $l10n.DayMark
+ -
+ <select name="$hourField">
+ #selectHour($selectedHour)
+ </select> $l10n.TimeMark
+#end
+
+## ---------------------------------------------------------------------------
+
+
+
+#macro(entryTemplateAndAttributes $issue $moduleAttributeGroups $buttonName $buttonEvent $showTemplates)
+#set ($module = $issue.Module)
+#set ($issueType = $issue.IssueType)
+
+#if ($moduleAttributeGroups.isEmpty())
+<h3>$title</h3>
+<p><em>$l10n.format('NoAttributesDefinedForIssueType',$issueType.getName())</em></p>
+#else
+
+#if ($showTemplates)
+#set ($allTemplates = $scarabR.getAllIssueTemplates($issueType))
+#if ($allTemplates.size() > 0)
+<h3>$l10n.format("ApplyTemplate", $module.getRModuleIssueType($issueType).DisplayName.toLowerCase())</h3>
+<div class="axial">
+ <table cellpadding="3" cellspacing="2" border="0">
+ <tr>
+ <th>$l10n.Templates</th>
+ <td>
+<select name="templateId"
+ onchange="javascript:submitFormTo(this.form, 'eventSubmit_doUsetemplates');">
+ <option value="">$l10n.Choose</option>
+#foreach ($template in $allTemplates)
+ <option value="$template.Issue.IssueId"#if ($template.IssueId.toString().equals($data.Parameters.getString("templateId"))) selected="selected"#end>$template.Name</option>
+#end
+</select>
+<noscript>
+ 
+<input type="submit" value="$l10n.Select" name="eventSubmit_doUsetemplates" />
+</noscript>
+ 
+$link.setPage("TemplateList.vm").setLabel($l10n.format("ViewAllTemplates", $module.getRModuleIssueType($issueType).DisplayName.toLowerCase()))
+ </td>
+ </tr>
+ </table>
+</div>
+#end
+#end
+
+
+<div class="functnbar">
+<input type="submit" value="$buttonName" name="$buttonEvent" /> 
+<input type="reset" value="$l10n.Reset" name="eventSubmit_doRefresh" />
+</div>
+
+#set ($templateId = $data.Parameters.getString("templateId"))
+#if ($templateId && $templateId.trim().length() > 0)
+ #set ($templ = $scarabR.getIssueTemplate($templateId))
+ $user.setLastEnteredTemplate($templ)
+ <input type="hidden" name="templateId" value="$templateId"/>
+#else
+ $user.setLastEnteredIssueType($issueType)
+#end
+
+<div class="axial">
+#foreach ($group in $moduleAttributeGroups)
+ #if (!$group.Attributes.isEmpty() && $group.isVisible4User($user))
+ <h4>$group.Name #asterisk()</h4>
+ <table cellpadding="3" cellspacing="2" border="0" width="100%">
+ #foreach ($att in $group.Attributes)
+ #set ($rma = $module.getRModuleAttribute($att, $issueType))
+ #if ($rma.Active)
+ ## reset to a new $attVal in the event the issue/template does not
+ ## have it defined
+ #set ($attVal = $scarabR.getNewAttributeValue($att, $issue))
+ ## this may leave the previous value, if RHS is null
+ #set ($attVal = $issue.getAttributeValue($att))
+
+ #if (!$attVal.Attribute.isUserAttribute())
+ #if ($attVal.Attribute.AttributeType.ValidationKey)
+ #set ($field = $attVal.Attribute.AttributeType.ValidationKey)
+ #elseif ($attVal.Attribute.AttributeType.Name == $scarabG.Constant.DROPDOWN_LIST)
+ #set ($field = "OptionId")
+ #else
+ #set ($field = "Value")
+ #end
+ <tr>
+ <th> #if ($attVal.isRequired()) #showAsterisk() #end
+ $attVal.RModuleAttribute.DisplayValue
+ </th>
+ <td>
+ #if ($attVal.Attribute.isOptionAttribute())
+ #if ($templ)
+ #set ($templAttVal = $scarabR.getNewAttributeValue($att, $templ))
+ ## this may leave the previous value, if RHS is null
+ #set ($templAttVal = $templ.getAttributeValue($att))
+ #templateAttrValueLeafSelect ($attVal $templAttVal $field "" false)
+ #else
+ #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
+ #set ($templAttVal = $templ.getAttributeValue($att))
+ #if ($templAttVal.Value)
+ #templateAttrValueText ( $attVal $fieldSize $templAttVal )
+ #else
+ #attrValueText ( $attVal $fieldSize $fieldHint)
+ #end
+ #else
+ #attrValueText ( $attVal $fieldSize $fieldHint)
+ #end
+ #end
+ #attrValueErrorMsg ($attVal $field)
+ </td>
+ </tr>
+ #end
+ #end
+ #end
+ </table>
+ #end
+#end
+</div>
+#end
+
+#end
Modified: trunk/src/webapp/scripts/sstree.js
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/webapp/scripts/sstree.js?view=diff&pathrev=10777&r1=10776&r2=10777
==============================================================================
--- trunk/src/webapp/scripts/sstree.js (original)
+++ trunk/src/webapp/scripts/sstree.js 2009-07-10 08:56:25-0700
@@ -33,7 +33,10 @@
var lists = getElementsByClassName(document, tags[i], "treeview");
for (var j = 0; j < lists.length; j++)
{
- lists[j].style.display = "none";
+ if (lists[j].className.indexOf('root') === -1)
+ {
+ lists[j].style.display = "none";
+ }
}
}
var e = document.getElementById("root");
@@ -67,3 +70,57 @@
}
return (arrReturnElements)
}
+
+
+function renderJSONTreePopup(key, value, root) {
+ document.writeln('<div id="' + key + ':Popup" class="tree_popup"><ol class="treeview root">');
+ for (var i = 0; i < root._children.length; i++) {
+ renderJSONTree(key, value, root._children[i]);
+ }
+ document.writeln('</ol></div>');
+}
+
+function renderJSONTree(key, value, root) {
+ if (root.optionId == value) {
+ document.getElementById(key + ':Display').value = root.displayValue;
+ }
+
+ document.writeln('<li>');
+
+ if (root._children.length > 0) {
+ document.writeln('<a class="folder" onclick="toggle(this,\'/scarab/images\');"></a><a href="javascript:clickTree(\'' + key + '\', \'' + root.optionId + '\', \'' + root.displayValue + '\');">' + root.displayValue + '</a>');
+ document.writeln('<ol class="treeview">');
+ for (var i = 0; i < root._children.length; i++) {
+ renderJSONTree(key, value, root._children[i]);
+ }
+ document.writeln('</ol>');
+ }
+ else {
+ document.writeln('<a href="javascript:clickTree(\'' + key + '\', \'' + root.optionId + '\', \'' + root.displayValue + '\');">' + root.displayValue + '</a>');
+ }
+
+ document.writeln('</li>');
+}
+
+function toggleTreePopup(key, caller) {
+ if (document.getElementById(key + ':Popup').style.display !== 'inline-block') {
+ var pos = getAnchorPosition(key + ':Anchor');
+
+ document.getElementById(key + ':Popup').style.display = 'inline-block';
+ document.getElementById(key + ':Popup').style.left = pos.x + 'px';
+ document.getElementById(key + ':Popup').style.top = pos.y + 'px';
+
+ if (document.layers) {
+ document.captureEvents(Event.MOUSEUP);
+ }
+ document.onmouseup = function() { document.getElementById(key + ':Popup').style.display = 'none' };
+ }
+ else {
+ document.getElementById(key + ':Popup').style.display = 'none';
+ }
+}
+
+function clickTree(key, value, display) {
+ document.getElementById(key).value = value;
+ document.getElementById(key + ':Display').value = display;
+}
\ No newline at end of file
Modified: trunk/src/webapp/skins/custom.css
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/webapp/skins/custom.css?view=diff&pathrev=10777&r1=10776&r2=10777
==============================================================================
--- trunk/src/webapp/skins/custom.css (original)
+++ trunk/src/webapp/skins/custom.css 2009-07-10 08:56:25-0700
@@ -58,5 +58,28 @@
background-image: url(images/closed.png);
padding-left:20px;
}
+
-
\ No newline at end of file
+
+div.tree_popup {
+ background-color: white;
+ display: none;
+ max-height: 200px;
+ overflow-x: hidden;
+ overflow-y: auto;
+ position: absolute;
+ width: 300px;
+}
+
+div.tree_popup ol.treeview {
+ list-style: none;
+ padding: 0px;
+ margin: 0px;
+}
+
+div.tree_popup ol.treeview li {
+ font-size: x-small;
+ margin-bottom: 1px;
+ margin-top: 3px;
+ padding-left: 40px;
+}
\ No newline at end of file
------------------------------------------------------
http://scarab.tigris.org/ds/viewMessage.do?dsForumId=3577&dsMessageId=2369818