[Lift] Re: Exception for S.? while booting

2009-08-05 Thread marius d.

I'm aware about the override thing but I don't see why you would do it
in such way. Since you don't have state, you don't have a session =
you don't have S. Are you using a statelesDispatchPf ?

You can do:

1. Use your own ResourceBundles
2. Or a hacky thingy like:

val session = LiftRules.getLiftSession(request, httpRequest)
S.initIfUninitted(session) {
   // Now you should be able to call call S.?(...)
}

Localization is bound to state as ResourceBundles

You exception thrown in Boot probably was cause because you used a val
and it obviously tried to initialize it. Using a def or lazy val it
would be evaluated properly upon requests.

Typically S.? is used in the context of page rendering, Ajax functions
processing, DispatchPF. All these are executed in a stateful context
where S is available. To process pure stateless requests you have
LiftRules.statelessDispatchTable, and a few request processing
hooks ... but do you really need those?

Do you have a usecase when you want to process a pure stateless
requests and need Lift's localization?

Br's,
Marius

On Aug 5, 8:50 am, Heiko Seeberger heiko.seeber...@googlemail.com
wrote:
 def can be overridden with val. But this is a Scala thingy, please do not
 bother. If it makes you easier replace val with def.
 The question remains: How can i18n be done in stateless (request state)
 cases?

 2009/8/5 marius d. marius.dan...@gmail.com





  I thought validations is a function not a val:

  override val validations should probably be

  override def validations ?

  or

  override lazy val validations ?

  Br's,
  Marius

  On Aug 5, 7:48 am, Heiko Seeberger heiko.seeber...@googlemail.com
  wrote:
   I would like to internationalize my code. Something like:
   Mapper class:

   class Course
     extends LongKeyedMapper[Course]
     with IdPK {

     ...

       override val validations =
         valMinLen(3, ?(minLen, 3)) _ ::
         valMaxLen(50, ?(maxLen, 50)) _ ::
         Nil
     }

   Localized messages:

   minLen=At least %s characters required!
   maxLen=At most %s characters allowed!

   Thanx
   Heiko

   2009/8/4 marius d. marius.dan...@gmail.com

S lifetime is per request. S is not constructed on Boot. Could you
post a code snippet on what you're trying to achieve?

Br's,
Marius

On Aug 4, 12:43 pm, Heiko Seeberger heiko.seeber...@googlemail.com
wrote:
 Hi,

 When I try to use internationalization via S.? in a Mapper class, I
  get
the
 below exception while booting Lift. It seems that S._resBundle is
  null
when
 Schemifier tries to do its work.

 Is this a bug or a feature (S must not be used outside the request
  life
 cycle). If last, how to i18n then?

 Thanx
 Heiko

 0 [main] ERROR lift - Failed to Boot
 java.lang.ExceptionInInitializerError
 at bootstrap.liftweb.Boot.boot(Boot.scala:38)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at

  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at

  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:585)
 at

  net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply(ClassHelpers.scala:408)
 at

  net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply(ClassHelpers.scala:406)
 at

  net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply(LiftRules.scala:1096)
 at

  net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply(LiftRules.scala:1096)
 at net.liftweb.util.Full.map(Box.scala:330)
 at net.liftweb.http.DefaultBootstrap$.boot(LiftRules.scala:1096)
 at net.liftweb.http.LiftFilter.bootLift(LiftServlet.scala:560)
 at net.liftweb.http.LiftFilter.init(LiftServlet.scala:534)
 at
  org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
 at

  org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
 at

  org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:653)
 at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
 at

  org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1239)
 at

  org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
 at
  org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:466)
 at

  org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:124)
 at

  org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
 at

  org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
 at

  org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
 at

  org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
 at

  org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
 at

  

[Lift] Re: Exception for S.? while booting

2009-08-05 Thread Naftoli Gugenheim

The point marius was making is that if it was a def or lazy val it wouldn't get 
called so early.

-
Heiko Seebergerheiko.seeber...@googlemail.com wrote:

def can be overridden with val. But this is a Scala thingy, please do not
bother. If it makes you easier replace val with def.
The question remains: How can i18n be done in stateless (request state)
cases?

2009/8/5 marius d. marius.dan...@gmail.com


 I thought validations is a function not a val:

 override val validations should probably be

 override def validations ?

 or

 override lazy val validations ?

 Br's,
 Marius

 On Aug 5, 7:48 am, Heiko Seeberger heiko.seeber...@googlemail.com
 wrote:
  I would like to internationalize my code. Something like:
  Mapper class:
 
  class Course
extends LongKeyedMapper[Course]
with IdPK {
 
...
 
  override val validations =
valMinLen(3, ?(minLen, 3)) _ ::
valMaxLen(50, ?(maxLen, 50)) _ ::
Nil
}
 
  Localized messages:
 
  minLen=At least %s characters required!
  maxLen=At most %s characters allowed!
 
  Thanx
  Heiko
 
  2009/8/4 marius d. marius.dan...@gmail.com
 
 
 
 
 
   S lifetime is per request. S is not constructed on Boot. Could you
   post a code snippet on what you're trying to achieve?
 
   Br's,
   Marius
 
   On Aug 4, 12:43 pm, Heiko Seeberger heiko.seeber...@googlemail.com
   wrote:
Hi,
 
When I try to use internationalization via S.? in a Mapper class, I
 get
   the
below exception while booting Lift. It seems that S._resBundle is
 null
   when
Schemifier tries to do its work.
 
Is this a bug or a feature (S must not be used outside the request
 life
cycle). If last, how to i18n then?
 
Thanx
Heiko
 
0 [main] ERROR lift - Failed to Boot
java.lang.ExceptionInInitializerError
at bootstrap.liftweb.Boot.boot(Boot.scala:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
 
  
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
 
  
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
 
  
 net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply(ClassHelpers.scala:408)
at
 
  
 net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply(ClassHelpers.scala:406)
at
 
  
 net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply(LiftRules.scala:1096)
at
 
  
 net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply(LiftRules.scala:1096)
at net.liftweb.util.Full.map(Box.scala:330)
at net.liftweb.http.DefaultBootstrap$.boot(LiftRules.scala:1096)
at net.liftweb.http.LiftFilter.bootLift(LiftServlet.scala:560)
at net.liftweb.http.LiftFilter.init(LiftServlet.scala:534)
at
 org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
at
  
 org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at
 
  
 org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:653)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at
 
  
 org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1239)
at
  
 org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
at
 org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:466)
at
 
  
 org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:124)
at
  
 org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at
 
  
 org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
at
 
  
 org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
at
  
 org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at
 
  
 org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
at
  
 org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at
  
 org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:222)
at
  
 org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at
 
  
 org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132)
at
 
  
 org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:441)
at
 
  
 org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:383)
at
 
  
 org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:210)
at
 org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:184)
at
 
  
 org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:483)
at
 
  
 org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:678)
at
 
  
 

[Lift] Re: Extend StatefulSnippet lifetime

2009-08-05 Thread Naftoli Gugenheim

But when I navigate from that page back will it still be registered?
Page load 1 - snippet instantiated
Button clicked - redirect, register snippet
Page load 2 (somewhere else)
Button clicked - redirect to prev page
Page load 3 - snippet still registered?
Do I have to store a call to registerSnippet in the other page?

-
marius d.marius.dan...@gmail.com wrote:


In StatefulSnippet you have a redirectTo function that essentially
does a redirect with state

The definition is something like:

def redirectTo(where: String) = S.redirectTo(where,
registerThisSnippet)

So you can do it like

S.redirectTo(where, () = registerThisSnippet)

... of course would be a bit more complex but the point is that you
can capture registerThisSnippet function with a lambda expression or
whatever and use it later on when render the page.


Br's,
Marius

On Aug 5, 6:20 am, Naftoli Gugenheim naftoli...@gmail.com wrote:
 How can a StatefulSnippet redirect to a page that does not use it, which 
 links or redirects back to it and it needs to remember its state?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Extend StatefulSnippet lifetime

2009-08-05 Thread marius d.



On Aug 5, 9:16 am, Naftoli Gugenheim naftoli...@gmail.com wrote:
 But when I navigate from that page back will it still be registered?
 Page load 1 - snippet instantiated
 Button clicked - redirect, register snippet
 Page load 2 (somewhere else)

This somewhere else is still a Lift page right? ... if so when page
2 loads your provided function will be executed. You can keep a
reference to registerThisSnippet function say in a RequestVar. When
page 2 renders and you bind a function to that button for function
button you would call S.redirectTo(ur, and the function from your
request-var). hence

 Button clicked - redirect to prev page
 Page load 3 - snippet still registered?
 Do I have to store a call to registerSnippet in the other page?

 -

 marius d.marius.dan...@gmail.com wrote:

 In StatefulSnippet you have a redirectTo function that essentially
 does a redirect with state

 The definition is something like:

 def redirectTo(where: String) = S.redirectTo(where,
 registerThisSnippet)

 So you can do it like

 S.redirectTo(where, () = registerThisSnippet)

 ... of course would be a bit more complex but the point is that you
 can capture registerThisSnippet function with a lambda expression or
 whatever and use it later on when render the page.

 Br's,
 Marius

 On Aug 5, 6:20 am, Naftoli Gugenheim naftoli...@gmail.com wrote:

  How can a StatefulSnippet redirect to a page that does not use it, which 
  links or redirects back to it and it needs to remember its state?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Extend StatefulSnippet lifetime

2009-08-05 Thread Naftoli Gugenheim

Okay. Thanks.

-
marius d.marius.dan...@gmail.com wrote:




On Aug 5, 9:16 am, Naftoli Gugenheim naftoli...@gmail.com wrote:
 But when I navigate from that page back will it still be registered?
 Page load 1 - snippet instantiated
 Button clicked - redirect, register snippet
 Page load 2 (somewhere else)

This somewhere else is still a Lift page right? ... if so when page
2 loads your provided function will be executed. You can keep a
reference to registerThisSnippet function say in a RequestVar. When
page 2 renders and you bind a function to that button for function
button you would call S.redirectTo(ur, and the function from your
request-var). hence

 Button clicked - redirect to prev page
 Page load 3 - snippet still registered?
 Do I have to store a call to registerSnippet in the other page?

 -

 marius d.marius.dan...@gmail.com wrote:

 In StatefulSnippet you have a redirectTo function that essentially
 does a redirect with state

 The definition is something like:

 def redirectTo(where: String) = S.redirectTo(where,
 registerThisSnippet)

 So you can do it like

 S.redirectTo(where, () = registerThisSnippet)

 ... of course would be a bit more complex but the point is that you
 can capture registerThisSnippet function with a lambda expression or
 whatever and use it later on when render the page.

 Br's,
 Marius

 On Aug 5, 6:20 am, Naftoli Gugenheim naftoli...@gmail.com wrote:

  How can a StatefulSnippet redirect to a page that does not use it, which 
  links or redirects back to it and it needs to remember its state?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Or QueryParams

2009-08-05 Thread Timothy Perrett

You can get items from the query string by doing:

S.param(theparam) // Box[T]

Cheers, Tim

On Aug 5, 4:22 am, Naftoli Gugenheim naftoli...@gmail.com wrote:
 How can you Or QueryParams (e.g. find text in any field)?
 Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Dynamically setting class attribute on div or span

2009-08-05 Thread Timothy Perrett

You might want to checkout the wiki - answers to your questions are on
there: http://wiki.github.com/dpp/liftweb

Cheers, Tim

On Aug 4, 11:22 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
 See Exploring Lift 7.6.2.
 In short, the lift:snippet specifies a method that returns extra attributes.
 Also, you can bind an element to a function from NodeSeq to NodeSeq which can 
 do whatever processing it wants.

 -

 Simonnoise...@gmail.com wrote:

 Ignore my question please.  I just read the part where it says that
 Lift is not a MVC framework. :-)

 On Aug 4, 1:53 pm, Simon noise...@gmail.com wrote:



  This seems to be a pretty easy problem to solve.  Maybe I'm just not
  looking at the right place?

  I want to dynamically set the class attribute on a div or span in
  html.  But I don't know how I can do it in Lift.

  If I use something like div class=e:class/, the IDE complains
  that the tag div not closed and I get the following message from the
  web app:

  Message: java.lang.IllegalArgumentException: line 4 does not exist

  Am I missing something here?

  Thanks,

  Simon
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: *** BREAKING CHANGES COMING UP SOON ***

2009-08-05 Thread Timothy Perrett

Portlets have some mixed press, so im not sure how much of a win that
will be. The AsyncWeb / Netty stuff does look pretty freaking cool
tho.

Cheers, Tim

On Aug 4, 10:40 pm, Derek Chen-Becker dchenbec...@gmail.com wrote:
 Cool. I'll have to look at portlets and see what they do.

 Derek

 On Tue, Aug 4, 2009 at 2:38 PM, David Pollak
 feeder.of.the.be...@gmail.comwrote:





  On Tue, Aug 4, 2009 at 1:37 PM, Derek Chen-Becker 
  dchenbec...@gmail.comwrote:

  I don't necessarily have a problem with this, but what's the gain? Are
  there other HTTP frameworks that don't use the javax.servlet API? Just
  curious.

  Yes, Jersey directly, portlets, etc.

  Derek

  On Tue, Aug 4, 2009 at 1:51 PM, Marius marius.dan...@gmail.com wrote:

  Folks,

  I spent a few days decoupling Lift from JEE web container
  dependencies: javax.servlet._ The code is currently in wip-marius-http-
  abstractions.

  I still need to nail down a few things but the idea is:

  1. Lift will work with its own traits that abstracts HTTP request,
  response, HTTP sessions etc.
  2. By default there will be the servlet implementation and it'll work
  as currently.
  3. Certain function names will slightly change.
  4. If your application explicitly wants to use HttpServletRequest
  obtained from S some explicit casts would be needed. Generally Lift
  application should probably not explicitly use javax.servlet._
  references.

  I will post the details of the changes when I'll merge it to master
  (hopefully this week).

  Br's,
  Marius

  --
  Lift, the simply functional web frameworkhttp://liftweb.net
  Beginning Scalahttp://www.apress.com/book/view/1430219890
  Follow me:http://twitter.com/dpp
  Git some:http://github.com/dpp
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Exception for S.? while booting

2009-08-05 Thread Heiko Seeberger
Ah, yes!Sorry, I did not get the point, but obviously the val is to be
blamed ;-)
Now it's running, thanx!!!

Heiko

2009/8/5 marius d. marius.dan...@gmail.com


 I'm aware about the override thing but I don't see why you would do it
 in such way. Since you don't have state, you don't have a session =
 you don't have S. Are you using a statelesDispatchPf ?

 You can do:

 1. Use your own ResourceBundles
 2. Or a hacky thingy like:

 val session = LiftRules.getLiftSession(request, httpRequest)
 S.initIfUninitted(session) {
   // Now you should be able to call call S.?(...)
 }

 Localization is bound to state as ResourceBundles

 You exception thrown in Boot probably was cause because you used a val
 and it obviously tried to initialize it. Using a def or lazy val it
 would be evaluated properly upon requests.

 Typically S.? is used in the context of page rendering, Ajax functions
 processing, DispatchPF. All these are executed in a stateful context
 where S is available. To process pure stateless requests you have
 LiftRules.statelessDispatchTable, and a few request processing
 hooks ... but do you really need those?

 Do you have a usecase when you want to process a pure stateless
 requests and need Lift's localization?

 Br's,
 Marius

 On Aug 5, 8:50 am, Heiko Seeberger heiko.seeber...@googlemail.com
 wrote:
  def can be overridden with val. But this is a Scala thingy, please do not
  bother. If it makes you easier replace val with def.
  The question remains: How can i18n be done in stateless (request state)
  cases?
 
  2009/8/5 marius d. marius.dan...@gmail.com
 
 
 
 
 
   I thought validations is a function not a val:
 
   override val validations should probably be
 
   override def validations ?
 
   or
 
   override lazy val validations ?
 
   Br's,
   Marius
 
   On Aug 5, 7:48 am, Heiko Seeberger heiko.seeber...@googlemail.com
   wrote:
I would like to internationalize my code. Something like:
Mapper class:
 
class Course
  extends LongKeyedMapper[Course]
  with IdPK {
 
  ...
 
override val validations =
  valMinLen(3, ?(minLen, 3)) _ ::
  valMaxLen(50, ?(maxLen, 50)) _ ::
  Nil
  }
 
Localized messages:
 
minLen=At least %s characters required!
maxLen=At most %s characters allowed!
 
Thanx
Heiko
 
2009/8/4 marius d. marius.dan...@gmail.com
 
 S lifetime is per request. S is not constructed on Boot. Could you
 post a code snippet on what you're trying to achieve?
 
 Br's,
 Marius
 
 On Aug 4, 12:43 pm, Heiko Seeberger 
 heiko.seeber...@googlemail.com
 wrote:
  Hi,
 
  When I try to use internationalization via S.? in a Mapper class,
 I
   get
 the
  below exception while booting Lift. It seems that S._resBundle is
   null
 when
  Schemifier tries to do its work.
 
  Is this a bug or a feature (S must not be used outside the
 request
   life
  cycle). If last, how to i18n then?
 
  Thanx
  Heiko
 
  0 [main] ERROR lift - Failed to Boot
  java.lang.ExceptionInInitializerError
  at bootstrap.liftweb.Boot.boot(Boot.scala:38)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at
 
  
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  at
 
  
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:585)
  at
 
  
 net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply(ClassHelpers.scala:408)
  at
 
  
 net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply(ClassHelpers.scala:406)
  at
 
  
 net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply(LiftRules.scala:1096)
  at
 
  
 net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply(LiftRules.scala:1096)
  at net.liftweb.util.Full.map(Box.scala:330)
  at net.liftweb.http.DefaultBootstrap$.boot(LiftRules.scala:1096)
  at net.liftweb.http.LiftFilter.bootLift(LiftServlet.scala:560)
  at net.liftweb.http.LiftFilter.init(LiftServlet.scala:534)
  at
   org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
  at
 
  
 org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
  at
 
  
 org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:653)
  at
 org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
  at
 
  
 org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1239)
  at
 
  
 org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
  at
   org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:466)
  at
 
  
 org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:124)
  at
 
  
 org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
  at
 
  
 

[Lift] Re: Or QueryParams

2009-08-05 Thread Naftoli Gugenheim


-
Timothy Perretttimo...@getintheloop.eu wrote:


You can get items from the query string by doing:

S.param(theparam) // Box[T]

Cheers, Tim

On Aug 5, 4:22 am, Naftoli Gugenheim naftoli...@gmail.com wrote:
 How can you Or QueryParams (e.g. find text in any field)?
 Thanks.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Title function

2009-08-05 Thread Derek Chen-Becker
The snippet itself can bind the title if it has the head inside it.
Something like:

lift:surround at=content
lift:MySnippet.method
head
  titlemysnippet:title //title
/head
...
/lift:MySnippet.method
/lift:surround

This is what I do (with no title element in the default template).

Derek

On Tue, Aug 4, 2009 at 1:47 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:


 Maybe my setup is atypical then :)
 My default.html is does not have a title tag; instead each view has its
 own, relying on head merge.
 I don't know if originally I had it in default using lift:Menu.title or
 not, but the difficulty with that would be that some pages can be used to
 edit or add a new item, and the title needs to reflect that.
 So either (1) I need a way that the value of Menu.title will depend on data
 in various StatefulSnippets; or (2) make the title ambiguous (add/edit
 neutral); or (3) leave the titles in the views and process them with a
 function somehow; or (4) put a snippet in the title of every view to get the
 user.



 -
 David Pollakfeeder.of.the.be...@gmail.com wrote:

 On Sun, Aug 2, 2009 at 4:35 PM, Naftoli Gugenheim naftoli...@gmail.com
 wrote:

 
  How does the Title LocParam work?


 The Title case class has a function that converts the current object
 associated with the Loc into a String representing the title of the page
 represented by the Loc.


 
  Is there a way to modify all titles to e.g. include the logged in user's
  name, without having to edit all the views?


 The title tag is typically defined in the default template.  You could
 include a snippet in the title tag that would contain the user's name.  I
 would see this as separate from the title of the specific page referred to
 by the Loc.Title.


 
 
  
 


 --
 Lift, the simply functional web framework http://liftweb.net
 Beginning Scala http://www.apress.com/book/view/1430219890
 Follow me: http://twitter.com/dpp
 Git some: http://github.com/dpp



 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: jQuery - esp. datepicker

2009-08-05 Thread Derek Chen-Becker
1) yes. That's why I would suggest using a class instead if you have
multiple date fields. We just used an id in this case because there was only
one date field on the page.

2) I agree. I don't know why you were getting that error :(

Lift has jquery bundled with it. You should be able to include it on a page
by adding

head
script id=jquery src=/classpath/jquery.js type=text/javascript/
/head

to your pages ( or to your default template). Is that how you had it set up
when you got the error? The jquery.js file is pulled from
/lift/src/main/resources/toserve under the project root, which will put it
in the lift-webkit.jar file. Currently it's 1.3.2. Sorry, I had missed that
part of your original question.

Derek

On Tue, Aug 4, 2009 at 4:19 PM, Java1Guy mark.cha...@gmail.com wrote:


 Well... only sort-of :(
 1) if you're using the id attribute, doesn't that mean i can only use
 one per page?
 2) i don't think it explains why is was getting the JavaScript
 error...

 In the meantime, I downloaded jQuery and include it explicitly on the
 page and use style classes, so it seems to work well.

 Thanks for the note.
 Mark

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Using ExtJS with Lift?

2009-08-05 Thread Derek Chen-Becker
Your guess is correct. The jquery-ui-min.js contains the datePicker. We used
to use datePicker.js but then we switched to the datePicker that's in jquery
UI.

As for your question about where to put the scripts, you don't want to put
them in src/main/resources/toserve unless you're writing a widget or some
other programmatic user of the scripts. If you'll just be using the scripts
directly in your templates you can just put them in the normal
src/main/webapp tree (I usually make a scripts subdir to segregate things).
Let me know if that doesn't work or if I'm misunderstanding the question.

Derek

On Tue, Aug 4, 2009 at 5:47 PM, Stefan Scott stefanscottal...@gmail.comwrote:


 Thanks for this info, Marius.

 To get started with Lift I'm reading through the excellent book
 Exploring Lift you wrote with Eric and Tyler (version 27 July 2009),
 plus the source for the PocketChange app and liftweb, downloaded from
 GitHub.

 As I'm still finding my way through the various packages and file
 locations, I hope you can bear with me a bit while I think out loud
 here to make sure I understand where to put the .js files and the
 references for JavaScript resources which aren't integrated into
 lift.


 ***
 The only real question I have is way down towards the end of this
 message, at the end of point (a):

 Where do I put the 'toserve' directory, and how do I make sure that
 Maven uses it?

 Feel free to skip most of this lengthy message and just read point (a)
 which is the only real question I have. I'm still just getting used to
 Maven and how it pulls files from various locations either locally or
 online.

 ***


 (1) Searching in directory C:\www\work\PocketChange\ (I'm currently
 serving lift web apps just locally, running Jetty under Windows), I
 see several .js files for JQuery:

 date.js
 jquery.datePicker.js
 jquery.tablesorter.min.js
 jquery-ui.min.js

 in directory:

 C:\www\work\PocketChange\src\main\webapp\scripts\

 So it looks like I could put any needed .js files in that directory.


 Searching for the string .js *inside* all .html files in directory C:
 \www\work\PocketChange, I find the file:

 C:\www\work\PocketChange\src\main\webapp\index.html

 which contains the tag:

 script type=text/javascript src=/scripts/jquery-ui.min.js/
 script

 referencing the file:

 jquery-ui.min.js

 in directory C:\www\work\PocketChange\src\main\webapp\scripts\ above.


 So again it looks like I can put any needed .js files in that
 directory, and reference them in the app's .html file(s) as shown
 above.

 (One strange minor thing I noticed: if I search inside all .html files
 in directory C:\www\work\PocketChange\ for the string datePicker.js,
 it only shows up in lines that have been commented out. So one minor
 curiosity I have is: how is the code for datePicker.js being used?
 There appears to be a definition of it in jquery-ui.min.js, as well as
 a more readable definition of it in datePicker.js as well. I
 understand that JavaScript files are minified to remove unnecessary
 characters - does jquery-ui.min.js include the minified version of
 datePicker? Is file datePicker.js never sent to the browser?)


 (2) The search for the string .js inside all .html files also turned
 up two occurences in file:

 C:\www\work\PocketChange\src\main\webapp\templates-hidden\default.html

 in the tags:

 script id=jquery src=/classpath/jquery.js type=text/
 javascript/script
 script id=json src=/classpath/json.js type=text/javascript/
 script

 These seem to be referring not to individual JavaScript widgets - but
 maybe to entire JavaScript libraries.

 I couldn't find any relevant files called jquery.js on my machine -
 but reading section 7.8 Resource Server in the Exploring Lift book
 (pp. 119-120) I see it says that Maven puts .css (and presumably .js)
 resources to be served *inside* the WAR/JAR file, and lift uses the
 var LiftRules.resourceServerPath:

 var resourceServerPath = classpath

 to find these resources.


 The book goes on to say that in order to find a .css resource in a
 subdirectory such as:

 my-project\src\main\resources\toserve\css\mystyle.css

 I would call the following in Boot:

 ResourceServer.allow {
  case css :: _ = true
 }


 So, examining the lift source code for object ResourceServer in
 package net.liftweb.http (in directory ...\liftweb\lift\src\main\scala
 \net\liftweb\http\), I think I see how this is all put together:

 object ResourceServer {
  private var allowedPaths: PartialFunction[List[String], Boolean] = {
case jquery.js :: Nil = true
case yui :: _ = true
case liftYUI.js :: Nil = true
case json2.js :: Nil = true
case json.js :: Nil = true
case jlift.js :: Nil = true
case bp @ (blueprint :: _) if bp.last.endsWith(.css) ||
 bp.last.endsWith(.png) = true
case jquery-autocomplete :: jquery.autocomplete.js :: Nil =
 true
case 

[Lift] Re: Using ExtJS with Lift?

2009-08-05 Thread Derek Chen-Becker
OK, so on re-read I totally misunderstood the question :P. If you write your
own maven project you could put the scripts under
src/main/resources/toserve/extjs (per your Boot example setting up
ResourceServer). No need to hack on the lift module itself.

Derek

On Wed, Aug 5, 2009 at 4:23 AM, Derek Chen-Becker dchenbec...@gmail.comwrote:

 Your guess is correct. The jquery-ui-min.js contains the datePicker. We
 used to use datePicker.js but then we switched to the datePicker that's in
 jquery UI.

 As for your question about where to put the scripts, you don't want to put
 them in src/main/resources/toserve unless you're writing a widget or some
 other programmatic user of the scripts. If you'll just be using the scripts
 directly in your templates you can just put them in the normal
 src/main/webapp tree (I usually make a scripts subdir to segregate things).
 Let me know if that doesn't work or if I'm misunderstanding the question.

 Derek


 On Tue, Aug 4, 2009 at 5:47 PM, Stefan Scott 
 stefanscottal...@gmail.comwrote:


 Thanks for this info, Marius.

 To get started with Lift I'm reading through the excellent book
 Exploring Lift you wrote with Eric and Tyler (version 27 July 2009),
 plus the source for the PocketChange app and liftweb, downloaded from
 GitHub.

 As I'm still finding my way through the various packages and file
 locations, I hope you can bear with me a bit while I think out loud
 here to make sure I understand where to put the .js files and the
 references for JavaScript resources which aren't integrated into
 lift.


 ***
 The only real question I have is way down towards the end of this
 message, at the end of point (a):

 Where do I put the 'toserve' directory, and how do I make sure that
 Maven uses it?

 Feel free to skip most of this lengthy message and just read point (a)
 which is the only real question I have. I'm still just getting used to
 Maven and how it pulls files from various locations either locally or
 online.

 ***


 (1) Searching in directory C:\www\work\PocketChange\ (I'm currently
 serving lift web apps just locally, running Jetty under Windows), I
 see several .js files for JQuery:

 date.js
 jquery.datePicker.js
 jquery.tablesorter.min.js
 jquery-ui.min.js

 in directory:

 C:\www\work\PocketChange\src\main\webapp\scripts\

 So it looks like I could put any needed .js files in that directory.


 Searching for the string .js *inside* all .html files in directory C:
 \www\work\PocketChange, I find the file:

 C:\www\work\PocketChange\src\main\webapp\index.html

 which contains the tag:

 script type=text/javascript src=/scripts/jquery-ui.min.js/
 script

 referencing the file:

 jquery-ui.min.js

 in directory C:\www\work\PocketChange\src\main\webapp\scripts\ above.


 So again it looks like I can put any needed .js files in that
 directory, and reference them in the app's .html file(s) as shown
 above.

 (One strange minor thing I noticed: if I search inside all .html files
 in directory C:\www\work\PocketChange\ for the string datePicker.js,
 it only shows up in lines that have been commented out. So one minor
 curiosity I have is: how is the code for datePicker.js being used?
 There appears to be a definition of it in jquery-ui.min.js, as well as
 a more readable definition of it in datePicker.js as well. I
 understand that JavaScript files are minified to remove unnecessary
 characters - does jquery-ui.min.js include the minified version of
 datePicker? Is file datePicker.js never sent to the browser?)


 (2) The search for the string .js inside all .html files also turned
 up two occurences in file:

 C:\www\work\PocketChange\src\main\webapp\templates-hidden\default.html

 in the tags:

 script id=jquery src=/classpath/jquery.js type=text/
 javascript/script
 script id=json src=/classpath/json.js type=text/javascript/
 script

 These seem to be referring not to individual JavaScript widgets - but
 maybe to entire JavaScript libraries.

 I couldn't find any relevant files called jquery.js on my machine -
 but reading section 7.8 Resource Server in the Exploring Lift book
 (pp. 119-120) I see it says that Maven puts .css (and presumably .js)
 resources to be served *inside* the WAR/JAR file, and lift uses the
 var LiftRules.resourceServerPath:

 var resourceServerPath = classpath

 to find these resources.


 The book goes on to say that in order to find a .css resource in a
 subdirectory such as:

 my-project\src\main\resources\toserve\css\mystyle.css

 I would call the following in Boot:

 ResourceServer.allow {
  case css :: _ = true
 }


 So, examining the lift source code for object ResourceServer in
 package net.liftweb.http (in directory ...\liftweb\lift\src\main\scala
 \net\liftweb\http\), I think I see how this is all put together:

 object ResourceServer {
  private var allowedPaths: PartialFunction[List[String], Boolean] = {
case 

[Lift] Re: Converting from HTML form values to numeric MappedFields

2009-08-05 Thread Derek Chen-Becker
I think that you'll need to provide your own _toForm method on the field.
Fortunately, it's a pretty trivial method (from MappedField.scala):


   1.   /**
   2.* Create an input field for the item
   3.*/
   4.   override def _toForm: Box[NodeSeq] =
   5.   S.fmapFunc({s: List[String] = this.setFromAny(s)}){funcName =
   6.   Full(input type='text' id={fieldId}
   7.   name={funcName} lift:gc={funcName}
   8.   value={is match {case null =  case s = s.toString}}/)
   9.   }


Derek

On Tue, Aug 4, 2009 at 11:47 PM, Heiko Seeberger 
heiko.seeber...@googlemail.com wrote:

 Ah, MappedFields know how to make themselves to form fields. Very nice!
 Next question: Now I can enter some characters into the MappedInt field and
 will get a 0 (zero) on form submission. But that is not what I want. I would
 like to show a validation message (FieldError). Any chances to hook into the
 conversion?

 Heiko

 2009/8/4 David Pollak feeder.of.the.be...@gmail.com

 Why not use

 title - (title.toForm openOr NodeSeq.Empty)

 ?


 On Mon, Aug 3, 2009 at 7:23 AM, Heiko Seeberger 
 heiko.seeber...@googlemail.com wrote:

 Hi,
 I have got a Mapper with a numeric MappedField (let's say Int).
 What is the best way to convert and validate from a HTML form?

 Obviously the following won't work:

 Mapper:

 class Course extends LongKeyedMapper[Course] with IdPK {
   override def getSingleton = Course
   object title extends MappedString(this, 50)
   object duration extends MappedInt(this)
 }

 Snippet:

 ...
 Helpers.bind(course, content,
  title - SHtml.text(course.title.is, course.title(_)),
  duration - SHtml.text(course.duration.is,
 course.duration(_)),
  ...

 Thanx
 Heiko

 --

 My blog: heikoseeberger.name
 Follow me: twitter.com/hseeberger
 OSGi on Scala: www.scalamodules.org
 Lift, the simply functional web framework: liftweb.net





 --
 Lift, the simply functional web framework http://liftweb.net
 Beginning Scala http://www.apress.com/book/view/1430219890
 Follow me: http://twitter.com/dpp
 Git some: http://github.com/dpp





 --

 My blog: heikoseeberger.name
 Follow me: twitter.com/hseeberger
 OSGi on Scala: www.scalamodules.org
 Lift, the simply functional web framework: liftweb.net

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: *** BREAKING CHANGES COMING UP SOON ***

2009-08-05 Thread Yousry Abdallah

Could you setup a milestone before the merge?

On 4 Aug., 21:51, Marius marius.dan...@gmail.com wrote:
 Folks,

 I spent a few days decoupling Lift from JEE web container
 dependencies: javax.servlet._ The code is currently in wip-marius-http-
 abstractions.

 I still need to nail down a few things but the idea is:

 1. Lift will work with its own traits that abstracts HTTP request,
 response, HTTP sessions etc.
 2. By default there will be the servlet implementation and it'll work
 as currently.
 3. Certain function names will slightly change.
 4. If your application explicitly wants to use HttpServletRequest
 obtained from S some explicit casts would be needed. Generally Lift
 application should probably not explicitly use javax.servlet._
 references.

 I will post the details of the changes when I'll merge it to master
 (hopefully this week).

 Br's,
 Marius

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: *** BREAKING CHANGES COMING UP SOON ***

2009-08-05 Thread marius d.

Sounds good to me

On Aug 5, 1:51 pm, Yousry Abdallah yous...@gmail.com wrote:
 Could you setup a milestone before the merge?

 On 4 Aug., 21:51, Marius marius.dan...@gmail.com wrote:

  Folks,

  I spent a few days decoupling Lift from JEE web container
  dependencies: javax.servlet._ The code is currently in wip-marius-http-
  abstractions.

  I still need to nail down a few things but the idea is:

  1. Lift will work with its own traits that abstracts HTTP request,
  response, HTTP sessions etc.
  2. By default there will be the servlet implementation and it'll work
  as currently.
  3. Certain function names will slightly change.
  4. If your application explicitly wants to use HttpServletRequest
  obtained from S some explicit casts would be needed. Generally Lift
  application should probably not explicitly use javax.servlet._
  references.

  I will post the details of the changes when I'll merge it to master
  (hopefully this week).

  Br's,
  Marius
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: *** BREAKING CHANGES COMING UP SOON ***

2009-08-05 Thread Derek Chen-Becker
Netty looks really cool. On a quick read it sounds maybe a little like MINA,
although it definitely looks like it has a more high-level API to simplify
things.

On Wed, Aug 5, 2009 at 5:08 AM, marius d. marius.dan...@gmail.com wrote:


 Sounds good to me

 On Aug 5, 1:51 pm, Yousry Abdallah yous...@gmail.com wrote:
  Could you setup a milestone before the merge?
 
  On 4 Aug., 21:51, Marius marius.dan...@gmail.com wrote:
 
   Folks,
 
   I spent a few days decoupling Lift from JEE web container
   dependencies: javax.servlet._ The code is currently in wip-marius-http-
   abstractions.
 
   I still need to nail down a few things but the idea is:
 
   1. Lift will work with its own traits that abstracts HTTP request,
   response, HTTP sessions etc.
   2. By default there will be the servlet implementation and it'll work
   as currently.
   3. Certain function names will slightly change.
   4. If your application explicitly wants to use HttpServletRequest
   obtained from S some explicit casts would be needed. Generally Lift
   application should probably not explicitly use javax.servlet._
   references.
 
   I will post the details of the changes when I'll merge it to master
   (hopefully this week).
 
   Br's,
   Marius
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: *** BREAKING CHANGES COMING UP SOON ***

2009-08-05 Thread marius d.

And looks to perform a bit better then MINA.

On Aug 5, 2:13 pm, Derek Chen-Becker dchenbec...@gmail.com wrote:
 Netty looks really cool. On a quick read it sounds maybe a little like MINA,
 although it definitely looks like it has a more high-level API to simplify
 things.

 On Wed, Aug 5, 2009 at 5:08 AM, marius d. marius.dan...@gmail.com wrote:

  Sounds good to me

  On Aug 5, 1:51 pm, Yousry Abdallah yous...@gmail.com wrote:
   Could you setup a milestone before the merge?

   On 4 Aug., 21:51, Marius marius.dan...@gmail.com wrote:

Folks,

I spent a few days decoupling Lift from JEE web container
dependencies: javax.servlet._ The code is currently in wip-marius-http-
abstractions.

I still need to nail down a few things but the idea is:

1. Lift will work with its own traits that abstracts HTTP request,
response, HTTP sessions etc.
2. By default there will be the servlet implementation and it'll work
as currently.
3. Certain function names will slightly change.
4. If your application explicitly wants to use HttpServletRequest
obtained from S some explicit casts would be needed. Generally Lift
application should probably not explicitly use javax.servlet._
references.

I will post the details of the changes when I'll merge it to master
(hopefully this week).

Br's,
Marius
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Lift w/o ajax

2009-08-05 Thread David Pollak
The functions will be kept for the duration of the user's session... if
they're coming from a mobile device, it's unlikely that they'll accumulate
too much garbage and it's unlikely that it'll be a serious issue.  If it
becomes an issue, we can work on it.

On Tue, Aug 4, 2009 at 9:17 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:


 Thanks.
 Will disabling Lift GC cause functions that need to be disposed of not to
 be or cause Lift to dispose of functions that are needed?

 -
 jonjonhoff...@gmail.com wrote:


 From http://groups.google.com/group/liftweb/msg/a66e58b85523a1d9

 Add to Boot:

 +// Do not insert Javascript-based GC
 +LiftRules.enableLiftGC = false;
 +
 +// Do not include Ajax include
 +LiftRules.autoIncludeAjax = _ = false;

 On Aug 4, 8:38 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
  Hi. I am writing a webapp to be run mainly on BlackBerries, including
 older ones that have basically no Javascript or Ajax support. I had the
 jquery script tag commented out in the default template, and everything was
 fine. Only now Internet Explorer is complaining about a javascript error (a
 reference to jquery) and I had to uncomment it.
  The pages have to load very fast. Is there a way that I can skip
 Javascript?



 



-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Or QueryParams

2009-08-05 Thread David Pollak
There's no OR in the Mapper stuff.  You'll have to roll your own BySql
expression.

On Tue, Aug 4, 2009 at 8:22 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:


 How can you Or QueryParams (e.g. find text in any field)?
 Thanks.

 



-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Using ExtJS with Lift?

2009-08-05 Thread Stefan Scott

Thanks Derek!

On Aug 5, 7:26 am, Derek Chen-Becker dchenbec...@gmail.com wrote:
 OK, so on re-read I totally misunderstood the question :P. If you write your
 own maven project you could put the scripts under
 src/main/resources/toserve/extjs (per your Boot example setting up
 ResourceServer). No need to hack on the lift module itself.

 Derek

 On Wed, Aug 5, 2009 at 4:23 AM, Derek Chen-Becker 
 dchenbec...@gmail.comwrote:

  Your guess is correct. The jquery-ui-min.js contains the datePicker. We
  used to use datePicker.js but then we switched to the datePicker that's in
  jquery UI.

  As for your question about where to put the scripts, you don't want to put
  them in src/main/resources/toserve unless you're writing a widget or some
  other programmatic user of the scripts. If you'll just be using the scripts
  directly in your templates you can just put them in the normal
  src/main/webapp tree (I usually make a scripts subdir to segregate things).
  Let me know if that doesn't work or if I'm misunderstanding the question.

  Derek

  On Tue, Aug 4, 2009 at 5:47 PM, Stefan Scott 
  stefanscottal...@gmail.comwrote:

  Thanks for this info, Marius.

  To get started with Lift I'm reading through the excellent book
  Exploring Lift you wrote with Eric and Tyler (version 27 July 2009),
  plus the source for the PocketChange app and liftweb, downloaded from
  GitHub.

  As I'm still finding my way through the various packages and file
  locations, I hope you can bear with me a bit while I think out loud
  here to make sure I understand where to put the .js files and the
  references for JavaScript resources which aren't integrated into
  lift.

  ***
  The only real question I have is way down towards the end of this
  message, at the end of point (a):

  Where do I put the 'toserve' directory, and how do I make sure that
  Maven uses it?

  Feel free to skip most of this lengthy message and just read point (a)
  which is the only real question I have. I'm still just getting used to
  Maven and how it pulls files from various locations either locally or
  online.

  ***

  (1) Searching in directory C:\www\work\PocketChange\ (I'm currently
  serving lift web apps just locally, running Jetty under Windows), I
  see several .js files for JQuery:

  date.js
  jquery.datePicker.js
  jquery.tablesorter.min.js
  jquery-ui.min.js

  in directory:

  C:\www\work\PocketChange\src\main\webapp\scripts\

  So it looks like I could put any needed .js files in that directory.

  Searching for the string .js *inside* all .html files in directory C:
  \www\work\PocketChange, I find the file:

  C:\www\work\PocketChange\src\main\webapp\index.html

  which contains the tag:

  script type=text/javascript src=/scripts/jquery-ui.min.js/
  script

  referencing the file:

  jquery-ui.min.js

  in directory C:\www\work\PocketChange\src\main\webapp\scripts\ above.

  So again it looks like I can put any needed .js files in that
  directory, and reference them in the app's .html file(s) as shown
  above.

  (One strange minor thing I noticed: if I search inside all .html files
  in directory C:\www\work\PocketChange\ for the string datePicker.js,
  it only shows up in lines that have been commented out. So one minor
  curiosity I have is: how is the code for datePicker.js being used?
  There appears to be a definition of it in jquery-ui.min.js, as well as
  a more readable definition of it in datePicker.js as well. I
  understand that JavaScript files are minified to remove unnecessary
  characters - does jquery-ui.min.js include the minified version of
  datePicker? Is file datePicker.js never sent to the browser?)

  (2) The search for the string .js inside all .html files also turned
  up two occurences in file:

  C:\www\work\PocketChange\src\main\webapp\templates-hidden\default.html

  in the tags:

  script id=jquery src=/classpath/jquery.js type=text/
  javascript/script
  script id=json src=/classpath/json.js type=text/javascript/
  script

  These seem to be referring not to individual JavaScript widgets - but
  maybe to entire JavaScript libraries.

  I couldn't find any relevant files called jquery.js on my machine -
  but reading section 7.8 Resource Server in the Exploring Lift book
  (pp. 119-120) I see it says that Maven puts .css (and presumably .js)
  resources to be served *inside* the WAR/JAR file, and lift uses the
  var LiftRules.resourceServerPath:

  var resourceServerPath = classpath

  to find these resources.

  The book goes on to say that in order to find a .css resource in a
  subdirectory such as:

  my-project\src\main\resources\toserve\css\mystyle.css

  I would call the following in Boot:

  ResourceServer.allow {
   case css :: _ = true
  }

  So, examining the lift source code for object ResourceServer in
  package net.liftweb.http (in directory ...\liftweb\lift\src\main\scala
  

[Lift] Re: Asynchronous Javascript problem

2009-08-05 Thread Channing Walton

ok, lots of jscript debugging and I'm pretty sure its this:

JSON.stringify(new GLatLng(0,0))

where GLatLng is a google map object.

the imports needed for this are

script src=http://maps.google.com/maps?
file=apiamp;v=2.xamp;key=your-keyamp;sensor=false type=text/
javascript/script
script type=text/javascript src=/classpath/jquery.js
id=jquery/script
script src=/classpath/json.js type=text/javascript/script

there is a key=your-key argument in that first import. don't worry
about that, just make sure you test the page using localhost, not
127.0.0.1, just localhost. The key is not used for file:// and
localhost addresses.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Title function

2009-08-05 Thread Naftoli Gugenheim


-
Naftoli Gugenheimnaftoli...@gmail.com wrote:

So what I'm not clear on now is the input to Title. What is a LocParam, and how 
do you you use loc params? What is forceParam, defaultParams, param, and 
foundParam? And in any case how can Title know the value of the registered 
StatefulSnippet's newOrEdit state?
Thanks!

-
David Pollakfeeder.of.the.be...@gmail.com wrote:

On Tue, Aug 4, 2009 at 12:47 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:

 Maybe my setup is atypical then :)
 My default.html is does not have a title tag; instead each view has its
 own, relying on head merge.
 I don't know if originally I had it in default using lift:Menu.title or
 not, but the difficulty with that would be that some pages can be used to
 edit or add a new item, and the title needs to reflect that.


Because the Title() case class takes a function, you can have it do all
forms of stuff including looking to the current user, whether you're
editing, and do the right thing.



 So either (1) I need a way that the value of Menu.title will depend on data
 in various StatefulSnippets; or (2) make the title ambiguous (add/edit
 neutral); or (3) leave the titles in the views and process them with a
 function somehow; or (4) put a snippet in the title of every view to get the
 user.



 -
 David Pollakfeeder.of.the.be...@gmail.com wrote:

 On Sun, Aug 2, 2009 at 4:35 PM, Naftoli Gugenheim naftoli...@gmail.com
 wrote:

 
  How does the Title LocParam work?


 The Title case class has a function that converts the current object
 associated with the Loc into a String representing the title of the page
 represented by the Loc.


 
  Is there a way to modify all titles to e.g. include the logged in user's
  name, without having to edit all the views?


 The title tag is typically defined in the default template.  You could
 include a snippet in the title tag that would contain the user's name.  I
 would see this as separate from the title of the specific page referred to
 by the Loc.Title.


 
 
  
 


 --
 Lift, the simply functional web framework http://liftweb.net
 Beginning Scala http://www.apress.com/book/view/1430219890
 Follow me: http://twitter.com/dpp
 Git some: http://github.com/dpp

 



-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Loc.title impl redundancy?

2009-08-05 Thread Naftoli Gugenheim

Why does title: NodeSeq try linkText if title(in:ParamType) calls linkText(in)? 
Is it possible that (forceParam or foundParam.is or defaultParams) will 
evaluate differently by that time?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: New features

2009-08-05 Thread Naftoli Gugenheim

Correction: ModelSnippet.load takes the actual Mapper instance, not the 
ModelView wrapper.

-
Naftoli Gugenheimnaftoli...@gmail.com wrote:

To answer your immediate question, the listing should not refer to the 
snippet's view but new ModelView instances for each entity. Then editAction is 
shorthand for the snippet's link method with a callback to call load on the 
ModelView. To set the snippet's view's entity, either call load on the snippet 
with the other ModelView, or call load on the other ModelView (or just set its 
entity directly).
As far as documentation, please tell me what scaladocs need what clarification. 
Thanks.



-
glenngl...@exmbly.com wrote:


Naftoli,

Functional programming systems are notoriously difficult to document.
The only way to really know what's going on is to meticulously trace
through the source. But that requires
time-consuming trial and error coding. So, without clear examples
demonstrating exactly what you have in mind, I and others in the same
boat, could spend days and still not
get it right.

For example, I tried this:

var theUser:User = null
val view = new ModelView(theUser, this)

 def list(ns: NodeSeq): NodeSeq =  User.currentUser.map({user =
User.findAll.flatMap({u =
bind(user, chooseTemplate(user, entry, ns),
 firstname - Text(u.firstName.is),
 lastname - Text(u.lastName.is),
 email - Text(u.email.is),
 roles - u.roles.map(_.name.toString).mkString(,
),
 view.editAction,
 view.removeAction
 )
  })
}) openOr Text(You're not logged in)


and, I get a null value exception when I try to remove a user in the
list. Simply using
val view = new ModelView(new User, this), doesn't work either,
although I don't get an
exception. Now, where should I be calling load in all of this?

Glenn...


On Aug 3, 6:22 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
 Your snippet should extend ModelSnippet (which extends StatefulSnippet).
 Then write:
 val view = new ModelView(new User, this) {}
 Calling load on another ModelView that references the snippet will load its 
 entity into that view val. It has a number of methods of possible interest, 
 like save which checks validity.
 Also see Util.
 Are you seeing the scaladocs?

 -

 glenngl...@exmbly.com wrote:

 Just to add to what I just wrote, I don't see how your ModelView can
 be applied to
 User, which already extends a class, MegaProtoUser.  Maybe I'm not
 comprehending this correctly.

 Glenn...

 On Aug 3, 3:48 pm, glenn gl...@exmbly.com wrote:

  Naftoli,

  Liked your OneToMany article, but not sure how the new
  ModelView and ModelSnippet code can be applied to ManyToMany.
  Can you provide a sample?

  Glenn...

  On Aug 2, 1:21 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:

   I put an article on the wiki about OneToMany 
   --http://wiki.github.com/dpp/liftweb/how-to-work-with-one-to-many-relat...
   .

   On Sun, Aug 2, 2009 at 11:20 AM, Naftoli Gugenheim 
   naftoli...@gmail.comwrote:

Glad to hear. Also see mapper.view.ItemsList (anyone have a better 
name?),
which is used by TableEditor. It's a similar idea without relationships.
Should MappedOne/ManyToMany be based on ItemsList?
Also should I take Mapped out of those names? After all, they're not
MappedFields and they don't correspond to a table column.

-
Magnus Alvestadmagnus.alves...@gmail.com wrote:

This work that you've done in Mapper fits in very well with something
I've been planning to do. In a Java project some time ago we
implemented a 'change engine'. We were loading big pension agreements,
manipulating them in a web interface and finally saving them back to
the database. While the user was working on the agreement, we
generated a list of changes, containing enough information to replay
or unroll the change. We could use this to implement undo and some
semi-intelligent merging when two users were trying to commit  changes
to the same agreement. We also let the user review his changes before
saving, and we indicated changed fields visually. We were even
thinking of implementing some kind of macro or replay functionality,
but never got that far.

I've been trying to implement something similar as a lift component,
but with the old relationship handling it wasn't practical. With your
changes it should be. Thanks!

-Magnus

On Jul 27, 9:57 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
 I committed some code last night, which can help building mapper-based
view snippets, with G-d's help. It includes the following classes:
 (1-2) net.liftweb.mapper.OneToMany, ManyToMany: Gives a more
object-oriented approach to managing related 

[Lift] Prepare StatefulSnippet in advance

2009-08-05 Thread Naftoli Gugenheim

Hi. I have one screen, /requests/edit, that links to /clients/edit, in order to 
edit a specific client. Both use StatefulSnippet. In the link I specify a 
function that instantiates and registers an instance of that StatefulSnippet. 
However the page does not use that instance but a new instance instead. What am 
I doing wrong?
Thanks.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Prepare StatefulSnippet in advance

2009-08-05 Thread David Pollak
Please provide a complete (executable) code sample so I can understand the
flow.

On Wed, Aug 5, 2009 at 9:40 AM, Naftoli Gugenheim naftoli...@gmail.comwrote:


 Hi. I have one screen, /requests/edit, that links to /clients/edit, in
 order to edit a specific client. Both use StatefulSnippet. In the link I
 specify a function that instantiates and registers an instance of that
 StatefulSnippet. However the page does not use that instance but a new
 instance instead. What am I doing wrong?
 Thanks.


 



-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: New features

2009-08-05 Thread glenn

Naftoli,

I fixed my code per your comments and now I can edit and remove users
from a list, as long as I populate the list with
ModelView instances, as you said. As for the docs, this step was not
clear to me at all. I just assumed that the list was
just populated with User entities and the view in the ModelSnippet was
instantiated with the selected User on each request.

It sounds like your plate is pretty full, so I won't expect much, but
sometime soon, could you provide an example, or improved
docs, for using TableEditor and its related ItemsList trait.

Thanks for all.

Glenn...

On Aug 5, 9:18 am, Naftoli Gugenheim naftoli...@gmail.com wrote:
 Correction: ModelSnippet.load takes the actual Mapper instance, not the 
 ModelView wrapper.

 -

 Naftoli Gugenheimnaftoli...@gmail.com wrote:

 To answer your immediate question, the listing should not refer to the 
 snippet's view but new ModelView instances for each entity. Then editAction 
 is shorthand for the snippet's link method with a callback to call load on 
 the ModelView. To set the snippet's view's entity, either call load on the 
 snippet with the other ModelView, or call load on the other ModelView (or 
 just set its entity directly).
 As far as documentation, please tell me what scaladocs need what 
 clarification. Thanks.

 -

 glenngl...@exmbly.com wrote:

 Naftoli,

 Functional programming systems are notoriously difficult to document.
 The only way to really know what's going on is to meticulously trace
 through the source. But that requires
 time-consuming trial and error coding. So, without clear examples
 demonstrating exactly what you have in mind, I and others in the same
 boat, could spend days and still not
 get it right.

 For example, I tried this:

 var theUser:User = null
 val view = new ModelView(theUser, this)

  def list(ns: NodeSeq): NodeSeq =  User.currentUser.map({user =
         User.findAll.flatMap({u =
             bind(user, chooseTemplate(user, entry, ns),
                  firstname - Text(u.firstName.is),
                  lastname - Text(u.lastName.is),
                  email - Text(u.email.is),
                  roles - u.roles.map(_.name.toString).mkString(,
 ),
                  view.editAction,
                  view.removeAction
                  )
           })
                         }) openOr Text(You're not logged in)

 and, I get a null value exception when I try to remove a user in the
 list. Simply using
 val view = new ModelView(new User, this), doesn't work either,
 although I don't get an
 exception. Now, where should I be calling load in all of this?

 Glenn...

 On Aug 3, 6:22 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:

  Your snippet should extend ModelSnippet (which extends StatefulSnippet).
  Then write:
  val view = new ModelView(new User, this) {}
  Calling load on another ModelView that references the snippet will load its 
  entity into that view val. It has a number of methods of possible interest, 
  like save which checks validity.
  Also see Util.
  Are you seeing the scaladocs?

  -

  glenngl...@exmbly.com wrote:

  Just to add to what I just wrote, I don't see how your ModelView can
  be applied to
  User, which already extends a class, MegaProtoUser.  Maybe I'm not
  comprehending this correctly.

  Glenn...

  On Aug 3, 3:48 pm, glenn gl...@exmbly.com wrote:

   Naftoli,

   Liked your OneToMany article, but not sure how the new
   ModelView and ModelSnippet code can be applied to ManyToMany.
   Can you provide a sample?

   Glenn...

   On Aug 2, 1:21 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:

I put an article on the wiki about OneToMany 
--http://wiki.github.com/dpp/liftweb/how-to-work-with-one-to-many-relat...
.

On Sun, Aug 2, 2009 at 11:20 AM, Naftoli Gugenheim 
naftoli...@gmail.comwrote:

 Glad to hear. Also see mapper.view.ItemsList (anyone have a better 
 name?),
 which is used byTableEditor. It's a similar idea without 
 relationships.
 Should MappedOne/ManyToMany be based on ItemsList?
 Also should I take Mapped out of those names? After all, they're not
 MappedFields and they don't correspond to a table column.

 -
 Magnus Alvestadmagnus.alves...@gmail.com wrote:

 This work that you've done in Mapper fits in very well with something
 I've been planning to do. In a Java project some time ago we
 implemented a 'change engine'. We were loading big pension agreements,
 manipulating them in a web interface and finally saving them back to
 the database. While the user was working on the agreement, we
 generated a list of changes, containing enough information to replay
 or unroll the change. We could use this to implement undo and some
 semi-intelligent merging when two users were trying to commit  changes
 to the same 

[Lift] Re: Title function

2009-08-05 Thread Derek Chen-Becker
If you're just looking for a way to programmatically set the title, getting
into LocParam might be a little bit of overkill. It's probably simpler to
set up your own SessionVars or RequestVars and access them from the Title
closure:

http://scala-tools.org/scaladocs/liftweb/1.0/net/liftweb/sitemap/Loc/Title.html

Derek

On Wed, Aug 5, 2009 at 9:45 AM, Naftoli Gugenheim naftoli...@gmail.comwrote:



 -
 Naftoli Gugenheimnaftoli...@gmail.com wrote:

 So what I'm not clear on now is the input to Title. What is a LocParam, and
 how do you you use loc params? What is forceParam, defaultParams, param, and
 foundParam? And in any case how can Title know the value of the registered
 StatefulSnippet's newOrEdit state?
 Thanks!

 -
 David Pollakfeeder.of.the.be...@gmail.com wrote:

 On Tue, Aug 4, 2009 at 12:47 PM, Naftoli Gugenheim naftoli...@gmail.com
 wrote:

  Maybe my setup is atypical then :)
  My default.html is does not have a title tag; instead each view has its
  own, relying on head merge.
  I don't know if originally I had it in default using lift:Menu.title or
  not, but the difficulty with that would be that some pages can be used to
  edit or add a new item, and the title needs to reflect that.


 Because the Title() case class takes a function, you can have it do all
 forms of stuff including looking to the current user, whether you're
 editing, and do the right thing.


 
  So either (1) I need a way that the value of Menu.title will depend on
 data
  in various StatefulSnippets; or (2) make the title ambiguous (add/edit
  neutral); or (3) leave the titles in the views and process them with a
  function somehow; or (4) put a snippet in the title of every view to get
 the
  user.
 
 
 
  -
  David Pollakfeeder.of.the.be...@gmail.com wrote:
 
  On Sun, Aug 2, 2009 at 4:35 PM, Naftoli Gugenheim naftoli...@gmail.com
  wrote:
 
  
   How does the Title LocParam work?
 
 
  The Title case class has a function that converts the current object
  associated with the Loc into a String representing the title of the page
  represented by the Loc.
 
 
  
   Is there a way to modify all titles to e.g. include the logged in
 user's
   name, without having to edit all the views?
 
 
  The title tag is typically defined in the default template.  You could
  include a snippet in the title tag that would contain the user's name.
  I
  would see this as separate from the title of the specific page referred
 to
  by the Loc.Title.
 
 
  
  
   
  
 
 
  --
  Lift, the simply functional web framework http://liftweb.net
  Beginning Scala http://www.apress.com/book/view/1430219890
  Follow me: http://twitter.com/dpp
  Git some: http://github.com/dpp
 
  
 


 --
 Lift, the simply functional web framework http://liftweb.net
 Beginning Scala http://www.apress.com/book/view/1430219890
 Follow me: http://twitter.com/dpp
 Git some: http://github.com/dpp

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: New features

2009-08-05 Thread Naftoli Gugenheim

I'll try.
By the way, as per my correction, you can implement list the regular way 
without ModelView, and just use ModelSnippet's load function in your edit link 
or button, passing it the User instance.

-
glenngl...@exmbly.com wrote:


Naftoli,

I fixed my code per your comments and now I can edit and remove users
from a list, as long as I populate the list with
ModelView instances, as you said. As for the docs, this step was not
clear to me at all. I just assumed that the list was
just populated with User entities and the view in the ModelSnippet was
instantiated with the selected User on each request.

It sounds like your plate is pretty full, so I won't expect much, but
sometime soon, could you provide an example, or improved
docs, for using TableEditor and its related ItemsList trait.

Thanks for all.

Glenn...

On Aug 5, 9:18 am, Naftoli Gugenheim naftoli...@gmail.com wrote:
 Correction: ModelSnippet.load takes the actual Mapper instance, not the 
 ModelView wrapper.

 -

 Naftoli Gugenheimnaftoli...@gmail.com wrote:

 To answer your immediate question, the listing should not refer to the 
 snippet's view but new ModelView instances for each entity. Then editAction 
 is shorthand for the snippet's link method with a callback to call load on 
 the ModelView. To set the snippet's view's entity, either call load on the 
 snippet with the other ModelView, or call load on the other ModelView (or 
 just set its entity directly).
 As far as documentation, please tell me what scaladocs need what 
 clarification. Thanks.

 -

 glenngl...@exmbly.com wrote:

 Naftoli,

 Functional programming systems are notoriously difficult to document.
 The only way to really know what's going on is to meticulously trace
 through the source. But that requires
 time-consuming trial and error coding. So, without clear examples
 demonstrating exactly what you have in mind, I and others in the same
 boat, could spend days and still not
 get it right.

 For example, I tried this:

 var theUser:User = null
 val view = new ModelView(theUser, this)

  def list(ns: NodeSeq): NodeSeq =  User.currentUser.map({user =
         User.findAll.flatMap({u =
             bind(user, chooseTemplate(user, entry, ns),
                  firstname - Text(u.firstName.is),
                  lastname - Text(u.lastName.is),
                  email - Text(u.email.is),
                  roles - u.roles.map(_.name.toString).mkString(,
 ),
                  view.editAction,
                  view.removeAction
                  )
           })
                         }) openOr Text(You're not logged in)

 and, I get a null value exception when I try to remove a user in the
 list. Simply using
 val view = new ModelView(new User, this), doesn't work either,
 although I don't get an
 exception. Now, where should I be calling load in all of this?

 Glenn...

 On Aug 3, 6:22 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:

  Your snippet should extend ModelSnippet (which extends StatefulSnippet).
  Then write:
  val view = new ModelView(new User, this) {}
  Calling load on another ModelView that references the snippet will load its 
  entity into that view val. It has a number of methods of possible interest, 
  like save which checks validity.
  Also see Util.
  Are you seeing the scaladocs?

  -

  glenngl...@exmbly.com wrote:

  Just to add to what I just wrote, I don't see how your ModelView can
  be applied to
  User, which already extends a class, MegaProtoUser.  Maybe I'm not
  comprehending this correctly.

  Glenn...

  On Aug 3, 3:48 pm, glenn gl...@exmbly.com wrote:

   Naftoli,

   Liked your OneToMany article, but not sure how the new
   ModelView and ModelSnippet code can be applied to ManyToMany.
   Can you provide a sample?

   Glenn...

   On Aug 2, 1:21 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:

I put an article on the wiki about OneToMany 
--http://wiki.github.com/dpp/liftweb/how-to-work-with-one-to-many-relat...
.

On Sun, Aug 2, 2009 at 11:20 AM, Naftoli Gugenheim 
naftoli...@gmail.comwrote:

 Glad to hear. Also see mapper.view.ItemsList (anyone have a better 
 name?),
 which is used byTableEditor. It's a similar idea without 
 relationships.
 Should MappedOne/ManyToMany be based on ItemsList?
 Also should I take Mapped out of those names? After all, they're not
 MappedFields and they don't correspond to a table column.

 -
 Magnus Alvestadmagnus.alves...@gmail.com wrote:

 This work that you've done in Mapper fits in very well with something
 I've been planning to do. In a Java project some time ago we
 implemented a 'change engine'. We were loading big pension agreements,
 manipulating them in a web interface and finally saving them back to
 the database. While the user was 

[Lift] Re: Title function

2009-08-05 Thread Naftoli Gugenheim

You mean the snippet should put its new/edit flag somewhere that the Title can 
read, like a top level object? Then it doesn't need to be an AnyVar because it 
can be set on every request, if Title is processed after the snippet in each 
request--and if not then I don't see how a RequestVar etc. would work.
Seems like it may be more work than the other way, though.
By the way I sent corrected message afterward--my question was not about 
LocParams but of the items of type ParamType. 

-
Derek Chen-Beckerdchenbec...@gmail.com wrote:

If you're just looking for a way to programmatically set the title, getting
into LocParam might be a little bit of overkill. It's probably simpler to
set up your own SessionVars or RequestVars and access them from the Title
closure:

http://scala-tools.org/scaladocs/liftweb/1.0/net/liftweb/sitemap/Loc/Title.html

Derek

On Wed, Aug 5, 2009 at 9:45 AM, Naftoli Gugenheim naftoli...@gmail.comwrote:



 -
 Naftoli Gugenheimnaftoli...@gmail.com wrote:

 So what I'm not clear on now is the input to Title. What is a LocParam, and
 how do you you use loc params? What is forceParam, defaultParams, param, and
 foundParam? And in any case how can Title know the value of the registered
 StatefulSnippet's newOrEdit state?
 Thanks!

 -
 David Pollakfeeder.of.the.be...@gmail.com wrote:

 On Tue, Aug 4, 2009 at 12:47 PM, Naftoli Gugenheim naftoli...@gmail.com
 wrote:

  Maybe my setup is atypical then :)
  My default.html is does not have a title tag; instead each view has its
  own, relying on head merge.
  I don't know if originally I had it in default using lift:Menu.title or
  not, but the difficulty with that would be that some pages can be used to
  edit or add a new item, and the title needs to reflect that.


 Because the Title() case class takes a function, you can have it do all
 forms of stuff including looking to the current user, whether you're
 editing, and do the right thing.


 
  So either (1) I need a way that the value of Menu.title will depend on
 data
  in various StatefulSnippets; or (2) make the title ambiguous (add/edit
  neutral); or (3) leave the titles in the views and process them with a
  function somehow; or (4) put a snippet in the title of every view to get
 the
  user.
 
 
 
  -
  David Pollakfeeder.of.the.be...@gmail.com wrote:
 
  On Sun, Aug 2, 2009 at 4:35 PM, Naftoli Gugenheim naftoli...@gmail.com
  wrote:
 
  
   How does the Title LocParam work?
 
 
  The Title case class has a function that converts the current object
  associated with the Loc into a String representing the title of the page
  represented by the Loc.
 
 
  
   Is there a way to modify all titles to e.g. include the logged in
 user's
   name, without having to edit all the views?
 
 
  The title tag is typically defined in the default template.  You could
  include a snippet in the title tag that would contain the user's name.
  I
  would see this as separate from the title of the specific page referred
 to
  by the Loc.Title.
 
 
  
  
   
  
 
 
  --
  Lift, the simply functional web framework http://liftweb.net
  Beginning Scala http://www.apress.com/book/view/1430219890
  Follow me: http://twitter.com/dpp
  Git some: http://github.com/dpp
 
  
 


 --
 Lift, the simply functional web framework http://liftweb.net
 Beginning Scala http://www.apress.com/book/view/1430219890
 Follow me: http://twitter.com/dpp
 Git some: http://github.com/dpp

 




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Mega*ProtoUser extensibility - a suggestion.

2009-08-05 Thread E. Biggs

David,

First apologies for accidently taking this thread off the lift group.
It was entirely accidental.

So my question with regards to the scala language that I can't seem to
find an answer for online anywhere is what exactly is an object nested
inside a class i.e. :

class ObjectWrapper {
  object obj extends AnyRef{var prop = prop}
}

versus a class with a final val that's set to an instance of an
anonymous class i.e. :

class AnonClassWrapper{
  final val obj = new AnyRef{var prop=prop}
}

I've tried to discover some sort of behavioral difference both in
simple tests in the scala console, and couldn't find any. In both
clases obj responds just as if it was a val and not a type. This
analogy towards static classes in java breaks down because a static
class in java is one that doesn't have a containing instance, and yet:

scala class ObjectWrapper{var outerProp = prop; object obj extends
AnyRef{var prop=outerProp}}
defined class ObjectWrapper

lastly, in a desperate attempt to prove to myself that there is an
actual difference I went against your rule and changed a RequestVar
from an object extending RequestVar to a value set to an instance of
an anonymous extention and my lift app ran without any changes in
behavior???

On Aug 4, 10:42 am, David Pollak feeder.of.the.be...@gmail.com
wrote:
 In this case, if you change the type/behavior of the SessionVar and/or
 RequestVar, you could mess up code that depends on these.

 You also must *always* make RequestVar and SessionVar as object rather than
 val so that they can make the determination of their unique string ID.

 I view ProtoUser much like I view Rails' scaffolding... at some point the
 code becomes too heavy to keep subclassing and it's easier to copy the
 MegaProtoUser code into your own User class and go from there.





 On Tue, Aug 4, 2009 at 10:27 AM, E. Biggs tacoban...@gmail.com wrote:

  I have extended Mega*ProtoUser to achieve cookie-based perpetual
  login..  and it was fairly easy to do except I ended up having to do
  something hackish simply because there are two private object members
  in the class that are core to the functionality I've extended.

  Namely:

  private object curUserId extends SessionVar[Box[String]](Empty)

  private object curUser extends RequestVar[Box[ModelType]]
  (currentUserId.flatMap(id = getSingleton.find(id)))

  I have no idea if this would be an acceptable change, but at least for
  one user of lift it would make much more sense that in the spirit of
  *ProtoUser's clear intent for extensibility that these members simply
  become:

  protected val curUserId = new SessionVar[Box[String]](Empty){}

  protected val curUser = new RequestVar[Box[ModelType]]
  (currentUserId.flatMap(id = getSingleton.find(id))){}

  Unless I'm not properly understanding what object members actually
  are? I'm interpreting them as being final vals assigned to instances
  of anonymous classes (rough tests in the scala console seem to verify
  this)

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://www.apress.com/book/view/1430219890
 Follow me:http://twitter.com/dpp
 Git some:http://github.com/dpp

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Asynchronous Javascript problem

2009-08-05 Thread Channing Walton

actually that example doesn't work in Opera, but does in safari and
firefox. To see the problem in safari I had to modify the script like
this:

var geocoder = new GClientGeocoder();
geocoder.getLatLng(london,doit);

function doit(point) {
  var s = JSON.stringify(point);
  alert(s)
}

This does work in Firefox though, but my full version doesn't.
Hopefully these examples will help a little. I am beginning to think I
should just pass simple objects to the server via JSON.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Loc.title impl redundancy?

2009-08-05 Thread David Pollak
On Wed, Aug 5, 2009 at 8:56 AM, Naftoli Gugenheim naftoli...@gmail.comwrote:


 Why does title: NodeSeq try linkText if title(in:ParamType) calls
 linkText(in)?


Because it's possible to subclass the Loc and have your own implementation
of linkText.


 Is it possible that (forceParam or foundParam.is or defaultParams) will
 evaluate differently by that time?

 



-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Prepare StatefulSnippet in advance

2009-08-05 Thread Naftoli Gugenheim

I don't have code available to post right now, but let me try to explain better.
Basically you're editing a request, which is associated with a client. Now when 
your entering the request you may notice that the client's info is wrong. So I 
need a link to the client editing page, which is StatefulSnippet based. 
However, when that page loads it has to use an instance of the snippet that 
knows which client I want to edit.

-
David Pollakfeeder.of.the.be...@gmail.com wrote:

Please provide a complete (executable) code sample so I can understand the
flow.

On Wed, Aug 5, 2009 at 9:40 AM, Naftoli Gugenheim naftoli...@gmail.comwrote:


 Hi. I have one screen, /requests/edit, that links to /clients/edit, in
 order to edit a specific client. Both use StatefulSnippet. In the link I
 specify a function that instantiates and registers an instance of that
 StatefulSnippet. However the page does not use that instance but a new
 instance instead. What am I doing wrong?
 Thanks.


 



-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Prepare StatefulSnippet in advance

2009-08-05 Thread David Pollak
Create a top-level RequestVar:

object TheClient extends RequestVar[Box[Client]](Empty)
object ReturnToMe extends RequestVar[Box[() = Unit]](Empty)

class ClientEditor extends StatefulSnippet {
  val referer = S.referer openOr /
  val client = TheClient.is openOr {S.error(client not provided);
S.redirectTo(referer)}
  val goBackFunc = ReturnToMe.is

  ... stuff here

  when done:

  goBackFunc.map(_.apply())
  S.redirectTo(referer)
}

So, your link to this page will contain a function that looks like:

{TheClient(Full(client)); ReturnToMe(Full({S.redirecTo(the from page, () =
{re-associate your stateful snippet})}))}


On Wed, Aug 5, 2009 at 1:07 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:


 I don't have code available to post right now, but let me try to explain
 better.
 Basically you're editing a request, which is associated with a client. Now
 when your entering the request you may notice that the client's info is
 wrong. So I need a link to the client editing page, which is StatefulSnippet
 based. However, when that page loads it has to use an instance of the
 snippet that knows which client I want to edit.

 -
 David Pollakfeeder.of.the.be...@gmail.com wrote:

 Please provide a complete (executable) code sample so I can understand the
 flow.

 On Wed, Aug 5, 2009 at 9:40 AM, Naftoli Gugenheim naftoli...@gmail.com
 wrote:

 
  Hi. I have one screen, /requests/edit, that links to /clients/edit, in
  order to edit a specific client. Both use StatefulSnippet. In the link I
  specify a function that instantiates and registers an instance of that
  StatefulSnippet. However the page does not use that instance but a new
  instance instead. What am I doing wrong?
  Thanks.
 
 
  
 


 --
 Lift, the simply functional web framework http://liftweb.net
 Beginning Scala http://www.apress.com/book/view/1430219890
 Follow me: http://twitter.com/dpp
 Git some: http://github.com/dpp



 



-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Prepare StatefulSnippet in advance

2009-08-05 Thread David Pollak
On Wed, Aug 5, 2009 at 1:25 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:


 I have working now by instantiating a client snippet class and calling
 S.mapSnippet with the snippet's edit method. But why didn't it work by
 calling its registerThisSnippet method?


because the snippet didn't know its name.




 -
 David Pollakfeeder.of.the.be...@gmail.com wrote:

 Create a top-level RequestVar:

 object TheClient extends RequestVar[Box[Client]](Empty)
 object ReturnToMe extends RequestVar[Box[() = Unit]](Empty)

 class ClientEditor extends StatefulSnippet {
  val referer = S.referer openOr /
  val client = TheClient.is openOr {S.error(client not provided);
 S.redirectTo(referer)}
  val goBackFunc = ReturnToMe.is

  ... stuff here

  when done:

  goBackFunc.map(_.apply())
  S.redirectTo(referer)
 }

 So, your link to this page will contain a function that looks like:

 {TheClient(Full(client)); ReturnToMe(Full({S.redirecTo(the from page, () =
 {re-associate your stateful snippet})}))}


 On Wed, Aug 5, 2009 at 1:07 PM, Naftoli Gugenheim naftoli...@gmail.com
 wrote:

 
  I don't have code available to post right now, but let me try to explain
  better.
  Basically you're editing a request, which is associated with a client.
 Now
  when your entering the request you may notice that the client's info is
  wrong. So I need a link to the client editing page, which is
 StatefulSnippet
  based. However, when that page loads it has to use an instance of the
  snippet that knows which client I want to edit.
 
  -
  David Pollakfeeder.of.the.be...@gmail.com wrote:
 
  Please provide a complete (executable) code sample so I can understand
 the
  flow.
 
  On Wed, Aug 5, 2009 at 9:40 AM, Naftoli Gugenheim naftoli...@gmail.com
  wrote:
 
  
   Hi. I have one screen, /requests/edit, that links to /clients/edit, in
   order to edit a specific client. Both use StatefulSnippet. In the link
 I
   specify a function that instantiates and registers an instance of that
   StatefulSnippet. However the page does not use that instance but a new
   instance instead. What am I doing wrong?
   Thanks.
  
  
   
  
 
 
  --
  Lift, the simply functional web framework http://liftweb.net
  Beginning Scala http://www.apress.com/book/view/1430219890
  Follow me: http://twitter.com/dpp
  Git some: http://github.com/dpp
 
 
 
  
 


 --
 Lift, the simply functional web framework http://liftweb.net
 Beginning Scala http://www.apress.com/book/view/1430219890
 Follow me: http://twitter.com/dpp
 Git some: http://github.com/dpp



 



-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Prepare StatefulSnippet in advance

2009-08-05 Thread Naftoli Gugenheim

Okay, that makes sense! I guess it's generated during the xml processing stage?

-
David Pollakfeeder.of.the.be...@gmail.com wrote:

On Wed, Aug 5, 2009 at 1:25 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:


 I have working now by instantiating a client snippet class and calling
 S.mapSnippet with the snippet's edit method. But why didn't it work by
 calling its registerThisSnippet method?


because the snippet didn't know its name.




 -
 David Pollakfeeder.of.the.be...@gmail.com wrote:

 Create a top-level RequestVar:

 object TheClient extends RequestVar[Box[Client]](Empty)
 object ReturnToMe extends RequestVar[Box[() = Unit]](Empty)

 class ClientEditor extends StatefulSnippet {
  val referer = S.referer openOr /
  val client = TheClient.is openOr {S.error(client not provided);
 S.redirectTo(referer)}
  val goBackFunc = ReturnToMe.is

  ... stuff here

  when done:

  goBackFunc.map(_.apply())
  S.redirectTo(referer)
 }

 So, your link to this page will contain a function that looks like:

 {TheClient(Full(client)); ReturnToMe(Full({S.redirecTo(the from page, () =
 {re-associate your stateful snippet})}))}


 On Wed, Aug 5, 2009 at 1:07 PM, Naftoli Gugenheim naftoli...@gmail.com
 wrote:

 
  I don't have code available to post right now, but let me try to explain
  better.
  Basically you're editing a request, which is associated with a client.
 Now
  when your entering the request you may notice that the client's info is
  wrong. So I need a link to the client editing page, which is
 StatefulSnippet
  based. However, when that page loads it has to use an instance of the
  snippet that knows which client I want to edit.
 
  -
  David Pollakfeeder.of.the.be...@gmail.com wrote:
 
  Please provide a complete (executable) code sample so I can understand
 the
  flow.
 
  On Wed, Aug 5, 2009 at 9:40 AM, Naftoli Gugenheim naftoli...@gmail.com
  wrote:
 
  
   Hi. I have one screen, /requests/edit, that links to /clients/edit, in
   order to edit a specific client. Both use StatefulSnippet. In the link
 I
   specify a function that instantiates and registers an instance of that
   StatefulSnippet. However the page does not use that instance but a new
   instance instead. What am I doing wrong?
   Thanks.
  
  
   
  
 
 
  --
  Lift, the simply functional web framework http://liftweb.net
  Beginning Scala http://www.apress.com/book/view/1430219890
  Follow me: http://twitter.com/dpp
  Git some: http://github.com/dpp
 
 
 
  
 


 --
 Lift, the simply functional web framework http://liftweb.net
 Beginning Scala http://www.apress.com/book/view/1430219890
 Follow me: http://twitter.com/dpp
 Git some: http://github.com/dpp



 



-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Comet render and jQuery

2009-08-05 Thread Avo Reid

I am might be going about this in the wrong way but I wanted to get
confirmation.

I have a comet lift snippet that waits for a comet actor to send down
search results triggered by a button click after entering keywords.


lift:comet type=SearchActor
Search:SearchResultsLoading.../
Search:SearchResults
 /lift:comet

In the actor I rendor the search results and merge an onclick function
into the header document.ready.  Things seem to work fine but after
the snippet renders the onclick function does not activate until I
click on 2 hyperlinks, which takes me to the linked website (click
url) then hitting the back button back to the liftwebsite, basically
reloading the page twice.  After this the alert box shows up for each
hyperlink.

I can refactor this to work in a different way but I wanted to
understand what is wrong here if anyone knows.

Thanks in advance


def render = {
def searchResultFormatter(itemToFormat: SearchResultSet): NodeSeq
= {
  tr
  td
  a href={itemToFormat.resultSetItem.clickUrl} class=searchlink
{itemToFormat.resultSetItem.title}/a
  /td
  /tr
  tr
  td{itemToFormat.resultSetItem.summary}/td
  /tr
 }
bind(SearchResults - table{searchLinks.flatMap
(resultFormatter _)}/table

head
script type=text/javascript charset=utf-8{Unparsed
(
 jQuery(document).ready(function() {
$('.searchlink').click(function() {
 alert('call made it here');
 return (false);
 });
  })
 )}/script
/head)

  }

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Code review for some Mailer enhancements

2009-08-05 Thread David Pollak
Spencer,

I've taken your suggestions and rolled them into Lift... see the enclosed
diff.

Thanks for making the suggestion.

David

On Wed, Jul 8, 2009 at 3:29 PM, Spencer Uresk sur...@gmail.com wrote:


 As I alluded to in another email, the way Lift's Mailer class works
 causes some problems when deploying to Tomcat (or any environment
 where you have multiple applications) due to it relying on System
 properties for most of the configuration. As I'm still trying to wrap
 my head around both Lift and Scala, I thought it would be a fun
 exercise to try and enhance Mailer to allow more flexible configuration.

 If anyone has a few minutes, I'd appreciate a review of my code and
 the approach I took. If it is good and useful enough, I hope you'll
 consider accepting a patch to add these features back into Lift.

 So, the idea I had was to allow configuration via JNDI or via a simple
 property map. The session lookup function would first try to get a
 session via JNDI, if that doesn't work, it will look to see if there
 are custom properties to set, otherwise it just uses the default
 system properties (which is how it works now).

 One feature I added that I'm not 100% sure about is if there is an
 exception when looking up the JNDI reference, it swallows the
 exception and returns Empty so that custom/default properties can be
 used. This would allow you to use JNDI in production, but a simple
 property map in development. This is a nice convenience feature, but
 it could potentially hide production errors (although the exception is
 logged).

 Here are the pieces of Mailer I changed/addded:

   var authenticator: Box[Authenticator] = Empty

   var jndiName: Box[String] = Empty

   var customProperties: Box[Map[String, String]] = Empty

   private def getJndiSession: Box[Session] = jndiName match {
 case Full(jndiSessionName) =
   var session: Box[Session] = Empty

   try {
 val context: Context = new InitialContext().lookup(java:comp/
 env).asInstanceOf[Context];
 session =
 Full(context.lookup(jndiSessionName).asInstanceOf[Session])
   } catch {
 case e: Exception = Log.error(Cannot lookup session from
 JNDI, e)
   }

   session
 case _ = Empty
   }

   def session: Session = {
 val session = getJndiSession match {
   case Full(jndiSession) = jndiSession
   case _ = authenticator match {
 case Full(a) = Session.getInstance(buildProps, a)
 case _ = Session.getInstance(buildProps)
   }
 }

 session
   }


   def buildProps: Properties = {
 val p = System.getProperties.clone.asInstanceOf[Properties]

 customProperties match {
   case Full(customProperties) =
 {customProperties.keys.foreach{key = p.put(key,
 customProperties(key))}}
   case _ =
 }

 p
   }


 ===

 And here is how you would configure the mailer in your Boot class:

 // Using custom properties
 val mailProps: Map[String, String] = Map(mail.smtp.starttls.enable -
   true, mail.smtp.host - smtp.gmail.com, mail.smtp.auth -
 true, mail.smtp.port - 587)
 SuperMailer.customProperties = Full(mailProps)

 // Using JNDI
 SuperMailer.jndiName = mail/Session

 ===

 I still need to do a little more testing, but everything seems to be
 working ok. I'd appreciate any feedback on the code.

 Thanks,

 - Spencer

 



-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---

diff --git a/lift-util/src/main/scala/net/liftweb/util/Mailer.scala 
b/lift-util/src/main/scala/net/liftweb/util/Mailer.scala
index e1a4742..2ed4d8d 100644
--- a/lift-util/src/main/scala/net/liftweb/util/Mailer.scala
+++ b/lift-util/src/main/scala/net/liftweb/util/Mailer.scala
@@ -18,6 +18,8 @@ import _root_.scala.actors._
 import Actor._
 import _root_.javax.mail._
 import _root_.javax.mail.internet._
+import _root_.javax.naming.{Context, InitialContext}
+import _root_.java.util.Properties
 
 /**
  * Utilities for sending email.
@@ -67,6 +69,31 @@ object Mailer {
   var authenticator: Box[Authenticator] = Empty
 
   /**
+   * Use the mailer resource in your container by specifying the JNDI name
+   */
+  var jndiName: Box[String] = Empty
+
+  /**
+   * Custom properties for the JNDI session
+   */
+  var customProperties: Map[String, String] = Map()
+
+  lazy val jndiSession: Box[Session] =
+  for {
+name - jndiName
+contextObj - Helpers.tryo(new InitialContext().lookup(java:comp/env))
+context - 

[Lift] More than one lift:surround in HTML file

2009-08-05 Thread pabraham

Hello there,

Is it possible for an HTML file to have more than one lift:surround
tag?

For example, default.html contains

...
lift:bind name=content
...
lift:bind name=sidebar
...

My index.html contains

lift:surround with=default at=content
  pThis is some content/p
/lift:surround
lift:surround with=default at=sidebar
  pThis is some content in the sidebar/p
/lift:surround

From my fruitless attempts, it seems that the answer to my question is
no, but is there any way that I can get this sort of thing to work?

Thanks.

Paul.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: More than one lift:surround in HTML file

2009-08-05 Thread marius d.

No. Each template must be xml well formed so you can not have more
then one root element,

Please see lift:with-param to handle multiple binds.

Br;s,
Marius

On Aug 6, 12:04 am, pabraham paulabraham...@googlemail.com wrote:
 Hello there,

 Is it possible for an HTML file to have more than one lift:surround
 tag?

 For example, default.html contains

 ...
 lift:bind name=content
 ...
 lift:bind name=sidebar
 ...

 My index.html contains

 lift:surround with=default at=content
   pThis is some content/p
 /lift:surround
 lift:surround with=default at=sidebar
   pThis is some content in the sidebar/p
 /lift:surround

 From my fruitless attempts, it seems that the answer to my question is
 no, but is there any way that I can get this sort of thing to work?

 Thanks.

 Paul.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: More than one lift:surround in HTML file

2009-08-05 Thread Naftoli Gugenheim

XML documents need to have a single top-level element. Surround the whole 
index.html with lift:children.

-
pabrahampaulabraham...@googlemail.com wrote:


Hello there,

Is it possible for an HTML file to have more than one lift:surround
tag?

For example, default.html contains

...
lift:bind name=content
...
lift:bind name=sidebar
...

My index.html contains

lift:surround with=default at=content
  pThis is some content/p
/lift:surround
lift:surround with=default at=sidebar
  pThis is some content in the sidebar/p
/lift:surround

From my fruitless attempts, it seems that the answer to my question is
no, but is there any way that I can get this sort of thing to work?

Thanks.

Paul.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: More than one lift:surround in HTML file

2009-08-05 Thread pabraham

I've added lift:children to my index.html file and now get:

XML Parsing Error: junk after document element
Location: http://192.168.96.150:8080/
Line Number 113, Column 1:html xmlns:lift=http://liftweb.net/;
xmlns=http://www.w3.org/1999/xhtml;
^

Any ideas?

In the meantime I can look at lift:with-param.

Paul.

On 5 Aug, 22:08, Naftoli Gugenheim naftoli...@gmail.com wrote:
 XML documents need to have a single top-level element. Surround the whole 
 index.html with lift:children.

 -

 pabrahampaulabraham...@googlemail.com wrote:

 Hello there,

 Is it possible for an HTML file to have more than one lift:surround
 tag?

 For example, default.html contains

 ...
 lift:bind name=content
 ...
 lift:bind name=sidebar
 ...

 My index.html contains

 lift:surround with=default at=content
   pThis is some content/p
 /lift:surround
 lift:surround with=default at=sidebar
   pThis is some content in the sidebar/p
 /lift:surround

 From my fruitless attempts, it seems that the answer to my question is
 no, but is there any way that I can get this sort of thing to work?

 Thanks.

 Paul.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: More than one lift:surround in HTML file

2009-08-05 Thread Naftoli Gugenheim

Which browser gives that error? What do you see in View Source?

-
pabrahampaulabraham...@googlemail.com wrote:


I've added lift:children to my index.html file and now get:

XML Parsing Error: junk after document element
Location: http://192.168.96.150:8080/
Line Number 113, Column 1:html xmlns:lift=http://liftweb.net/;
xmlns=http://www.w3.org/1999/xhtml;
^

Any ideas?

In the meantime I can look at lift:with-param.

Paul.

On 5 Aug, 22:08, Naftoli Gugenheim naftoli...@gmail.com wrote:
 XML documents need to have a single top-level element. Surround the whole 
 index.html with lift:children.

 -

 pabrahampaulabraham...@googlemail.com wrote:

 Hello there,

 Is it possible for an HTML file to have more than one lift:surround
 tag?

 For example, default.html contains

 ...
 lift:bind name=content
 ...
 lift:bind name=sidebar
 ...

 My index.html contains

 lift:surround with=default at=content
   pThis is some content/p
 /lift:surround
 lift:surround with=default at=sidebar
   pThis is some content in the sidebar/p
 /lift:surround

 From my fruitless attempts, it seems that the answer to my question is
 no, but is there any way that I can get this sort of thing to work?

 Thanks.

 Paul.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Eclipse setup

2009-08-05 Thread steffen.weissmann

I have trouble with getting started with lift in eclipse. In my
project, created from lift-archetype-basic 1.1-SNAPSHOT, i have all
the lift jars with attached sources (all in the maven repository)
under Referenced Libraries. I can also browse the source code by
double-clicking on the classes there, but i have no code completion
for many of these classes. Sometimes when Ctrl-clicking on a Scala
type it opens Object.java source... What I am using is Eclipse Galileo
with Scala plugin 2.7.5.

Thanks for any suggestions...

Steffen.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Eclipse setup

2009-08-05 Thread Miles Sabin

On Wed, Aug 5, 2009 at 10:21 PM,
steffen.weissmannsteffen.weissm...@googlemail.com wrote:
 I have trouble with getting started with lift in eclipse. In my
 project, created from lift-archetype-basic 1.1-SNAPSHOT, i have all
 the lift jars with attached sources (all in the maven repository)
 under Referenced Libraries. I can also browse the source code by
 double-clicking on the classes there, but i have no code completion
 for many of these classes. Sometimes when Ctrl-clicking on a Scala
 type it opens Object.java source... What I am using is Eclipse Galileo
 with Scala plugin 2.7.5.

This sounds like Maven breakage yet again.

Can you show me the contents of your .project and .classpath files.

Cheers,


Miles

-- 
Miles Sabin
tel: +44 (0)7813 944 528
skype:  milessabin
http://www.chuusai.com/
http://twitter.com/milessabin

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Eclipse setup

2009-08-05 Thread Steffen Weißmann
 Can you show me the contents of your .project and .classpath files.

Both files attached. Thanks for looking into it...

On Wed, Aug 5, 2009 at 11:34 PM, Miles Sabinmi...@milessabin.com wrote:

 On Wed, Aug 5, 2009 at 10:21 PM,
 steffen.weissmannsteffen.weissm...@googlemail.com wrote:
 I have trouble with getting started with lift in eclipse. In my
 project, created from lift-archetype-basic 1.1-SNAPSHOT, i have all
 the lift jars with attached sources (all in the maven repository)
 under Referenced Libraries. I can also browse the source code by
 double-clicking on the classes there, but i have no code completion
 for many of these classes. Sometimes when Ctrl-clicking on a Scala
 type it opens Object.java source... What I am using is Eclipse Galileo
 with Scala plugin 2.7.5.

 This sounds like Maven breakage yet again.

 Can you show me the contents of your .project and .classpath files.

 Cheers,


 Miles

 --
 Miles Sabin
 tel: +44 (0)7813 944 528
 skype:  milessabin
 http://www.chuusai.com/
 http://twitter.com/milessabin

 




-- 
Steffen Weissmann

Technische Universitaet Berlin - Math. Department - MA 3-2

Str. des 17. Juni 136
10623 Berlin - Germany

Phone: +49 30 314-29278
Mail: weissm...@math.tu-berlin.de
Web: www.math.tu-berlin.de/~weissman

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



.classpath
Description: Binary data


.project
Description: Binary data


[Lift] Re: Exception for S.? while booting

2009-08-05 Thread Naftoli Gugenheim

I just read the scaladoc comment of S.init. Does it have anything to do with 
this subject?

-
Heiko Seebergerheiko.seeber...@googlemail.com wrote:

Ah, yes!Sorry, I did not get the point, but obviously the val is to be
blamed ;-)
Now it's running, thanx!!!

Heiko

2009/8/5 marius d. marius.dan...@gmail.com


 I'm aware about the override thing but I don't see why you would do it
 in such way. Since you don't have state, you don't have a session =
 you don't have S. Are you using a statelesDispatchPf ?

 You can do:

 1. Use your own ResourceBundles
 2. Or a hacky thingy like:

 val session = LiftRules.getLiftSession(request, httpRequest)
 S.initIfUninitted(session) {
   // Now you should be able to call call S.?(...)
 }

 Localization is bound to state as ResourceBundles

 You exception thrown in Boot probably was cause because you used a val
 and it obviously tried to initialize it. Using a def or lazy val it
 would be evaluated properly upon requests.

 Typically S.? is used in the context of page rendering, Ajax functions
 processing, DispatchPF. All these are executed in a stateful context
 where S is available. To process pure stateless requests you have
 LiftRules.statelessDispatchTable, and a few request processing
 hooks ... but do you really need those?

 Do you have a usecase when you want to process a pure stateless
 requests and need Lift's localization?

 Br's,
 Marius

 On Aug 5, 8:50 am, Heiko Seeberger heiko.seeber...@googlemail.com
 wrote:
  def can be overridden with val. But this is a Scala thingy, please do not
  bother. If it makes you easier replace val with def.
  The question remains: How can i18n be done in stateless (request state)
  cases?
 
  2009/8/5 marius d. marius.dan...@gmail.com
 
 
 
 
 
   I thought validations is a function not a val:
 
   override val validations should probably be
 
   override def validations ?
 
   or
 
   override lazy val validations ?
 
   Br's,
   Marius
 
   On Aug 5, 7:48 am, Heiko Seeberger heiko.seeber...@googlemail.com
   wrote:
I would like to internationalize my code. Something like:
Mapper class:
 
class Course
  extends LongKeyedMapper[Course]
  with IdPK {
 
  ...
 
override val validations =
  valMinLen(3, ?(minLen, 3)) _ ::
  valMaxLen(50, ?(maxLen, 50)) _ ::
  Nil
  }
 
Localized messages:
 
minLen=At least %s characters required!
maxLen=At most %s characters allowed!
 
Thanx
Heiko
 
2009/8/4 marius d. marius.dan...@gmail.com
 
 S lifetime is per request. S is not constructed on Boot. Could you
 post a code snippet on what you're trying to achieve?
 
 Br's,
 Marius
 
 On Aug 4, 12:43 pm, Heiko Seeberger 
 heiko.seeber...@googlemail.com
 wrote:
  Hi,
 
  When I try to use internationalization via S.? in a Mapper class,
 I
   get
 the
  below exception while booting Lift. It seems that S._resBundle is
   null
 when
  Schemifier tries to do its work.
 
  Is this a bug or a feature (S must not be used outside the
 request
   life
  cycle). If last, how to i18n then?
 
  Thanx
  Heiko
 
  0 [main] ERROR lift - Failed to Boot
  java.lang.ExceptionInInitializerError
  at bootstrap.liftweb.Boot.boot(Boot.scala:38)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at
 
  
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  at
 
  
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:585)
  at
 
  
 net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply(ClassHelpers.scala:408)
  at
 
  
 net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply(ClassHelpers.scala:406)
  at
 
  
 net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply(LiftRules.scala:1096)
  at
 
  
 net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply(LiftRules.scala:1096)
  at net.liftweb.util.Full.map(Box.scala:330)
  at net.liftweb.http.DefaultBootstrap$.boot(LiftRules.scala:1096)
  at net.liftweb.http.LiftFilter.bootLift(LiftServlet.scala:560)
  at net.liftweb.http.LiftFilter.init(LiftServlet.scala:534)
  at
   org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
  at
 
  
 org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
  at
 
  
 org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:653)
  at
 org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
  at
 
  
 org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1239)
  at
 
  
 org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
  at
   org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:466)
  at
 
  
 

[Lift] Re: Eclipse setup

2009-08-05 Thread Miles Sabin

On Wed, Aug 5, 2009 at 10:39 PM, Steffen
Weißmannsteffen.weissm...@googlemail.com wrote:
 Can you show me the contents of your .project and .classpath files.

 Both files attached. Thanks for looking into it...

OK, you have two problem here (which are Scala IDE bugs, so I was a
bit harsh on Maven this time around).

You have two output folders: the Scala IDE = 2.7.5.final only
supports one. Use a single default output folder.

You also have source directories nested below the top level of your
project. Although I've seen reports that this works from various
people, there's code in 2.7.5.final and earlier which makes this
unlikely. If switching to a single output folder doesn't solve your
problems try also moving your source directories to the top level.

Both of these issues are fixed on trunk (but don't go there unless
you're using the Lift 2.8.0 branch).

Let me know how you get on ...

Cheers,


Miles

-- 
Miles Sabin
tel: +44 (0)7813 944 528
skype:  milessabin
http://www.chuusai.com/
http://twitter.com/milessabin

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: More than one lift:surround in HTML file

2009-08-05 Thread Timothy Perrett

Marius is right, use with-param... That's the correct solution here.

Cheers, Tim


On 05/08/2009 22:19, pabraham paulabraham...@googlemail.com wrote:

 
 I've added lift:children to my index.html file and now get:
 
 XML Parsing Error: junk after document element
 Location: http://192.168.96.150:8080/
 Line Number 113, Column 1:html xmlns:lift=http://liftweb.net/;
 xmlns=http://www.w3.org/1999/xhtml;
 ^
 
 Any ideas?
 
 In the meantime I can look at lift:with-param.
 
 Paul.
 
 On 5 Aug, 22:08, Naftoli Gugenheim naftoli...@gmail.com wrote:
 XML documents need to have a single top-level element. Surround the whole
 index.html with lift:children.
 
 -
 
 pabrahampaulabraham...@googlemail.com wrote:
 
 Hello there,
 
 Is it possible for an HTML file to have more than one lift:surround
 tag?
 
 For example, default.html contains
 
 ...
 lift:bind name=content
 ...
 lift:bind name=sidebar
 ...
 
 My index.html contains
 
 lift:surround with=default at=content
   pThis is some content/p
 /lift:surround
 lift:surround with=default at=sidebar
   pThis is some content in the sidebar/p
 /lift:surround
 
 From my fruitless attempts, it seems that the answer to my question is
 no, but is there any way that I can get this sort of thing to work?
 
 Thanks.
 
 Paul.
 
  
 



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: New features

2009-08-05 Thread glenn

Naftoli,

Hate to do this to you, but I'm getting the following error using
ManyToMany for Users to Roles:

Message: java.lang.RuntimeException: Broken join
scala.Predef$.error(Predef.scala:76)
net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children$1$
$anonfun$apply$1.apply(ManyToMany.scala:54)
net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children$1$
$anonfun$apply$1.apply(ManyToMany.scala:54)
net.liftweb.util.EmptyBox.openOr(Box.scala:372)
net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children
$1.apply(ManyToMany.scala:54)
net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children
$1.apply(ManyToMany.scala:54)
scala.List.map(List.scala:812)
net.liftweb.mapper.ManyToMany$MappedManyToMany.children
(ManyToMany.scala:54)
net.liftweb.mapper.ManyToMany$MappedManyToMany.elements
(ManyToMany.scala:96)
scala.Seq$class.flatMap(Seq.scala:293)
net.liftweb.mapper.ManyToMany$MappedManyToMany.flatMap
(ManyToMany.scala:44)

 def edit(ns: NodeSeq): NodeSeq = {
val theUser = view.entity
val addRole = TheBindParam(insert, view.snippet.link(edit, ()
= theUser.roles += new Role, Text(S?(Add Role

bind(user, ns,
 firstname - text(theUser.firstName.is, theUser.firstName
(_), (size,20)),
 lastname - text(theUser.lastName.is,theUser.lastName(_),
(size, 30)),
 roles - theUser.roles.flatMap{role =
  bind(role, ns,
  name - role.name.toForm,
  remove - SHtml.submit(S?(Remove), ()=
theUser.roles -= role)
  )
  },
 addRole,
 submit - SHtml.submit(S?(Save), ()=view.save)
 )
}

The offending code seems to be the line: roles -
theUser.roles.flatMap{
in the above bind method when I click on the addRole link.

Here's my User class:

class User extends MegaProtoUser[User] with ManyToMany[Long,User]{
  def getSingleton = User // what's the meta server

   object roles
extends MappedManyToMany(UserRole, UserRole.user, UserRole.role,
Role)

}

What am I doing wrong? You can see how difficult it is to slog through
this code, let alone just
trying to explain the problem so I can get help.

On Aug 5, 9:57 am, Naftoli Gugenheim naftoli...@gmail.com wrote:
 I'll try.
 By the way, as per my correction, you can implement list the regular way 
 without ModelView, and just use ModelSnippet's load function in your edit 
 link or button, passing it the User instance.

 -

 glenngl...@exmbly.com wrote:

 Naftoli,

 I fixed my code per your comments and now I can edit and remove users
 from a list, as long as I populate the list with
 ModelView instances, as you said. As for the docs, this step was not
 clear to me at all. I just assumed that the list was
 just populated with User entities and the view in the ModelSnippet was
 instantiated with the selected User on each request.

 It sounds like your plate is pretty full, so I won't expect much, but
 sometime soon, could you provide an example, or improved
 docs, for using TableEditor and its related ItemsList trait.

 Thanks for all.

 Glenn...

 On Aug 5, 9:18 am, Naftoli Gugenheim naftoli...@gmail.com wrote:

  Correction: ModelSnippet.load takes the actual Mapper instance, not the 
  ModelView wrapper.

  -

  Naftoli Gugenheimnaftoli...@gmail.com wrote:

  To answer your immediate question, the listing should not refer to the 
  snippet's view but new ModelView instances for each entity. Then editAction 
  is shorthand for the snippet's link method with a callback to call load on 
  the ModelView. To set the snippet's view's entity, either call load on the 
  snippet with the other ModelView, or call load on the other ModelView (or 
  just set its entity directly).
  As far as documentation, please tell me what scaladocs need what 
  clarification. Thanks.

  -

  glenngl...@exmbly.com wrote:

  Naftoli,

  Functional programming systems are notoriously difficult to document.
  The only way to really know what's going on is to meticulously trace
  through the source. But that requires
  time-consuming trial and error coding. So, without clear examples
  demonstrating exactly what you have in mind, I and others in the same
  boat, could spend days and still not
  get it right.

  For example, I tried this:

  var theUser:User = null
  val view = new ModelView(theUser, this)

   def list(ns: NodeSeq): NodeSeq =  User.currentUser.map({user =
          User.findAll.flatMap({u =
              bind(user, chooseTemplate(user, entry, ns),
                   firstname - Text(u.firstName.is),
                   lastname - Text(u.lastName.is),
                   email - Text(u.email.is),
                   roles - u.roles.map(_.name.toString).mkString(,
  ),
                   view.editAction,
                   view.removeAction
               

[Lift] Re: Asynchronous Javascript problem

2009-08-05 Thread Channing Walton

ok I've done that: git://github.com/channingwalton/lift_1_1_sample.git

run the app up and go to http://localhost:8080/mapSearch and try the
search. I find stack overflow in Safari 4.0.2, and Opera 9.64. The
query works in Firefox 3.5.2 and Webkit Version 4.0.2 (5530.19,
r46770) (latest nightly) - all OS X

I haven't been able to test on windows yet.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: New features

2009-08-05 Thread Naftoli Gugenheim

First of all, let me tell you what the error means. It means that there is a 
relevant row in the join table that doesn't have a corresponding element in the 
other table. Specifically, calling joinRecord.childMappedForeignKey.obj, so to 
speak, returns Empty.
The question is how it got to this inconsistent state. When you add a Role to a 
User, MappedManyToMany creates a UserRole for it. For some reason though there 
is a UserRole without a Role or User.
Can you send me a self-contained project? Also is it high priority?

-
glenngl...@exmbly.com wrote:


Naftoli,

Hate to do this to you, but I'm getting the following error using
ManyToMany for Users to Roles:

Message: java.lang.RuntimeException: Broken join
scala.Predef$.error(Predef.scala:76)
net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children$1$
$anonfun$apply$1.apply(ManyToMany.scala:54)
net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children$1$
$anonfun$apply$1.apply(ManyToMany.scala:54)
net.liftweb.util.EmptyBox.openOr(Box.scala:372)
net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children
$1.apply(ManyToMany.scala:54)
net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children
$1.apply(ManyToMany.scala:54)
scala.List.map(List.scala:812)
net.liftweb.mapper.ManyToMany$MappedManyToMany.children
(ManyToMany.scala:54)
net.liftweb.mapper.ManyToMany$MappedManyToMany.elements
(ManyToMany.scala:96)
scala.Seq$class.flatMap(Seq.scala:293)
net.liftweb.mapper.ManyToMany$MappedManyToMany.flatMap
(ManyToMany.scala:44)

 def edit(ns: NodeSeq): NodeSeq = {
val theUser = view.entity
val addRole = TheBindParam(insert, view.snippet.link(edit, ()
= theUser.roles += new Role, Text(S?(Add Role

bind(user, ns,
 firstname - text(theUser.firstName.is, theUser.firstName
(_), (size,20)),
 lastname - text(theUser.lastName.is,theUser.lastName(_),
(size, 30)),
 roles - theUser.roles.flatMap{role =
  bind(role, ns,
  name - role.name.toForm,
  remove - SHtml.submit(S?(Remove), ()=
theUser.roles -= role)
  )
  },
 addRole,
 submit - SHtml.submit(S?(Save), ()=view.save)
 )
}

The offending code seems to be the line: roles -
theUser.roles.flatMap{
in the above bind method when I click on the addRole link.

Here's my User class:

class User extends MegaProtoUser[User] with ManyToMany[Long,User]{
  def getSingleton = User // what's the meta server

   object roles
extends MappedManyToMany(UserRole, UserRole.user, UserRole.role,
Role)

}

What am I doing wrong? You can see how difficult it is to slog through
this code, let alone just
trying to explain the problem so I can get help.

On Aug 5, 9:57 am, Naftoli Gugenheim naftoli...@gmail.com wrote:
 I'll try.
 By the way, as per my correction, you can implement list the regular way 
 without ModelView, and just use ModelSnippet's load function in your edit 
 link or button, passing it the User instance.

 -

 glenngl...@exmbly.com wrote:

 Naftoli,

 I fixed my code per your comments and now I can edit and remove users
 from a list, as long as I populate the list with
 ModelView instances, as you said. As for the docs, this step was not
 clear to me at all. I just assumed that the list was
 just populated with User entities and the view in the ModelSnippet was
 instantiated with the selected User on each request.

 It sounds like your plate is pretty full, so I won't expect much, but
 sometime soon, could you provide an example, or improved
 docs, for using TableEditor and its related ItemsList trait.

 Thanks for all.

 Glenn...

 On Aug 5, 9:18 am, Naftoli Gugenheim naftoli...@gmail.com wrote:

  Correction: ModelSnippet.load takes the actual Mapper instance, not the 
  ModelView wrapper.

  -

  Naftoli Gugenheimnaftoli...@gmail.com wrote:

  To answer your immediate question, the listing should not refer to the 
  snippet's view but new ModelView instances for each entity. Then editAction 
  is shorthand for the snippet's link method with a callback to call load on 
  the ModelView. To set the snippet's view's entity, either call load on the 
  snippet with the other ModelView, or call load on the other ModelView (or 
  just set its entity directly).
  As far as documentation, please tell me what scaladocs need what 
  clarification. Thanks.

  -

  glenngl...@exmbly.com wrote:

  Naftoli,

  Functional programming systems are notoriously difficult to document.
  The only way to really know what's going on is to meticulously trace
  through the source. But that requires
  time-consuming trial and error coding. So, without clear examples
  demonstrating exactly what you have in mind, I and others in the same
  boat, could spend days 

[Lift] Re: New features

2009-08-05 Thread Naftoli Gugenheim

Oh, I think I know what the problem is. I think I should classify it as a bug.
Since you're adding a Role that isn't saved yet, and ManyToMany tracks the 
children via the join table, it can't access the child. As a workaround save 
the Role before adding it, although the need to do so is against the idea of 
ManyToMany and OneToMany. I will see what I can do, G-d willing.


-
glenngl...@exmbly.com wrote:


Naftoli,

Hate to do this to you, but I'm getting the following error using
ManyToMany for Users to Roles:

Message: java.lang.RuntimeException: Broken join
scala.Predef$.error(Predef.scala:76)
net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children$1$
$anonfun$apply$1.apply(ManyToMany.scala:54)
net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children$1$
$anonfun$apply$1.apply(ManyToMany.scala:54)
net.liftweb.util.EmptyBox.openOr(Box.scala:372)
net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children
$1.apply(ManyToMany.scala:54)
net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children
$1.apply(ManyToMany.scala:54)
scala.List.map(List.scala:812)
net.liftweb.mapper.ManyToMany$MappedManyToMany.children
(ManyToMany.scala:54)
net.liftweb.mapper.ManyToMany$MappedManyToMany.elements
(ManyToMany.scala:96)
scala.Seq$class.flatMap(Seq.scala:293)
net.liftweb.mapper.ManyToMany$MappedManyToMany.flatMap
(ManyToMany.scala:44)

 def edit(ns: NodeSeq): NodeSeq = {
val theUser = view.entity
val addRole = TheBindParam(insert, view.snippet.link(edit, ()
= theUser.roles += new Role, Text(S?(Add Role

bind(user, ns,
 firstname - text(theUser.firstName.is, theUser.firstName
(_), (size,20)),
 lastname - text(theUser.lastName.is,theUser.lastName(_),
(size, 30)),
 roles - theUser.roles.flatMap{role =
  bind(role, ns,
  name - role.name.toForm,
  remove - SHtml.submit(S?(Remove), ()=
theUser.roles -= role)
  )
  },
 addRole,
 submit - SHtml.submit(S?(Save), ()=view.save)
 )
}

The offending code seems to be the line: roles -
theUser.roles.flatMap{
in the above bind method when I click on the addRole link.

Here's my User class:

class User extends MegaProtoUser[User] with ManyToMany[Long,User]{
  def getSingleton = User // what's the meta server

   object roles
extends MappedManyToMany(UserRole, UserRole.user, UserRole.role,
Role)

}

What am I doing wrong? You can see how difficult it is to slog through
this code, let alone just
trying to explain the problem so I can get help.

On Aug 5, 9:57 am, Naftoli Gugenheim naftoli...@gmail.com wrote:
 I'll try.
 By the way, as per my correction, you can implement list the regular way 
 without ModelView, and just use ModelSnippet's load function in your edit 
 link or button, passing it the User instance.

 -

 glenngl...@exmbly.com wrote:

 Naftoli,

 I fixed my code per your comments and now I can edit and remove users
 from a list, as long as I populate the list with
 ModelView instances, as you said. As for the docs, this step was not
 clear to me at all. I just assumed that the list was
 just populated with User entities and the view in the ModelSnippet was
 instantiated with the selected User on each request.

 It sounds like your plate is pretty full, so I won't expect much, but
 sometime soon, could you provide an example, or improved
 docs, for using TableEditor and its related ItemsList trait.

 Thanks for all.

 Glenn...

 On Aug 5, 9:18 am, Naftoli Gugenheim naftoli...@gmail.com wrote:

  Correction: ModelSnippet.load takes the actual Mapper instance, not the 
  ModelView wrapper.

  -

  Naftoli Gugenheimnaftoli...@gmail.com wrote:

  To answer your immediate question, the listing should not refer to the 
  snippet's view but new ModelView instances for each entity. Then editAction 
  is shorthand for the snippet's link method with a callback to call load on 
  the ModelView. To set the snippet's view's entity, either call load on the 
  snippet with the other ModelView, or call load on the other ModelView (or 
  just set its entity directly).
  As far as documentation, please tell me what scaladocs need what 
  clarification. Thanks.

  -

  glenngl...@exmbly.com wrote:

  Naftoli,

  Functional programming systems are notoriously difficult to document.
  The only way to really know what's going on is to meticulously trace
  through the source. But that requires
  time-consuming trial and error coding. So, without clear examples
  demonstrating exactly what you have in mind, I and others in the same
  boat, could spend days and still not
  get it right.

  For example, I tried this:

  var theUser:User = null
  val view = new ModelView(theUser, this)

   def list(ns: 

[Lift] Re: New features

2009-08-05 Thread glenn

Naftoli,

While your working on this issue, there seems to be another. Here's
what's happening:

If I make a coding mistake, and code User as follows:

class User extends MegaProtoUser[User] with ManyToMany[Long,Role]{
  def getSingleton = User // what's the meta server

   object roles
extends MappedManyToMany(UserRole, UserRole.user, UserRole.role,
Role)


}

instead of

class User extends MegaProtoUser[User] with ManyToMany[LongUser]{ ...

I don't get a compiler error (I'm using Eclipse with the Scala
plugin). Instead,
I get a stack overflow error and my IDE crashes.

Glenn...


On Aug 5, 3:39 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
 Oh, I think I know what the problem is. I think I should classify it as a bug.
 Since you're adding a Role that isn't saved yet, and ManyToMany tracks the 
 children via the join table, it can't access the child. As a workaround save 
 the Role before adding it, although the need to do so is against the idea of 
 ManyToMany and OneToMany. I will see what I can do, G-d willing.

 -

 glenngl...@exmbly.com wrote:

 Naftoli,

 Hate to do this to you, but I'm getting the following error using
 ManyToMany for Users to Roles:

 Message: java.lang.RuntimeException: Broken join
         scala.Predef$.error(Predef.scala:76)
         net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children$1$
 $anonfun$apply$1.apply(ManyToMany.scala:54)
         net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children$1$
 $anonfun$apply$1.apply(ManyToMany.scala:54)
         net.liftweb.util.EmptyBox.openOr(Box.scala:372)
         net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children
 $1.apply(ManyToMany.scala:54)
         net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children
 $1.apply(ManyToMany.scala:54)
         scala.List.map(List.scala:812)
         net.liftweb.mapper.ManyToMany$MappedManyToMany.children
 (ManyToMany.scala:54)
         net.liftweb.mapper.ManyToMany$MappedManyToMany.elements
 (ManyToMany.scala:96)
         scala.Seq$class.flatMap(Seq.scala:293)
         net.liftweb.mapper.ManyToMany$MappedManyToMany.flatMap
 (ManyToMany.scala:44)

  def edit(ns: NodeSeq): NodeSeq = {
     val theUser = view.entity
     val addRole = TheBindParam(insert, view.snippet.link(edit, ()
 = theUser.roles += new Role, Text(S?(Add Role

     bind(user, ns,
          firstname - text(theUser.firstName.is, theUser.firstName
 (_), (size,20)),
          lastname - text(theUser.lastName.is,theUser.lastName(_),
 (size, 30)),
          roles - theUser.roles.flatMap{role =
               bind(role, ns,
                   name - role.name.toForm,
                   remove - SHtml.submit(S?(Remove), ()=
 theUser.roles -= role)
               )
           },
          addRole,
          submit - SHtml.submit(S?(Save), ()=view.save)
          )
     }

 The offending code seems to be the line: roles -
 theUser.roles.flatMap{
 in the above bind method when I click on the addRole link.

 Here's my User class:

 class User extends MegaProtoUser[User] with ManyToMany[Long,User]{
   def getSingleton = User // what's the meta server

    object roles
     extends MappedManyToMany(UserRole, UserRole.user, UserRole.role,
 Role)

 }

 What am I doing wrong? You can see how difficult it is to slog through
 this code, let alone just
 trying to explain the problem so I can get help.

 On Aug 5, 9:57 am, Naftoli Gugenheim naftoli...@gmail.com wrote:

  I'll try.
  By the way, as per my correction, you can implement list the regular way 
  without ModelView, and just use ModelSnippet's load function in your edit 
  link or button, passing it the User instance.

  -

  glenngl...@exmbly.com wrote:

  Naftoli,

  I fixed my code per your comments and now I can edit and remove users
  from a list, as long as I populate the list with
  ModelView instances, as you said. As for the docs, this step was not
  clear to me at all. I just assumed that the list was
  just populated with User entities and the view in the ModelSnippet was
  instantiated with the selected User on each request.

  It sounds like your plate is pretty full, so I won't expect much, but
  sometime soon, could you provide an example, or improved
  docs, for using TableEditor and its related ItemsList trait.

  Thanks for all.

  Glenn...

  On Aug 5, 9:18 am, Naftoli Gugenheim naftoli...@gmail.com wrote:

   Correction: ModelSnippet.load takes the actual Mapper instance, not the 
   ModelView wrapper.

   -

   Naftoli Gugenheimnaftoli...@gmail.com wrote:

   To answer your immediate question, the listing should not refer to the 
   snippet's view but new ModelView instances for each entity. Then 
   editAction is shorthand for the snippet's link method with a callback to 
   call load on the ModelView. To set the snippet's view's entity, either 
   call load on the snippet with the other ModelView, or 

[Lift] Where do I place a default.props file for use by Boot?

2009-08-05 Thread Jeff McKenna

Newbee:
I have a default.props file that I was able to read once.  I seem to
have lost the incantation.
Where do I put it.  I thought src/resouces would work.  But boot can
not see to read the file.
Any suggestions?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Where do I place a default.props file for use by Boot?

2009-08-05 Thread Tim Nelson
Try src/main/resources/props

On Wed, Aug 5, 2009 at 7:19 PM, Jeff McKenna agile.act...@gmail.com wrote:


 Newbee:
 I have a default.props file that I was able to read once.  I seem to
 have lost the incantation.
 Where do I put it.  I thought src/resouces would work.  But boot can
 not see to read the file.
 Any suggestions?
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: New features

2009-08-05 Thread Naftoli Gugenheim

Building causes a stack overflow?
So the question is, is it the resident compiler or plain scalac also crashes? 
Or just the presentation compiler? What do you see in the error log view or 
file?
I get compiler crashes very often when doing fancy mapper type related tricks.

-
glenngl...@exmbly.com wrote:


Naftoli,

Hate to do this to you, but I'm getting the following error using
ManyToMany for Users to Roles:

Message: java.lang.RuntimeException: Broken join
scala.Predef$.error(Predef.scala:76)
net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children$1$
$anonfun$apply$1.apply(ManyToMany.scala:54)
net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children$1$
$anonfun$apply$1.apply(ManyToMany.scala:54)
net.liftweb.util.EmptyBox.openOr(Box.scala:372)
net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children
$1.apply(ManyToMany.scala:54)
net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children
$1.apply(ManyToMany.scala:54)
scala.List.map(List.scala:812)
net.liftweb.mapper.ManyToMany$MappedManyToMany.children
(ManyToMany.scala:54)
net.liftweb.mapper.ManyToMany$MappedManyToMany.elements
(ManyToMany.scala:96)
scala.Seq$class.flatMap(Seq.scala:293)
net.liftweb.mapper.ManyToMany$MappedManyToMany.flatMap
(ManyToMany.scala:44)

 def edit(ns: NodeSeq): NodeSeq = {
val theUser = view.entity
val addRole = TheBindParam(insert, view.snippet.link(edit, ()
= theUser.roles += new Role, Text(S?(Add Role

bind(user, ns,
 firstname - text(theUser.firstName.is, theUser.firstName
(_), (size,20)),
 lastname - text(theUser.lastName.is,theUser.lastName(_),
(size, 30)),
 roles - theUser.roles.flatMap{role =
  bind(role, ns,
  name - role.name.toForm,
  remove - SHtml.submit(S?(Remove), ()=
theUser.roles -= role)
  )
  },
 addRole,
 submit - SHtml.submit(S?(Save), ()=view.save)
 )
}

The offending code seems to be the line: roles -
theUser.roles.flatMap{
in the above bind method when I click on the addRole link.

Here's my User class:

class User extends MegaProtoUser[User] with ManyToMany[Long,User]{
  def getSingleton = User // what's the meta server

   object roles
extends MappedManyToMany(UserRole, UserRole.user, UserRole.role,
Role)

}

What am I doing wrong? You can see how difficult it is to slog through
this code, let alone just
trying to explain the problem so I can get help.

On Aug 5, 9:57 am, Naftoli Gugenheim naftoli...@gmail.com wrote:
 I'll try.
 By the way, as per my correction, you can implement list the regular way 
 without ModelView, and just use ModelSnippet's load function in your edit 
 link or button, passing it the User instance.

 -

 glenngl...@exmbly.com wrote:

 Naftoli,

 I fixed my code per your comments and now I can edit and remove users
 from a list, as long as I populate the list with
 ModelView instances, as you said. As for the docs, this step was not
 clear to me at all. I just assumed that the list was
 just populated with User entities and the view in the ModelSnippet was
 instantiated with the selected User on each request.

 It sounds like your plate is pretty full, so I won't expect much, but
 sometime soon, could you provide an example, or improved
 docs, for using TableEditor and its related ItemsList trait.

 Thanks for all.

 Glenn...

 On Aug 5, 9:18 am, Naftoli Gugenheim naftoli...@gmail.com wrote:

  Correction: ModelSnippet.load takes the actual Mapper instance, not the 
  ModelView wrapper.

  -

  Naftoli Gugenheimnaftoli...@gmail.com wrote:

  To answer your immediate question, the listing should not refer to the 
  snippet's view but new ModelView instances for each entity. Then editAction 
  is shorthand for the snippet's link method with a callback to call load on 
  the ModelView. To set the snippet's view's entity, either call load on the 
  snippet with the other ModelView, or call load on the other ModelView (or 
  just set its entity directly).
  As far as documentation, please tell me what scaladocs need what 
  clarification. Thanks.

  -

  glenngl...@exmbly.com wrote:

  Naftoli,

  Functional programming systems are notoriously difficult to document.
  The only way to really know what's going on is to meticulously trace
  through the source. But that requires
  time-consuming trial and error coding. So, without clear examples
  demonstrating exactly what you have in mind, I and others in the same
  boat, could spend days and still not
  get it right.

  For example, I tried this:

  var theUser:User = null
  val view = new ModelView(theUser, this)

   def list(ns: NodeSeq): NodeSeq =  User.currentUser.map({user =
          User.findAll.flatMap({u =
              

[Lift] Re: Where do I place a default.props file for use by Boot?

2009-08-05 Thread Jeff McKenna

Thanks for the suggestion.  It seems to have worked.
jeff
On Aug 5, 5:31 pm, Tim Nelson tnell...@gmail.com wrote:
 Try src/main/resources/props

 On Wed, Aug 5, 2009 at 7:19 PM, Jeff McKenna agile.act...@gmail.com wrote:

  Newbee:
  I have a default.props file that I was able to read once.  I seem to
  have lost the incantation.
  Where do I put it.  I thought src/resouces would work.  But boot can
  not see to read the file.
  Any suggestions?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Alternate part of view

2009-08-05 Thread Naftoli Gugenheim

What's the smartest / most concise way to achieve the following in the 
corresponding view xhtml and snippet code:
Parts of the view have to change, depending on whether something is set. For 
example, in the area where you select the client, if the client is None, then 
it displays an interface to select a client. If it's set to a Some then it 
displays the client's details with a button to unset it. This pattern is 
repeated.
My current strategy is to have two elements, req:noClient and req:client, which 
have different xhtml contents. Then in the snippet I bind them to two NodeSeq 
functions, one that binds useful contents when the client is None and returns 
NodeSeq.Empty otherwise; and another function that binds when it's a Some and 
returns Empty otherwise. However, it seems to be somewhat redundant in theory.
So does anyone have a better way of switching view parts?
Thanks.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Exception for S.? while booting

2009-08-05 Thread marius d.

No really. That is for constructing an S object, as it needs the
reuest and session object. Lift calls that when processing statefull
requests and rendering pieline, bound functions etc. are executed in
this context. There is another function S.initIfUninitted where S can
be initialized having only the session and no request. This is used by
Lift inside Comet actors.

Typically applications should not care about this.

Br's,
Marius

On Aug 6, 12:50 am, Naftoli Gugenheim naftoli...@gmail.com wrote:
 I just read the scaladoc comment of S.init. Does it have anything to do with 
 this subject?

 -

 Heiko Seebergerheiko.seeber...@googlemail.com wrote:

 Ah, yes!Sorry, I did not get the point, but obviously the val is to be
 blamed ;-)
 Now it's running, thanx!!!

 Heiko

 2009/8/5 marius d. marius.dan...@gmail.com



  I'm aware about the override thing but I don't see why you would do it
  in such way. Since you don't have state, you don't have a session =
  you don't have S. Are you using a statelesDispatchPf ?

  You can do:

  1. Use your own ResourceBundles
  2. Or a hacky thingy like:

  val session = LiftRules.getLiftSession(request, httpRequest)
  S.initIfUninitted(session) {
    // Now you should be able to call call S.?(...)
  }

  Localization is bound to state as ResourceBundles

  You exception thrown in Boot probably was cause because you used a val
  and it obviously tried to initialize it. Using a def or lazy val it
  would be evaluated properly upon requests.

  Typically S.? is used in the context of page rendering, Ajax functions
  processing, DispatchPF. All these are executed in a stateful context
  where S is available. To process pure stateless requests you have
  LiftRules.statelessDispatchTable, and a few request processing
  hooks ... but do you really need those?

  Do you have a usecase when you want to process a pure stateless
  requests and need Lift's localization?

  Br's,
  Marius

  On Aug 5, 8:50 am, Heiko Seeberger heiko.seeber...@googlemail.com
  wrote:
   def can be overridden with val. But this is a Scala thingy, please do not
   bother. If it makes you easier replace val with def.
   The question remains: How can i18n be done in stateless (request state)
   cases?

   2009/8/5 marius d. marius.dan...@gmail.com

I thought validations is a function not a val:

override val validations should probably be

override def validations ?

or

override lazy val validations ?

Br's,
Marius

On Aug 5, 7:48 am, Heiko Seeberger heiko.seeber...@googlemail.com
wrote:
 I would like to internationalize my code. Something like:
 Mapper class:

 class Course
   extends LongKeyedMapper[Course]
   with IdPK {

   ...

     override val validations =
       valMinLen(3, ?(minLen, 3)) _ ::
       valMaxLen(50, ?(maxLen, 50)) _ ::
       Nil
   }

 Localized messages:

 minLen=At least %s characters required!
 maxLen=At most %s characters allowed!

 Thanx
 Heiko

 2009/8/4 marius d. marius.dan...@gmail.com

  S lifetime is per request. S is not constructed on Boot. Could you
  post a code snippet on what you're trying to achieve?

  Br's,
  Marius

  On Aug 4, 12:43 pm, Heiko Seeberger 
  heiko.seeber...@googlemail.com
  wrote:
   Hi,

   When I try to use internationalization via S.? in a Mapper class,
  I
get
  the
   below exception while booting Lift. It seems that S._resBundle is
null
  when
   Schemifier tries to do its work.

   Is this a bug or a feature (S must not be used outside the
  request
life
   cycle). If last, how to i18n then?

   Thanx
   Heiko

   0 [main] ERROR lift - Failed to Boot
   java.lang.ExceptionInInitializerError
   at bootstrap.liftweb.Boot.boot(Boot.scala:38)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at

  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at

  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at

  net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply(ClassHelpers.scala:408)
   at

  net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply(ClassHelpers.scala:406)
   at

  net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply(LiftRules.scala:1096)
   at

  net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply(LiftRules.scala:1096)
   at net.liftweb.util.Full.map(Box.scala:330)
   at net.liftweb.http.DefaultBootstrap$.boot(LiftRules.scala:1096)
   at net.liftweb.http.LiftFilter.bootLift(LiftServlet.scala:560)
   at net.liftweb.http.LiftFilter.init(LiftServlet.scala:534)
   at
org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
   at

  

[Lift] Re: Alternate part of view

2009-08-05 Thread marius d.

Please see chooseTemplate from Helpers._ (It's actually defined in
BindHelpers)

For examples see:

\sites\example\src\main\webapp\guess.html
\sites\example\src\main\scala\net\liftweb\example\snippet
\CountGame.scala

.. see if that helps you case.

Br's,
Marius

On Aug 6, 6:44 am, Naftoli Gugenheim naftoli...@gmail.com wrote:
 What's the smartest / most concise way to achieve the following in the 
 corresponding view xhtml and snippet code:
 Parts of the view have to change, depending on whether something is set. For 
 example, in the area where you select the client, if the client is None, then 
 it displays an interface to select a client. If it's set to a Some then it 
 displays the client's details with a button to unset it. This pattern is 
 repeated.
 My current strategy is to have two elements, req:noClient and req:client, 
 which have different xhtml contents. Then in the snippet I bind them to two 
 NodeSeq functions, one that binds useful contents when the client is None and 
 returns NodeSeq.Empty otherwise; and another function that binds when it's a 
 Some and returns Empty otherwise. However, it seems to be somewhat redundant 
 in theory.
 So does anyone have a better way of switching view parts?
 Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Alternate part of view

2009-08-05 Thread Naftoli Gugenheim

It doesn't, because it has to replace its contents bound, and the other view 
part has to be replaced with nothing, so it's less concise than FuncBindParams.

-
marius d.marius.dan...@gmail.com wrote:


Please see chooseTemplate from Helpers._ (It's actually defined in
BindHelpers)

For examples see:

\sites\example\src\main\webapp\guess.html
\sites\example\src\main\scala\net\liftweb\example\snippet
\CountGame.scala

.. see if that helps you case.

Br's,
Marius

On Aug 6, 6:44 am, Naftoli Gugenheim naftoli...@gmail.com wrote:
 What's the smartest / most concise way to achieve the following in the 
 corresponding view xhtml and snippet code:
 Parts of the view have to change, depending on whether something is set. For 
 example, in the area where you select the client, if the client is None, then 
 it displays an interface to select a client. If it's set to a Some then it 
 displays the client's details with a button to unset it. This pattern is 
 repeated.
 My current strategy is to have two elements, req:noClient and req:client, 
 which have different xhtml contents. Then in the snippet I bind them to two 
 NodeSeq functions, one that binds useful contents when the client is None and 
 returns NodeSeq.Empty otherwise; and another function that binds when it's a 
 Some and returns Empty otherwise. However, it seems to be somewhat redundant 
 in theory.
 So does anyone have a better way of switching view parts?
 Thanks.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---