You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by sn...@apache.org on 2006/01/12 00:29:34 UTC

svn commit: r368170 - in /incubator/roller/trunk: src/org/roller/presentation/tags/DateTag.java web/weblog/CommentManagementSidebar.jsp

Author: snoopdave
Date: Wed Jan 11 15:29:30 2006
New Revision: 368170

URL: http://svn.apache.org/viewcvs?rev=368170&view=rev
Log:
First part of fix for ROL-969

Modified:
    incubator/roller/trunk/src/org/roller/presentation/tags/DateTag.java
    incubator/roller/trunk/web/weblog/CommentManagementSidebar.jsp

Modified: incubator/roller/trunk/src/org/roller/presentation/tags/DateTag.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/tags/DateTag.java?rev=368170&r1=368169&r2=368170&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/tags/DateTag.java (original)
+++ incubator/roller/trunk/src/org/roller/presentation/tags/DateTag.java Wed Jan 11 15:29:30 2006
@@ -13,109 +13,113 @@
  * Struts-based date field tag that wraps Matt Kruze's JavaScript data chooser.
  * @jsp.tag name="Date"
  */
-public class DateTag extends TagSupport
-{
+public class DateTag extends TagSupport {
     static final long serialVersionUID = 1485100916981692535L;
     
     // Unique key prefix keeps us from colliding with other tags and user data
     public static final String KEY_PREFIX = "ZZZ_DATETAG_ZZZ";
-
+    
     private String property = null;
     private String dateFormat = null;
     private Boolean readOnly = Boolean.FALSE;
-
+    private String formName = null;
+    
     private static Log mLogger =
-        LogFactory.getFactory().getInstance(DateTag.class);
-
+            LogFactory.getFactory().getInstance(DateTag.class);
+    
     /**
      * Renders date field by calling a JSP page.
      */
-    public int doStartTag() throws JspException
-    {
-
+    public int doStartTag() throws JspException {
+        
         // Get form name
         ActionMapping mapping =
-            (ActionMapping) pageContext.getRequest().getAttribute(
+                (ActionMapping) pageContext.getRequest().getAttribute(
                 Globals.MAPPING_KEY);
-        String formName = mapping.getName();
-
+        if (formName == null) {
+            formName = mapping.getName();
+        }
+        
         // Get value of form field
         Object value =
-            RequestUtils.lookup(pageContext, formName, property, null);
+                RequestUtils.lookup(pageContext, formName, property, null);
         if (value == null)
             value = "";
-
+        
         // put variables into request scope for view page
         pageContext.getRequest().setAttribute(
-            KEY_PREFIX + "_formName",
-            formName);
+                KEY_PREFIX + "_formName",
+                formName);
         pageContext.getRequest().setAttribute(
-            KEY_PREFIX + "_property",
-            property);
+                KEY_PREFIX + "_property",
+                property);
         pageContext.getRequest().setAttribute(
-            KEY_PREFIX + "_dateFormat",
-            dateFormat);
+                KEY_PREFIX + "_dateFormat",
+                dateFormat);
         pageContext.getRequest().setAttribute(
-            KEY_PREFIX + "_readOnly",
-            readOnly);
+                KEY_PREFIX + "_readOnly",
+                readOnly);
         pageContext.getRequest().setAttribute(KEY_PREFIX + "_value", value);
-
+        
         // dispatch to view page
-        try
-        {
+        try {
             pageContext.include("/tags/date.jsp");
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             // can't handle this here
             throw new JspException("ERROR including date.jsp");
         }
-
+        
         // Don't evaluate content of tag, just continue processing this page
         return (SKIP_BODY);
     }
-
+    
     /**
      * Date format string to be used.
-     * 
+     *
      * @jsp.attribute required="true" rtexprvalue="true" type="java.lang.String"
      */
-    public String getDateFormat()
-    {
+    public String getDateFormat() {
         return dateFormat;
     }
+    
+    public void setDateFormat(String dateFormat) {
+        this.dateFormat = dateFormat;
+    }
 
     /**
-     * Name of form property represented. 
+     * Name of form property represented.
      * @jsp.attribute required="true" rtexprvalue="true" type="java.lang.String"
      */
-    public String getProperty()
-    {
+    public String getProperty() {
         return property;
     }
-
+    
+    public void setProperty(String property) {
+        this.property = property;
+    }
+    
     /**
-     * True if field should be readOnly. 
+     * True if field should be readOnly.
      * @jsp.attribute required="false" rtexprvalue="true" type="java.lang.Boolean"
      */
-    public Boolean getReadOnly()
-    {
+    public Boolean getReadOnly() {
         return readOnly;
     }
-
-    public void setDateFormat(String dateFormat)
-    {
-        this.dateFormat = dateFormat;
+        
+    public void setReadOnly(Boolean readOnly) {
+        this.readOnly = readOnly;
     }
-
-    public void setProperty(String property)
-    {
-        this.property = property;
+    
+    /**
+     * Form name, only needed when more than one form on page.
+     * @jsp.attribute required="false" rtexprvalue="true" type="java.lang.String"
+     */
+    public String getFormName() {
+        return formName;
     }
-
-    public void setReadOnly(Boolean readOnly)
-    {
-        this.readOnly = readOnly;
+        
+    public void setFormName(String formName) {
+        this.formName = formName;
     }
-
+    
 }

Modified: incubator/roller/trunk/web/weblog/CommentManagementSidebar.jsp
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/web/weblog/CommentManagementSidebar.jsp?rev=368170&r1=368169&r2=368170&view=diff
==============================================================================
--- incubator/roller/trunk/web/weblog/CommentManagementSidebar.jsp (original)
+++ incubator/roller/trunk/web/weblog/CommentManagementSidebar.jsp Wed Jan 11 15:29:30 2006
@@ -84,7 +84,7 @@
         <label for="startDateString" class="sideformrow">
            <fmt:message key="commentManagement.startDate" />:
         </label>
-        <roller:Date property="startDateString" 
+        <roller:Date property="startDateString" formName="commentQueryForm"
             dateFormat='<%= model.getShortDateFormat() %>' />
     </div>
         
@@ -92,7 +92,7 @@
         <label for="endDateString" class="sideformrow">
            <fmt:message key="commentManagement.endDate" />:
         </label>
-        <roller:Date property="endDateString" 
+        <roller:Date property="endDateString" formName="commentQueryForm"
             dateFormat='<%= model.getShortDateFormat() %>' />
     </div>
     <br />