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:42:43 UTC
svn commit: r641223 - in /myfaces/tobago/branches/tobago-1.0.x: ./
theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/
theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarboro...
Author: bommel
Date: Wed Mar 26 02:42:42 2008
New Revision: 641223
URL: http://svn.apache.org/viewvc?rev=641223&view=rev
Log:
Merged revisions 620497-620568,620570-627557,627559-627767,627769-627770,627772-627812,627814-628512,628514-630186,630188-631519,631521-633996,633998-634000,634003-634027,634029,634031-634346,634348-634349,634351-634357,634359-635495,635498-635528,635530-636711,636713-636715,636717-636718,636720-636725,636727,636729-636738,636743-636745,636747-636777,636779-637838,637840-637939,637942-637943,637945-637974,637976-637977,637979-637987,637989-638365,638367-638423,638425,638427-638448,638450-638455,638457,638460-638463,638465-638466,638468,638471,638475,638482,638484,638486-638494,638496,638499-638556,638558-638577,638579-638588,638590-638721,638723,638728-638730,638732-638958,638960-638969,638971-639972,639976-639987,639989-640187,640190-640756,640759-640767,640769-641028,641030-641194,641196-641213 via svnmerge from
https://svn.apache.org/repos/asf/myfaces/tobago/trunk
........
r620497 | idus | 2008-02-11 15:50:18 +0100 (Mo, 11 Feb 2008) | 1 line
TOBAGO-325: applied patch; thanks to Helmut
........
r641213 | bommel | 2008-03-26 10:10:36 +0100 (Mi, 26 Mär 2008) | 1 line
TOBAGO-325 Popups background not disabled Thanks to Helmut Swaczinna
........
Modified:
myfaces/tobago/branches/tobago-1.0.x/ (props changed)
myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/calendar.js
myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tree.js
myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
Propchange: myfaces/tobago/branches/tobago-1.0.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java?rev=641223&r1=641222&r2=641223&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java Wed Mar 26 02:42:42 2008
@@ -99,13 +99,13 @@
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);
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/branches/tobago-1.0.x/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/calendar.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/calendar.js?rev=641223&r1=641222&r2=641223&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/calendar.js (original)
+++ myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/calendar.js Wed Mar 26 02:42:42 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/branches/tobago-1.0.x/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tree.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tree.js?rev=641223&r1=641222&r2=641223&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tree.js (original)
+++ myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tree.js Wed Mar 26 02:42:42 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/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=641223&r1=641222&r2=641223&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 Wed Mar 26 02:42:42 2008
@@ -217,6 +217,17 @@
isSubmit: false,
+
+ /**
+ * The id of a initially loaded popup (not by ajax)
+ */
+ initialPopupId: null,
+
+ /**
+ * Count of currently open popups
+ */
+ openPopups: 0,
+
// -------- Functions -------------------------------------------------------
@@ -256,7 +267,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();
},
@@ -438,6 +453,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;
@@ -885,6 +910,63 @@
Tobago.removeCssClass(iframe, "tobago-popup-none");
}
}
+
+ 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 (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 (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 to first element in popup
+ if (firstPopupElement != null) {
+ firstPopupElement.focus();
+ }
},
popupResizeStub: null,
@@ -955,6 +1037,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();
+ }
+ },
+
+ /**
+ * 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 (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) {
@@ -1487,13 +1599,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;