You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2012/02/14 10:50:49 UTC

svn commit: r1243853 - in /myfaces/tobago/branches/tobago-1.0.x: example/test/src/main/webapp/tc/popup/popup-bug-tobago-1091.xhtml theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js

Author: lofwyr
Date: Tue Feb 14 09:50:49 2012
New Revision: 1243853

URL: http://svn.apache.org/viewvc?rev=1243853&view=rev
Log:
TOBAGO-1091: Closing a Popup with defaultCommand="true" will flush checkboxes on the page
 - the code to unlock the fields on the main page should be called in the "onsubmit" and not in the "submitAction" method, to ensure this also works with default commands.

Added:
    myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/tc/popup/popup-bug-tobago-1091.xhtml
Modified:
    myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js

Added: myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/tc/popup/popup-bug-tobago-1091.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/tc/popup/popup-bug-tobago-1091.xhtml?rev=1243853&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/tc/popup/popup-bug-tobago-1091.xhtml (added)
+++ myfaces/tobago/branches/tobago-1.0.x/example/test/src/main/webapp/tc/popup/popup-bug-tobago-1091.xhtml Tue Feb 14 09:50:49 2012
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+
+<f:view
+    xmlns:tc="http://myfaces.apache.org/tobago/component"
+    xmlns:tx="http://myfaces.apache.org/tobago/extension"
+    xmlns:ui="http://java.sun.com/jsf/facelets"
+    xmlns:f="http://java.sun.com/jsf/core">
+
+  <tc:page width="800px" height="300px" id="page">
+
+    <tc:box label="TOBAGO-1091">
+      <f:facet name="layout">
+        <tc:gridLayout rows="fixed;*;fixed;fixed;fixed"/>
+      </f:facet>
+      <tc:link
+          label="Bug-Tracking: TOBAGO-1091" link="https://issues.apache.org/jira/browse/TOBAGO-1091"/>
+      <tc:out escape="false" value="Close popup with defaultCommand uncheckes a checkbox on main page.
+      &lt;br/>Checklist:
+      &lt;ol>
+      &lt;li>Check: checkbox is checked&lt;/li>
+      &lt;li>Click on the open button&lt;/li>
+      &lt;li>Click on the close button&lt;/li>
+      &lt;li>Check: checkbox is checked&lt;/li>
+      &lt;/ol>"/>
+
+      <tx:in label="Input" value="test" fieldId="in"/>
+      <tx:selectBooleanCheckbox label="Checkbox" value="true" fieldId="check"/>
+
+      <tc:panel>
+        <f:facet name="layout">
+          <tc:gridLayout columns="fixed;*"/>
+        </f:facet>
+        <tc:button label="Open Popup" id="open">
+          <f:facet name="popup">
+            <tc:popup width="100px" height="100px" id="popup">
+              <tc:box label="Popup" id="box">
+                <f:facet name="layout">
+                  <tc:gridLayout rows="*;fixed"/>
+                </f:facet>
+                <tc:panel/>
+                <tc:button label="Close" id="close" defaultCommand="true">
+                  <tc:attribute name="popupClose" value="afterSubmit"/>
+                </tc:button>
+              </tc:box>
+            </tc:popup>
+          </f:facet>
+        </tc:button>
+      </tc:panel>
+    </tc:box>
+  </tc:page>
+</f:view>

Modified: myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=1243853&r1=1243852&r2=1243853&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Tue Feb 14 09:50:49 2012
@@ -323,6 +323,16 @@ var Tobago = {
     var clientDimension = this.createInput("hidden", this.form.id + '-clientDimension');
     clientDimension.value = document.body.clientWidth + ";" + document.body.clientHeight;
     this.form.appendChild(clientDimension);
+
+    if (Tobago.openPopups.length > 0) {
+      // enable all elements on page when this is a submit from a popup
+      // (disabled input elements are not submitted)
+      for (var i = 0; i < document.forms[0].elements.length; i++) {
+        var element = document.forms[0].elements[i];
+        element.disabled = false;
+      }
+    }
+
     Tobago.onBeforeUnload();
     return true;
   },
@@ -504,15 +514,6 @@ var Tobago = {
       this.form.appendChild(lastFocusId);
     }
     Tobago.setActionPosition(source);
-    //LOG.inof("submitAction OpenPopups " + Tobago.openPopups);
-    if (Tobago.openPopups.length > 0) {
-      // enable all elements on page when this is a submit from a popup
-      // (disabled input elements are not submitted)
-      for (var i = 0; i < document.forms[0].elements.length; i++) {
-        var element = document.forms[0].elements[i];
-        element.disabled = false;
-      }
-    }
 
     Tobago.Transport.request(function() {
       if (!this.isSubmit) {