Re: AjaxModalDialog.close(context()) being ignored

2011-02-04 Thread Paul Hoadley
Hi Timo,

On 03/02/2011, at 3:15 AM, Timo Hoepfner wrote:

 ERXApplication.erxApplication().pageWithName(SuccessTextEmail.class, 
 (WOContext) context().clone())
 
 or
 
 ERXApplication.erxApplication().pageWithName(SuccessTextEmail.class, 
 (WOContext) ERXWOContext.currentContext().clone())

Bingo: works as intended.  Thanks a lot for that.


-- 
Paul.

http://logicsquad.net/


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: AjaxModalDialog.close(context()) being ignored

2011-02-04 Thread Paul Hoadley
Hi Chuck,

On 03/02/2011, at 7:13 AM, Chuck Hill wrote:

 Meanwhile, I've stumbled across what is presumably the relevant difference 
 in the action methods: the problem button's action method sends some emails 
 using (indirectly) ERMailDelivery.  At some point a WOComponent is created 
 (even for plain text mails—good templating system), for example:
 
  SuccessTextEmail component = 
 ERXApplication.erxApplication().pageWithName(SuccessTextEmail.class);
 
 Commenting out the component creation (and returning some dummy text 
 instead) lets the AMD close as intended.  Is this component creation messing 
 with the operation of AjaxModalDialog.close(WOContext)?
 
 As Timo pointed out, that will mess up the current context.  It might also 
 mess with the response.  That is probably causing this code:
 
 currentDialog(context).closeDialog();
 AjaxUtils.javascriptResponse(AjaxModalDialog.Close, context);
 
 to send back an unusable response.  I would be interested to know what is 
 getting sent back to see if we can find a way to get the AMD to play nice.

If I'm reading Firebug correctly, clicking the action button sends a POST 
request, and the server responds with the content generated by the 
SuccessTextEmail component (!), and finally AMD.close();.  Obviously sending 
back the email content is completely wrong, and presumably the JS interpreter 
barfs before it can execute AMD.close(), though interestingly I can't find any 
complaints about that anywhere.

Chuck, if this is interesting to you, I can certainly do some more testing, 
though I'm happy with Timo's solution.  I'm not really looking at a _bug_ of 
any sort here anyway, am I?  These email-generating components are used 
completely behind the back of the browser, so I should have known to clone the 
context in the first place.  It's a bit much to expect this _not_ to cause 
problems the way I was doing it, isn't it?


-- 
Paul.

http://logicsquad.net/


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: AjaxModalDialog.close(context()) being ignored

2011-02-04 Thread Chuck Hill
On Feb 4, 2011, at 3:02 AM, Paul Hoadley wrote:
 On 03/02/2011, at 7:13 AM, Chuck Hill wrote:
 
 Meanwhile, I've stumbled across what is presumably the relevant difference 
 in the action methods: the problem button's action method sends some emails 
 using (indirectly) ERMailDelivery.  At some point a WOComponent is created 
 (even for plain text mails—good templating system), for example:
 
 SuccessTextEmail component = 
 ERXApplication.erxApplication().pageWithName(SuccessTextEmail.class);
 
 Commenting out the component creation (and returning some dummy text 
 instead) lets the AMD close as intended.  Is this component creation 
 messing with the operation of AjaxModalDialog.close(WOContext)?
 
 As Timo pointed out, that will mess up the current context.  It might also 
 mess with the response.  That is probably causing this code:
 
 currentDialog(context).closeDialog();
 AjaxUtils.javascriptResponse(AjaxModalDialog.Close, context);
 
 to send back an unusable response.  I would be interested to know what is 
 getting sent back to see if we can find a way to get the AMD to play nice.
 
 If I'm reading Firebug correctly, clicking the action button sends a POST 
 request, and the server responds with the content generated by the 
 SuccessTextEmail component (!), and finally AMD.close();.  Obviously 
 sending back the email content is completely wrong, and presumably the JS 
 interpreter barfs before it can execute AMD.close(), though interestingly I 
 can't find any complaints about that anywhere.

I think it interprets the AMD.close(); as text.  It depends on what the 
content-type is.  That should be wrapped in script.../script for an 
text/html content type.


 Chuck, if this is interesting to you, I can certainly do some more testing, 
 though I'm happy with Timo's solution.  I'm not really looking at a _bug_ of 
 any sort here anyway, am I?  These email-generating components are used 
 completely behind the back of the browser, so I should have known to clone 
 the context in the first place.  It's a bit much to expect this _not_ to 
 cause problems the way I was doing it, isn't it?


The bug, if there is one, is that the Ajax framework is not wrapping 
AMD.close(); in script tags.  The code in question is in AjaxUtils:

public static void appendScriptHeaderIfNecessary(WORequest request, 
WOResponse response) {
if (AjaxUpdateContainer.hasUpdateContainerID(request)) {
AjaxUtils.appendScriptHeader(response);
}
else {
response.setHeader(text/javascript, Content-Type);
}
}

It is looking for an update container ID where I thought I was looking for a 
content-type.  We could add a check for existing response content and type, but 
maybe it is better to just file this under don't do that!.  :-)

Chuck





-- 
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall 
knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects









smime.p7s
Description: S/MIME cryptographic signature
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: AjaxModalDialog.close(context()) being ignored

2011-02-02 Thread Timo Hoepfner


Am 02.02.2011 um 06:21 schrieb Paul Hoadley:

	SuccessTextEmail component =  
ERXApplication.erxApplication().pageWithName(SuccessTextEmail.class);




This will pollute the current context. Try

ERXApplication.erxApplication().pageWithName(SuccessTextEmail.class,  
(WOContext) context().clone())


or

ERXApplication.erxApplication().pageWithName(SuccessTextEmail.class,  
(WOContext) ERXWOContext.currentContext().clone())



instead.

Timo


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: AjaxModalDialog.close(context()) being ignored

2011-02-02 Thread Chuck Hill

On Feb 1, 2011, at 9:21 PM, Paul Hoadley wrote:

 Hi Chuck,
 
 On 02/02/2011, at 2:40 PM, Chuck Hill wrote:
 
 You can also use the JS AMD.close(); to close it.  You should not NEED to 
 do this, but it may provide a clue as to what is or is not wrong.
 
 I've added that to the 'onComplete' binding, and it solves the problem 
 (with and without 'evalScripts=$true').  It's a bit unsatisfying though—I 
 wonder why AjaxModalDialog.close(context()) is working for some buttons but 
 not others.
 
 It has to be one of two things: 
 - the time to close message is not getting to the server
 - the hide the dialog message is not getting to the browser
 
 The first implies the second.  Could there be a structure change in the page 
 that is making the button not exist?  Otherwise, you will need to use the 
 source and take a look at what is getting to the server and what is getting 
 sent back.
 
 There shouldn't be a structural change, no, but I will check.
 
 Meanwhile, I've stumbled across what is presumably the relevant difference in 
 the action methods: the problem button's action method sends some emails 
 using (indirectly) ERMailDelivery.  At some point a WOComponent is created 
 (even for plain text mails—good templating system), for example:
 
   SuccessTextEmail component = 
 ERXApplication.erxApplication().pageWithName(SuccessTextEmail.class);
 
 Commenting out the component creation (and returning some dummy text instead) 
 lets the AMD close as intended.  Is this component creation messing with the 
 operation of AjaxModalDialog.close(WOContext)?

As Timo pointed out, that will mess up the current context.  It might also mess 
with the response.  That is probably causing this code:

currentDialog(context).closeDialog();
AjaxUtils.javascriptResponse(AjaxModalDialog.Close, context);

to send back an unusable response.  I would be interested to know what is 
getting sent back to see if we can find a way to get the AMD to play nice.

Chuck

-- 
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall 
knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects









smime.p7s
Description: S/MIME cryptographic signature
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

AjaxModalDialog.close(context()) being ignored

2011-02-01 Thread Paul Hoadley
Hello,

I'm using WO 5.4.3, and Ajax.framework that I downloaded just now to see if 
there had been a fix, but the rest of Wonder from a month or so ago.

I have a page that contains two AjaxModalDialogs with different 'id' bindings.  
They're quite similar, both containing two AjaxSubmitButtons, one of which is a 
Cancel button, the other performs some task.  The action methods for both of 
those task buttons are pretty similar: perform a task, 
AjaxModalDialog.close(context());, return null.  One of the AMDs closes after 
the action is performed, the other doesn't.  The page gets updated properly 
behind the translucent drop-down, but I have to click the 'X' button to close 
the AMD.

I can't put my finger on any relevant differences between the two AMDs, or 
their action methods.  I've simplified the page and removed the AMD that 
functions correctly, the other one still fails to respond to 
AjaxModalDialog.close(context()) when it's the only AMD on the page.  I see 
nothing in Safari's error console.  Firebug shows two fewer GET requests in the 
AMD that's not closing compared to the one that is.

Are there known conditions where AjaxModalDialog.close(context()) will fail?


-- 
Paul.

http://logicsquad.net/


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: AjaxModalDialog.close(context()) being ignored

2011-02-01 Thread Chuck Hill
Hi Paul,

Do both buttons have evalScripts = true?  That method returns JavaScript that 
needs to be evaluated on the client side.  You can also use the JS AMD.close(); 
to close it.  You should not NEED to do this, but it may provide a clue as to 
what is or is not wrong.


Chuck


On Feb 1, 2011, at 7:02 PM, Paul Hoadley wrote:

 Hello,
 
 I'm using WO 5.4.3, and Ajax.framework that I downloaded just now to see if 
 there had been a fix, but the rest of Wonder from a month or so ago.
 
 I have a page that contains two AjaxModalDialogs with different 'id' 
 bindings.  They're quite similar, both containing two AjaxSubmitButtons, one 
 of which is a Cancel button, the other performs some task.  The action 
 methods for both of those task buttons are pretty similar: perform a task, 
 AjaxModalDialog.close(context());, return null.  One of the AMDs closes after 
 the action is performed, the other doesn't.  The page gets updated properly 
 behind the translucent drop-down, but I have to click the 'X' button to close 
 the AMD.
 
 I can't put my finger on any relevant differences between the two AMDs, or 
 their action methods.  I've simplified the page and removed the AMD that 
 functions correctly, the other one still fails to respond to 
 AjaxModalDialog.close(context()) when it's the only AMD on the page.  I see 
 nothing in Safari's error console.  Firebug shows two fewer GET requests in 
 the AMD that's not closing compared to the one that is.
 
 Are there known conditions where AjaxModalDialog.close(context()) will fail?
 
 
 -- 
 Paul.
 
 http://logicsquad.net/
 
 
 ___
 Do not post admin requests to the list. They will be ignored.
 Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net
 
 This email sent to ch...@global-village.net

-- 
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall 
knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects









smime.p7s
Description: S/MIME cryptographic signature
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: AjaxModalDialog.close(context()) being ignored

2011-02-01 Thread Paul Hoadley
Hi Chuck,

On 02/02/2011, at 1:41 PM, Chuck Hill wrote:

 Do both buttons have evalScripts = true?  That method returns JavaScript that 
 needs to be evaluated on the client side.

None of the buttons have that binding.  (Didn't know it was needed.)  Adding it 
to the problem button has no effect, though.

 You can also use the JS AMD.close(); to close it.  You should not NEED to do 
 this, but it may provide a clue as to what is or is not wrong.

I've added that to the 'onComplete' binding, and it solves the problem (with 
and without 'evalScripts=$true').  It's a bit unsatisfying though—I wonder 
why AjaxModalDialog.close(context()) is working for some buttons but not others.

Thanks Chuck.


-- 
Paul.

http://logicsquad.net/


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: AjaxModalDialog.close(context()) being ignored

2011-02-01 Thread Chuck Hill

On Feb 1, 2011, at 7:54 PM, Paul Hoadley wrote:

 Hi Chuck,
 
 On 02/02/2011, at 1:41 PM, Chuck Hill wrote:
 
 Do both buttons have evalScripts = true?  That method returns JavaScript 
 that needs to be evaluated on the client side.
 
 None of the buttons have that binding.  (Didn't know it was needed.)  Adding 
 it to the problem button has no effect, though.

I am uncertain myself when that is needed and when not.  I have run into some 
cases where it is needed.



 You can also use the JS AMD.close(); to close it.  You should not NEED to do 
 this, but it may provide a clue as to what is or is not wrong.
 
 I've added that to the 'onComplete' binding, and it solves the problem (with 
 and without 'evalScripts=$true').  It's a bit unsatisfying though—I wonder 
 why AjaxModalDialog.close(context()) is working for some buttons but not 
 others.


It has to be one of two things: 
- the time to close message is not getting to the server
- the hide the dialog message is not getting to the browser

The first implies the second.  Could there be a structure change in the page 
that is making the button not exist?  Otherwise, you will need to use the 
source and take a look at what is getting to the server and what is getting 
sent back.  If you have a simple reproduction,  I can take a look at it. I have 
tracked a few problems down, it is usually not hard.


Chuck

-- 
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall 
knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects









smime.p7s
Description: S/MIME cryptographic signature
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: AjaxModalDialog.close(context()) being ignored

2011-02-01 Thread Paul Hoadley
Hi Chuck,

On 02/02/2011, at 2:40 PM, Chuck Hill wrote:

 You can also use the JS AMD.close(); to close it.  You should not NEED to 
 do this, but it may provide a clue as to what is or is not wrong.
 
 I've added that to the 'onComplete' binding, and it solves the problem (with 
 and without 'evalScripts=$true').  It's a bit unsatisfying though—I wonder 
 why AjaxModalDialog.close(context()) is working for some buttons but not 
 others.
 
 It has to be one of two things: 
 - the time to close message is not getting to the server
 - the hide the dialog message is not getting to the browser
 
 The first implies the second.  Could there be a structure change in the page 
 that is making the button not exist?  Otherwise, you will need to use the 
 source and take a look at what is getting to the server and what is getting 
 sent back.

There shouldn't be a structural change, no, but I will check.

Meanwhile, I've stumbled across what is presumably the relevant difference in 
the action methods: the problem button's action method sends some emails using 
(indirectly) ERMailDelivery.  At some point a WOComponent is created (even for 
plain text mails—good templating system), for example:

SuccessTextEmail component = 
ERXApplication.erxApplication().pageWithName(SuccessTextEmail.class);

Commenting out the component creation (and returning some dummy text instead) 
lets the AMD close as intended.  Is this component creation messing with the 
operation of AjaxModalDialog.close(WOContext)?


-- 
Paul.

http://logicsquad.net/


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com