You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2008/03/26 10:10:38 UTC
svn commit: r641213 - in /myfaces/tobago/trunk/theme:
scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/
scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/
stan...
Author: bommel
Date: Wed Mar 26 02:10:36 2008
New Revision: 641213
URL: http://svn.apache.org/viewvc?rev=641213&view=rev
Log:
TOBAGO-325 Popups background not disabled Thanks to Helmut Swaczinna
Modified:
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tree.js
myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java?rev=641213&r1=641212&r2=641213&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java Wed Mar 26 02:10:36 2008
@@ -107,7 +107,7 @@
UICommand cancelButton = (UICommand) popup.findComponent(DatePickerController.CLOSE_POPUP);
attributes = cancelButton.getAttributes();
- attributes.put(ATTR_ACTION_ONCLICK, "Tobago.closePopup(this);");
+ attributes.put(ATTR_ACTION_ONCLICK, "var textBox = writeIntoField2(this);Tobago.closePopup(this);textBox.focus();");
attributes.put(TobagoConstants.ATTR_POPUP_CLOSE, "immediate");
//cancelButton.setActionListener(datePickerController);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tree.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tree.js?rev=641213&r1=641212&r2=641213&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tree.js (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tree.js Wed Mar 26 02:10:36 2008
@@ -478,7 +478,8 @@
if (this.marked) {
itemStyle += " tree-item-marker";
}
- str += '<a class="' + itemStyle + '"';
+ str += '<a class="' + itemStyle + '"'
+ + ' id="' + this.id + '_a"';
if (this.tip) {
str += ' title="' + this.tip + '"';
}
Modified: myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=641213&r1=641212&r2=641213&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Wed Mar 26 02:10:36 2008
@@ -222,6 +222,17 @@
isSubmit: false,
+
+ /**
+ * The id of a initially loaded popup (not by ajax)
+ */
+ initialPopupId: null,
+
+ /**
+ * Count of currently open popups
+ */
+ openPopups: 0,
+
// -------- Functions -------------------------------------------------------
@@ -261,7 +272,11 @@
Tobago.startScriptLoaders();
TbgTimer.endScriptLoaders = new Date();
Tobago.pageIsComplete = true;
- Tobago.setFocus();
+ if (Tobago.initialPopupId != null) {
+ Tobago.lockPopupPage(Tobago.initialPopupId);
+ } else {
+ Tobago.setFocus();
+ }
TbgTimer.endTotal = new Date();
TbgTimer.log();
},
@@ -447,6 +462,16 @@
transition = true;
}
LOG.info("transition =" + transition);
+
+ if (Tobago.openPopups > 0) {
+ // enable all elements on page when this is a submit from a popup
+ // (disabled input elements are not submitted)
+ for (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) {
this.isSubmit = true;
@@ -891,48 +916,62 @@
}
}
- // disable all elements on page not initially disabled
- hidden = Tobago.element(id + Tobago.SUB_COMPONENT_SEP + "disabledElements");
- if (hidden == null) {
- hidden = document.createElement("input");
- hidden.id = id + Tobago.SUB_COMPONENT_SEP + "disabledElements";
- hidden.name = id;
- hidden.type = "hidden";
- document.forms[0].appendChild(hidden);
+ if (!Tobago.pageIsComplete) {
+ // Popup is loaded during page loading
+ Tobago.initialPopupId = id;
+ } else {
+ // Popup is loaded by ajax
+ Tobago.lockPopupPage(id);
}
+ Tobago.openPopups++;
+ },
+
+ /**
+ * Locks the parent page of a popup when it is opened
+ */
+ lockPopupPage: function(id) {
+ // disable all elements and anchors on page not initially disabled and
+ // store their ids in a hidden field
+ var hidden = Tobago.element(id + Tobago.SUB_COMPONENT_SEP + "disabledElements");
+ if (hidden == null) {
+ hidden = document.createElement("input");
+ hidden.id = id + Tobago.SUB_COMPONENT_SEP + "disabledElements";
+ hidden.name = id;
+ hidden.type = "hidden";
+ document.forms[0].appendChild(hidden);
+ }
hidden.value = ",";
var firstPopupElement = null;
- for (var i = 0; i < document.forms[0].elements.length; i++) {
+ for (i = 0; i < document.forms[0].elements.length; i++) {
var element = document.forms[0].elements[i];
if (element.type != "hidden" && !element.disabled) {
if (element.id.indexOf(id) != 0) {
- element.disabled = true;
- hidden.value += element.id + ",";
- } else {
- if (firstPopupElement == null && element.focus) {
- firstPopupElement = element;
- }
- }
- }
+ element.disabled = true;
+ hidden.value += element.id + ",";
+ } else {
+ if (firstPopupElement == null && element.focus) {
+ firstPopupElement = element;
+ }
+ }
+ }
}
- for (var i = 0; i < document.anchors.length; i++) {
+ for (i = 0; i < document.anchors.length; i++) {
var element = document.anchors[i];
if (!element.disabled) {
if (element.id.indexOf(id) != 0) {
- element.disabled = true;
- hidden.value += element.id + ",";
- } else {
- if (firstPopupElement == null && element.focus) {
- firstPopupElement = element;
- }
- }
- }
+ element.disabled = true;
+ hidden.value += element.id + ",";
+ } else {
+ if (firstPopupElement == null && element.focus) {
+ firstPopupElement = element;
+ }
+ }
+ }
}
- // set focus on first element in popup
+ // set focus to first element in popup
if (firstPopupElement != null) {
- firstPopupElement.focus();
+ firstPopupElement.focus();
}
-
},
popupResizeStub: null,
@@ -1003,23 +1042,36 @@
Tobago.removeEventListener(window, "resize", Tobago.popupResizeStub);
Tobago.popupResizeStub = null;
+
+ Tobago.unlockPopupPage(id);
+ Tobago.openPopups--;
+
+ // reset focus when last popup was closed
+ if (Tobago.openPopups == 0) {
+ Tobago.setFocus();
+ }
+ },
- // enable all elements on page not initially disabled
- hidden = Tobago.element(id + Tobago.SUB_COMPONENT_SEP + "disabledElements");
+ /**
+ * Unlock the parent page of a popup when it is closed
+ */
+ unlockPopupPage: function(id) {
+ // enable all elements and anchors on page stored in a hidden field
+ var hidden = Tobago.element(id + Tobago.SUB_COMPONENT_SEP + "disabledElements");
if (hidden != null && hidden.value != "") {
- for (var i = 0; i < document.forms[0].elements.length; i++) {
- var element = document.forms[0].elements[i];
- if (hidden.value.indexOf("," + element.id + ",") >= 0) {
- element.disabled = false;
- }
- }
- for (var i = 0; i < document.anchors.length; i++) {
- var element = document.anchors[i];
- if (hidden.value.indexOf("," + element.id + ",") >= 0) {
- element.disabled = false;
- }
- }
- }
+ for (i = 0; i < document.forms[0].elements.length; i++) {
+ var element = document.forms[0].elements[i];
+ if (hidden.value.indexOf("," + element.id + ",") >= 0) {
+ element.disabled = false;
+ }
+ }
+ for (i = 0; i < document.anchors.length; i++) {
+ var element = document.anchors[i];
+ if (hidden.value.indexOf("," + element.id + ",") >= 0) {
+ element.disabled = false;
+ }
+ }
+ }
},
openPopupWithAction: function(popupId, actionId, options) {