Invoke javascript through Mixin with actionLink and click event

2010-07-02 Thread SakshiAgarwal

Hi,

In the below example, I am trying to invoke javascript when I click on
Approve link and also on Disapprove. [While disapproving, I am submitting
the form as I want to submit reported category along with it, while on
approve I am just changing the status[approve/disapprove] of my photo in
java code ]
Photos.tml
t:loop source=photoDetails value=each index=counter  
   div t:type=zone t:id=photoZone id=prop:zoneId
t:form t:id=formId t:zone=prop:zoneId
   t:hidden value=counter/
 [t:actionlink t:id=approvePhotos context=${counter} zone=prop:zoneId
t:mixins=ConfirmApprove/t:actionlink]
 pt:label for=reportedCategory/
 t:select t:id=reportedCategory t:label=Category//p
 input type=submit t:type=submit t:id=photo value=Disapprove Photo
onClick=extraStep(${counter}); /
 /t:form
   /div
 /t:loop   

Everything works fine, except that my javascript code is invoked when I move
from Index page to Photos page and not on clicking 'approve link'. The logic
which I have used for Disapprove doesn't work with 'approve' actionLink.

my Confirm.java is as follows:
@IncludeJavaScriptLibrary(Confirm.js)
public class Confirm {

@Parameter(value = Are you sure?, defaultPrefix =
BindingConstants.LITERAL)
private String message;

@Inject
private RenderSupport renderSupport;

@InjectContainer
private ClientElement element;

@AfterRender
public void afterRender() {
renderSupport.addScript(String.format(new Confirm('%s');,
  element.getClientId()));
}
   
}

Confirm.js
var Confirm = Class.create();
Confirm.prototype = {
initialize: function(element) {
alert(element + element);
Event.observe($(element), 'click',
this.doConfirm.bindAsEventListener(this));
},

doConfirm: function(e) {
e.style.display = 'none';
alert(in javascript in js file);
e.stop();
}
}

Kindly help me as to how can I invoke javascript on clicking approve link.

Looking forward for your support.

Regards
Sakshi
-- 
View this message in context: 
http://old.nabble.com/Invoke-javascript-through-Mixin-with-actionLink-and-click-event-tp29052536p29052536.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



ajaxformloop query

2010-07-02 Thread Jim O'Callaghan
I've been playing around with ajaxformloop for the guts of a day and am
having some issues with it I'm hoping someone can set me straight on.  I see
that DefaultPrimaryKeyEncoder is deprecated (I'm using T5.2.0-SNAPSHOT) and
I'm getting a different object with the same identifier value was already
associated with the session from hibernate.  I've seen this before and am
familiar with the hibernate reason for it.  Can anyone point to a good
concise up to date example of using the ajaxformloop?   Is it necessary to
specify an encoder anymore?  Thanks.

 

Regards,

Jim. 



Re: ajaxformloop query

2010-07-02 Thread Thiago H. de Paula Figueiredo
On Fri, 02 Jul 2010 14:19:24 -0300, Jim O'Callaghan  
j...@peritussolutions.com wrote:



I've been playing around with ajaxformloop for the guts of a day and am
having some issues with it I'm hoping someone can set me straight on.  I  
see that DefaultPrimaryKeyEncoder is deprecated (I'm using  
T5.2.0-SNAPSHOT) and I'm getting a different object with the same  
identifier value was already associated with the session from  
hibernate.  I've seen this before and am familiar with the hibernate  
reason for it.  Can anyone point to a good
concise up to date example of using the ajaxformloop?   Is it necessary  
to specify an encoder anymore?  Thanks.


You're having a pure Hibernate issue, not related to Tapestry. By any  
chance are you using Session.update()? User Session.merge() instead.


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: ajaxformloop query

2010-07-02 Thread Josh Canfield
 I'm getting a different object with the same identifier value was already
 associated with the session from hibernate.

When are you seeing the error? I don't use ajaxformloop but I'd guess
that your object is getting deserialized from the loop data stored in
the form.  Then you are trying to save the deserialized object instead
of the one that you probably looked up in the db from an event
method..

If you use a debugger you can trace the problem back by:
1. use a setter for your data object
2. set a break point in the setter
3. look at the stacktrace to see who's setting the value.

if you aren't using a debugger you can just dump the stack trace from
the setter.
new Throwable().getStackTrace();

Hope something in that is useful...
Josh

On Fri, Jul 2, 2010 at 10:19 AM, Jim O'Callaghan
j...@peritussolutions.com wrote:
 I've been playing around with ajaxformloop for the guts of a day and am
 having some issues with it I'm hoping someone can set me straight on.  I see
 that DefaultPrimaryKeyEncoder is deprecated (I'm using T5.2.0-SNAPSHOT) and
 I'm getting a different object with the same identifier value was already
 associated with the session from hibernate.  I've seen this before and am
 familiar with the hibernate reason for it.  Can anyone point to a good
 concise up to date example of using the ajaxformloop?   Is it necessary to
 specify an encoder anymore?  Thanks.



 Regards,

 Jim.





-- 
--
http://www.bodylabgym.com - a private, by appointment only, one-on-one
health and fitness facility.
--
http://www.ectransition.com - Quality Electronic Cigarettes at a
reasonable price!
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



RE: ajaxformloop query

2010-07-02 Thread Jim O'Callaghan
Josh, Thiago,

Thanks for the responses.  I can get around the hibernate issue by storing
my objects in a list persisted in the session (cleared when the page is
detached), and updating them with the ones from the form, but what I'm
trying to get at more is the correct approach to take regarding the
ajaxformloop - should I be using a temporary list for this kind of thing and
should I be using DefaultPrimaryKeyEncoder / PrimaryKeyEncoder for lookups
against my list, or are they deprecated and if so what is the preferred new
approach?  I see the relevant demo page uses @CommitAfter after updating the
form to get id creation triggered - my preference would be to use some
unique marker ids so the form can function and then blank them before
committing the whole transaction in onSuccess.  Thanks as always for your
helpful replies.

Regards,
Jim.

-Original Message-
From: Josh Canfield [mailto:joshcanfi...@gmail.com] 
Sent: 02 July 2010 19:10
To: Tapestry users
Subject: Re: ajaxformloop query

 I'm getting a different object with the same identifier value was already
 associated with the session from hibernate.

When are you seeing the error? I don't use ajaxformloop but I'd guess
that your object is getting deserialized from the loop data stored in
the form.  Then you are trying to save the deserialized object instead
of the one that you probably looked up in the db from an event
method..

If you use a debugger you can trace the problem back by:
1. use a setter for your data object
2. set a break point in the setter
3. look at the stacktrace to see who's setting the value.

if you aren't using a debugger you can just dump the stack trace from
the setter.
new Throwable().getStackTrace();

Hope something in that is useful...
Josh

On Fri, Jul 2, 2010 at 10:19 AM, Jim O'Callaghan
j...@peritussolutions.com wrote:
 I've been playing around with ajaxformloop for the guts of a day and am
 having some issues with it I'm hoping someone can set me straight on.  I
see
 that DefaultPrimaryKeyEncoder is deprecated (I'm using T5.2.0-SNAPSHOT)
and
 I'm getting a different object with the same identifier value was already
 associated with the session from hibernate.  I've seen this before and am
 familiar with the hibernate reason for it.  Can anyone point to a good
 concise up to date example of using the ajaxformloop?   Is it necessary to
 specify an encoder anymore?  Thanks.



 Regards,

 Jim.





-- 
--
http://www.bodylabgym.com - a private, by appointment only, one-on-one
health and fitness facility.
--
http://www.ectransition.com - Quality Electronic Cigarettes at a
reasonable price!
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Tapestry-security 0.2.0 released!

2010-07-02 Thread Pierce Wetter

On Jul 1, 2010, at 11:39 PM, Borut Bolčina wrote:

 That is a wonderful news! As it just happens, I will begin to code a new T5
 app just today, and guess what, I won't craft a new security solution by
 myself thanks to you guys. :-)
 
 I've used tapestry-spring-security for our former project (200K registered
 users) so I am very interested to see what is the overall experience in
 using this new Shiro-Tapestry combo. I see it has some nice components out
 of the box which is very cool.
 
 I thought of starting this new T5 app with 5.2-SNAPSHOT, what are the
 chances it will work?
 
 Re

   It's working for me, I'm using 5.2.0-SNAPSHOT. 

   I tried to use tapestry-spring-security, but the login part, which was what 
I needed to customize the most, defeated me, and so I ported myself to 
tapestry-security. My only real problem with porting myself was that I only 
have about 4 significant letters in my brain so I kept confusing authentication 
with authorization. 

  Pierce


-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Tapestry-security 0.2.0 released!

2010-07-02 Thread Pierce Wetter

 That is a wonderful news! As it just happens, I will begin to code a new T5
 app just today, and guess what, I won't craft a new security solution by
 myself thanks to you guys. :-)

  Oh, and the whole permissions thing rocks. Having just roles was never going 
to do it for me. 

 Pierce


-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Ajax Problem with 5.2

2010-07-02 Thread Pierce Wetter

On Jul 1, 2010, at 4:57 PM, Howard Lewis Ship wrote:

 Details about Tapestry version, browser version, any custom JS you've
 written, steps taken, maybe some of your page class and template.

  Ok, issue entered:

https://issues.apache.org/jira/browse/TAP5-1200

 Templates provided. 

Pierce


-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Tapestry 5 + Google App Engine - initial success!

2010-07-02 Thread Chris Mylonas
Hi,

I'm pretty new around here but thought I would let you know that this post
by Christophe Dufour works.
http://blog.dooapp.com/running-tapestry5-maven-on-google-app-engine

You can check it out here: http://tapgae1.appspot.com/
It's pretty much the default tapestry5 maven archetype with a link to
Christophe's instructions.

I googled for tapestry appengine and there didn't appear to be any recent
success stories so thought I'd let you all know.

Cheers
Chris


Re: Tapestry-security 0.2.0 released!

2010-07-02 Thread Kalle Korhonen
On Thu, Jul 1, 2010 at 11:39 PM, Borut Bolčina borut.bolc...@gmail.com wrote:
 I've used tapestry-spring-security for our former project (200K registered
 users) so I am very interested to see what is the overall experience in
 using this new Shiro-Tapestry combo. I see it has some nice components out
 of the box which is very cool.

I used to be a long-time user of Acegi Security myself but eventually
got fed up with the convoluted and inflexible API, so I started
searching for alternatives and the rest is history as they say.

 I thought of starting this new T5 app with 5.2-SNAPSHOT, what are the
 chances it will work?

Your mileage will vary. As Pierce commented, you can use
tapestry-security with 5.2 right now but there are a few issues and we
are not officially supporting it, whatever that means for an open
source project. Specifically, the issue is related to handling
annotation-originated security exceptions. It's handled by an advice
for an exception handler, and apparently T5.2 doesn't allow you to
anymore simply do PageResponseRenderer.renderPageResponse() after
you've started processing a different page, but throws
org.apache.tapestry5.ioc.internal.util.TapestryException: The
identity of the active page for this request has not yet been
established. Makes sense really. Anyhow, it's not a major issue, I'll
see if there's a way to do some reinitialization or perhaps more
likely, I'll use the handy-dandy tapestry-exceptionpage module for
this case as well - even if you start your project right now I'm sure
I'll get a new version of tapestry-security out before you are
anywhere close to completing your project.

Kalle


 2010/7/2 Kalle Korhonen kalle.o.korho...@gmail.com

 As an Apache Shiro committer and a strong proponent of Tapestry, I'm
 proud to announce the 0.2.0 release and immediate availability of
 tapestry-security module, which represents the best and most
 comprehensive security framework integration for Tapestry 5
 applications. I can say that since it's largely written by others :)
 Tapestry-security is based on the great work by Valentin Yerastov, the
 original author of tapestry-jsecurity. Later on, JSecurity became an
 Apache project and was renamed to Apache Shiro, the first official
 release of which (as an Apache project) was recently made. Alejandro
 Scandroli, who else, updated the code to use the latest Shiro APIs and
 finally, we added a few other bells and whistles on top of it all.
 Pierce Wetter gets an honorable mention of being a guinea pig and
 starting to use tapestry-security all without documentation (so it
 can't be that bad). Now both tapestry-security and Shiro even have
 proper documentation, read more from our tapestry-security guide
 (http://tynamo.org/tapestry-security+guide). Hope you find the module
 as useful as we have!

 Enjoy,
 Tynamo team

 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org