You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by id...@apache.org on 2008/02/11 15:50:20 UTC
svn commit: r620497 - 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: idus
Date: Mon Feb 11 06:50:18 2008
New Revision: 620497
URL: http://svn.apache.org/viewvc?rev=620497&view=rev
Log:
TOBAGO-325: applied patch; thanks to Helmut
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/calendar.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=620497&r1=620496&r2=620497&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 Mon Feb 11 06:50:18 2008
@@ -99,7 +99,7 @@
UICommand okButton = (UICommand) popup.findComponent("ok" + DatePickerController.CLOSE_POPUP);
attributes = okButton.getAttributes();
- attributes.put(ATTR_ACTION_ONCLICK, "writeIntoField2(this);Tobago.closePopup(this);");
+ attributes.put(ATTR_ACTION_ONCLICK, "var textBox = writeIntoField2(this);Tobago.closePopup(this);textBox.focus();");
attributes.put(TobagoConstants.ATTR_POPUP_CLOSE, "afterSubmit");
// okButton.setActionListener(datePickerController);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/calendar.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/calendar.js?rev=620497&r1=620496&r2=620497&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/calendar.js (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/calendar.js Mon Feb 11 06:50:18 2008
@@ -228,7 +228,7 @@
function writeIntoField2(obj) {
var id = obj.id;
var index = id.lastIndexOf(':');
- writeIntoField(id.substring(0, index));
+ return writeIntoField(id.substring(0, index));
}
@@ -261,8 +261,9 @@
}
var date = new Date(year, month - 1, day, hour, minute, second);
textBox.value = formatDate(date, document.calendar.formatPattern);
- textBox.focus();
+// textBox.focus();
// alert(document.calendar.formatPattern);
+ return textBox;
}
// ------------------------------------------------------------------
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=620497&r1=620496&r2=620497&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 Mon Feb 11 06:50:18 2008
@@ -883,6 +883,49 @@
Tobago.removeCssClass(iframe, "tobago-popup-none");
}
}
+
+ // 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);
+ }
+ hidden.value = ",";
+ var firstPopupElement = null;
+ for (var 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;
+ }
+ }
+ }
+ }
+ for (var 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;
+ }
+ }
+ }
+ }
+ // set focus on first element in popup
+ if (firstPopupElement != null) {
+ firstPopupElement.focus();
+ }
+
},
popupResizeStub: null,
@@ -953,6 +996,23 @@
Tobago.removeEventListener(window, "resize", Tobago.popupResizeStub);
Tobago.popupResizeStub = null;
+
+ // enable all elements on page not initially disabled
+ 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;
+ }
+ }
+ }
},
openPopupWithAction: function(popupId, actionId, options) {
@@ -1486,13 +1546,13 @@
return undefined;
}
if (! (typeof arg == 'undefined')) {
- LOG.error("arg is unknown: " + typeof arg + " : " + arg);
+ LOG.error("arg is unknown: " + typeof arg + " : " + arg);
}
return undefined;
},
extend: function(target, source) {
- for (property in source) {
+ for (var property in source) {
target[property] = source[property];
}
return target;