[Lift] Re: Parcing Json

2010-01-10 Thread Joni Freeman
Hi,

I'm sorry but I'm not totally sure what you are trying to accomplish.
What would be the key in that map and what would be its values?

Cheers Joni

On 11 tammi, 03:14, Randinn  wrote:
> I should explain what we are planning, the idea is to get the json
> file into a string, parse it and save the caught information into a
> Observation map.
>
> On Jan 11, 11:23 am, Randinn  wrote:
>
> > Forgive my ignorance but I was wondering why (json \
> > "observations").extract[Observation], is it to save as a flat file?
>
> > On Jan 4, 7:13 am, Randinn  wrote:
>
> > > I tried some of the changes you made but not all of them, and (json\
> > > "observations").extract[Observation], I had no idea about that one.
> > > Thank you very much for your help, it is appreciated.
>
> > > On Jan 4, 1:00 am, Joni Freeman  wrote:
>
> > > > Google Groups does not shine in formatting code snippets. Here's nicer
> > > > version:
>
> > > >http://paste.pocoo.org/show/161578/
>
> > > > Cheers Joni
>
> > > > On 3 tammi, 12:20, Joni Freeman  wrote:
>
> > > > > Hi,
>
> > > > > That's almost correct. I did following changes after looking intoJSON
> > > > > content.
>
> > > > > 1. 'notice' and 'header' areJSONarrays just like 'data'. Therefore:
> > > > > case class Observation(notice: List[Notice], header: List[Header],
> > > > > data: List[Data])
>
> > > > > 2. There's optional data inJSON(some datapoints are nulls and Scala
> > > > > Int or Double can't take null values). This can be fixed by extracting
> > > > > into Option.
>
> > > > > 3. The extracted Observation is inJSONfield 'observations'.
> > > > > Therefore:
> > > > > (json\ "observations").extract[Observation]
>
> > > > > Your error stack trace suggests that you have an old version of lift-
> > > > >json. Please upgrade to M8, there was a critical bug in case class
> > > > > extraction in older versions.
>
> > > > > Full example which works for me:
>
> > > > >   implicit val formats = net.liftweb.json.DefaultFormats
> > > > >   case class Notice(copyright: String, copyright_url: String,
> > > > > disclaimer_url: String)
> > > > >   case class Header(refresh_message: String, ID: String, main_ID:
> > > > > String, name: String, state_time_zone: String, time_zone: String,
> > > > > product_name: String, state: String)
> > > > >   case class Data(sort_order: Int, wmo: Int, history_product: String,
> > > > > local_date_time: String,
> > > > >                   local_date_time_full: String, air_temp: Option
> > > > > [Double], dewpt: Option[Double], apparent_t: Option[Double],
> > > > >                   rel_hum: Option[Int], delta_t: Option[Double],
> > > > > wind_dir: String, wind_spd_kt: Option[Double], gust_kt: Option
> > > > > [Double],
> > > > >                   wind_spd_kmh: Option[Double], press: Option[Double],
> > > > > rain_trace: String)
>
> > > > >   case class Observation(notice: List[Notice], header: List[Header],
> > > > > data: List[Data])
>
> > > > >   (json\ "observations").extract[Observation]
>
> > > > > Cheers Joni
>
> > > > > On 3 tammi, 09:17, Randinn  wrote:
>
> > > > > > I'm having a bit of trouble with LiftJsonparcing, I know I'm not
> > > > > > doing it correctly but looking at the examples I cannot figure out
> > > > > > what, anyway, here is the code in question. If someone could 
> > > > > > point
> > > > > > me in the right direction that would be great, thanks in advance.
>
> > > > > > class HelloWorld {
> > > > > >   def howdy = Welcome to hello-lift at {new
> > > > > > _root_.java.util.Date}
> > > > > > val http = new Http
> > > > > > val bos = new ByteArrayOutputStream
> > > > > > val myRequest = new Request("http://www.bom.gov.au/fwo/IDV60901/
> > > > > > IDV60901.94868.json")
> > > > > > val rawdata = http(myRequest >>> bos)
> > > > > > val bs = bos.toString
> > > > > > val db = :/("www.bom.gov.au")
>
> > > > > > valjson= parse(bs)
>
> > > > > > implicit val formats = net.liftweb.json.DefaultFormats
> > > > > >   case class Notice(copyright: String, copyright_url: String,
> > > > > > disclaimer_url: String)
> > > > > >   case class Header(refresh_message: String, ID: String, main_ID:
> > > > > > String, name: String, state_time_zone: String,
> > > > > >                     time_zone: String, product_name: String, state:
> > > > > > String)
> > > > > >   case class Data(sort_order: Int, wmo: Int, history_product: 
> > > > > > String,
> > > > > > local_date_time: String,
> > > > > >                   local_date_time_full: Int, air_temp: Double, 
> > > > > > dewpt:
> > > > > > Double, apparent_t: Double,
> > > > > >                   rel_hum: Double, delta_t: Double, wind_dir: 
> > > > > > Double,
> > > > > > wind_spd_kt: Double, gust_kt: Double,
> > > > > >                   wind_spd_kmh: Double, press: Double, rain_trace:
> > > > > > Double)
> > > > > >   case class Observation(notice: Notice, header: Header, data: List
> > > > > > [Data])
> > > > > >json.extract[Observation]
-- 
You received this message because you are subscribed to the Goo

[Lift] LiftRules organization

2010-01-10 Thread Naftoli Gugenheim
A while ago I started working on having separate parsers and formatters in 
LiftRules for date, date-time, and time values. These could then be used by 
Mapped(Date)(Time).
I would like to continue working on it, and I would appreciate feedback on the 
following point.
Marius pointed out that it may be a smarter idea, that instead of putting all 
six variables in LiftRules itself, I should group them together somehow. Here 
are some possibilities of how to do so. I would appreciate if everyone could 
vote on one of these ideas or suggest another way.
1. Where?
  - Put them outside of LiftRules, in a new object called something like 
FormattingRules
  - Create an object inside LiftRules, so you would end up writing 
'LiftRules.formatRules.formatDateTime ...'
  - Stick it in TimeHelpers (XXXHelpers are usually not configuration but 
predefined routines)
  - Just put it in LiftRules (so what if it just keeps growing)
2. What to call the container
 - It includes both parsing and formatting, so neither is an accurate name at 
first glance, but then again parsing is not formatting a a verb but it deals 
with a particular format
  - Currently it only deals with java.util.Date, so one could suggest 
DateRules, but other similar configuration could go here -- formatting numbers? 
Any other possible future additions?
  - 'Text' after java.text?
  - Any good ideas?
Thanks!
-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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: Parcing Json

2010-01-10 Thread Randinn
I should explain what we are planning, the idea is to get the json
file into a string, parse it and save the caught information into a
Observation map.

On Jan 11, 11:23 am, Randinn  wrote:
> Forgive my ignorance but I was wondering why (json \
> "observations").extract[Observation], is it to save as a flat file?
>
> On Jan 4, 7:13 am, Randinn  wrote:
>
> > I tried some of the changes you made but not all of them, and (json\
> > "observations").extract[Observation], I had no idea about that one.
> > Thank you very much for your help, it is appreciated.
>
> > On Jan 4, 1:00 am, Joni Freeman  wrote:
>
> > > Google Groups does not shine in formatting code snippets. Here's nicer
> > > version:
>
> > >http://paste.pocoo.org/show/161578/
>
> > > Cheers Joni
>
> > > On 3 tammi, 12:20, Joni Freeman  wrote:
>
> > > > Hi,
>
> > > > That's almost correct. I did following changes after looking intoJSON
> > > > content.
>
> > > > 1. 'notice' and 'header' areJSONarrays just like 'data'. Therefore:
> > > > case class Observation(notice: List[Notice], header: List[Header],
> > > > data: List[Data])
>
> > > > 2. There's optional data inJSON(some datapoints are nulls and Scala
> > > > Int or Double can't take null values). This can be fixed by extracting
> > > > into Option.
>
> > > > 3. The extracted Observation is inJSONfield 'observations'.
> > > > Therefore:
> > > > (json\ "observations").extract[Observation]
>
> > > > Your error stack trace suggests that you have an old version of lift-
> > > >json. Please upgrade to M8, there was a critical bug in case class
> > > > extraction in older versions.
>
> > > > Full example which works for me:
>
> > > >   implicit val formats = net.liftweb.json.DefaultFormats
> > > >   case class Notice(copyright: String, copyright_url: String,
> > > > disclaimer_url: String)
> > > >   case class Header(refresh_message: String, ID: String, main_ID:
> > > > String, name: String, state_time_zone: String, time_zone: String,
> > > > product_name: String, state: String)
> > > >   case class Data(sort_order: Int, wmo: Int, history_product: String,
> > > > local_date_time: String,
> > > >                   local_date_time_full: String, air_temp: Option
> > > > [Double], dewpt: Option[Double], apparent_t: Option[Double],
> > > >                   rel_hum: Option[Int], delta_t: Option[Double],
> > > > wind_dir: String, wind_spd_kt: Option[Double], gust_kt: Option
> > > > [Double],
> > > >                   wind_spd_kmh: Option[Double], press: Option[Double],
> > > > rain_trace: String)
>
> > > >   case class Observation(notice: List[Notice], header: List[Header],
> > > > data: List[Data])
>
> > > >   (json\ "observations").extract[Observation]
>
> > > > Cheers Joni
>
> > > > On 3 tammi, 09:17, Randinn  wrote:
>
> > > > > I'm having a bit of trouble with LiftJsonparcing, I know I'm not
> > > > > doing it correctly but looking at the examples I cannot figure out
> > > > > what, anyway, here is the code in question. If someone could point
> > > > > me in the right direction that would be great, thanks in advance.
>
> > > > > class HelloWorld {
> > > > >   def howdy = Welcome to hello-lift at {new
> > > > > _root_.java.util.Date}
> > > > > val http = new Http
> > > > > val bos = new ByteArrayOutputStream
> > > > > val myRequest = new Request("http://www.bom.gov.au/fwo/IDV60901/
> > > > > IDV60901.94868.json")
> > > > > val rawdata = http(myRequest >>> bos)
> > > > > val bs = bos.toString
> > > > > val db = :/("www.bom.gov.au")
>
> > > > > valjson= parse(bs)
>
> > > > > implicit val formats = net.liftweb.json.DefaultFormats
> > > > >   case class Notice(copyright: String, copyright_url: String,
> > > > > disclaimer_url: String)
> > > > >   case class Header(refresh_message: String, ID: String, main_ID:
> > > > > String, name: String, state_time_zone: String,
> > > > >                     time_zone: String, product_name: String, state:
> > > > > String)
> > > > >   case class Data(sort_order: Int, wmo: Int, history_product: String,
> > > > > local_date_time: String,
> > > > >                   local_date_time_full: Int, air_temp: Double, dewpt:
> > > > > Double, apparent_t: Double,
> > > > >                   rel_hum: Double, delta_t: Double, wind_dir: Double,
> > > > > wind_spd_kt: Double, gust_kt: Double,
> > > > >                   wind_spd_kmh: Double, press: Double, rain_trace:
> > > > > Double)
> > > > >   case class Observation(notice: Notice, header: Header, data: List
> > > > > [Data])
> > > > >json.extract[Observation]
>
>
-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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: Parcing Json

2010-01-10 Thread Randinn
Forgive my ignorance but I was wondering why (json \
"observations").extract[Observation], is it to save as a flat file?

On Jan 4, 7:13 am, Randinn  wrote:
> I tried some of the changes you made but not all of them, and (json\
> "observations").extract[Observation], I had no idea about that one.
> Thank you very much for your help, it is appreciated.
>
> On Jan 4, 1:00 am, Joni Freeman  wrote:
>
> > Google Groups does not shine in formatting code snippets. Here's nicer
> > version:
>
> >http://paste.pocoo.org/show/161578/
>
> > Cheers Joni
>
> > On 3 tammi, 12:20, Joni Freeman  wrote:
>
> > > Hi,
>
> > > That's almost correct. I did following changes after looking intoJSON
> > > content.
>
> > > 1. 'notice' and 'header' areJSONarrays just like 'data'. Therefore:
> > > case class Observation(notice: List[Notice], header: List[Header],
> > > data: List[Data])
>
> > > 2. There's optional data inJSON(some datapoints are nulls and Scala
> > > Int or Double can't take null values). This can be fixed by extracting
> > > into Option.
>
> > > 3. The extracted Observation is inJSONfield 'observations'.
> > > Therefore:
> > > (json\ "observations").extract[Observation]
>
> > > Your error stack trace suggests that you have an old version of lift-
> > >json. Please upgrade to M8, there was a critical bug in case class
> > > extraction in older versions.
>
> > > Full example which works for me:
>
> > >   implicit val formats = net.liftweb.json.DefaultFormats
> > >   case class Notice(copyright: String, copyright_url: String,
> > > disclaimer_url: String)
> > >   case class Header(refresh_message: String, ID: String, main_ID:
> > > String, name: String, state_time_zone: String, time_zone: String,
> > > product_name: String, state: String)
> > >   case class Data(sort_order: Int, wmo: Int, history_product: String,
> > > local_date_time: String,
> > >                   local_date_time_full: String, air_temp: Option
> > > [Double], dewpt: Option[Double], apparent_t: Option[Double],
> > >                   rel_hum: Option[Int], delta_t: Option[Double],
> > > wind_dir: String, wind_spd_kt: Option[Double], gust_kt: Option
> > > [Double],
> > >                   wind_spd_kmh: Option[Double], press: Option[Double],
> > > rain_trace: String)
>
> > >   case class Observation(notice: List[Notice], header: List[Header],
> > > data: List[Data])
>
> > >   (json\ "observations").extract[Observation]
>
> > > Cheers Joni
>
> > > On 3 tammi, 09:17, Randinn  wrote:
>
> > > > I'm having a bit of trouble with LiftJsonparcing, I know I'm not
> > > > doing it correctly but looking at the examples I cannot figure out
> > > > what, anyway, here is the code in question. If someone could point
> > > > me in the right direction that would be great, thanks in advance.
>
> > > > class HelloWorld {
> > > >   def howdy = Welcome to hello-lift at {new
> > > > _root_.java.util.Date}
> > > > val http = new Http
> > > > val bos = new ByteArrayOutputStream
> > > > val myRequest = new Request("http://www.bom.gov.au/fwo/IDV60901/
> > > > IDV60901.94868.json")
> > > > val rawdata = http(myRequest >>> bos)
> > > > val bs = bos.toString
> > > > val db = :/("www.bom.gov.au")
>
> > > > valjson= parse(bs)
>
> > > > implicit val formats = net.liftweb.json.DefaultFormats
> > > >   case class Notice(copyright: String, copyright_url: String,
> > > > disclaimer_url: String)
> > > >   case class Header(refresh_message: String, ID: String, main_ID:
> > > > String, name: String, state_time_zone: String,
> > > >                     time_zone: String, product_name: String, state:
> > > > String)
> > > >   case class Data(sort_order: Int, wmo: Int, history_product: String,
> > > > local_date_time: String,
> > > >                   local_date_time_full: Int, air_temp: Double, dewpt:
> > > > Double, apparent_t: Double,
> > > >                   rel_hum: Double, delta_t: Double, wind_dir: Double,
> > > > wind_spd_kt: Double, gust_kt: Double,
> > > >                   wind_spd_kmh: Double, press: Double, rain_trace:
> > > > Double)
> > > >   case class Observation(notice: Notice, header: Header, data: List
> > > > [Data])
> > > >json.extract[Observation]
>
>
-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: what provides classpath/jquery.js?

2010-01-10 Thread Alex Boisvert
Understood.  I was referring to reusable snippets (e.g., flot widgets).

For your own apps, I can't think of a good reason right now.

Alex

On Jan 10, 2010 4:18 PM, "Alex Black"  wrote:

hmm.  We just upload a single WAR file to our server, its got
everything in it including JS etc.

On Jan 10, 5:16 pm, Alex Boisvert  wrote: > One
reason is to bundle html/j...

> On Jan 10, 2010 3:34 PM, "Alex Black"  wrote: > > Hi
Marius, I haven't heard of...
> liftweb+unsubscr...@googlegroups.com

>
> .
> For more options, visit this group athttp://
groups.google.com/group/liftweb?hl=en.

--
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to lift...@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.
-- 

You received this message because you are subscribed to the Google Groups "Lift" group.

To post to this group, send email to lift...@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: what provides classpath/jquery.js?

2010-01-10 Thread Alex Black
hmm.  We just upload a single WAR file to our server, its got
everything in it including JS etc.

On Jan 10, 5:16 pm, Alex Boisvert  wrote:
> One reason is to bundle html/js/... along with their corresponding snippet
> in a jar file.
>
> Alex
>
> On Jan 10, 2010 3:34 PM, "Alex Black"  wrote:
>
> Hi Marius, I haven't heard of ResourceServer before, sounds
> interesting.
>
> Right now, our CSS and JS files are just in subfolders of webapp, e.g
> "src/main/webapp/js", what are the advantages of (or reasons behind)
> putting js files in resources?
>
> - Alex
>
> On Jan 9, 3:04 am, Marius  wrote: > It is given by
> LiftRules.resourceServe...
>
> --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@googlegroups.com.
> To unsubscribe from this group, send email to
> liftweb+unsubscr...@googlegroups.com
> .
> For more options, visit this group 
> athttp://groups.google.com/group/liftweb?hl=en.
-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: what provides classpath/jquery.js?

2010-01-10 Thread Alex Boisvert
One reason is to bundle html/js/... along with their corresponding snippet
in a jar file.

Alex

On Jan 10, 2010 3:34 PM, "Alex Black"  wrote:

Hi Marius, I haven't heard of ResourceServer before, sounds
interesting.

Right now, our CSS and JS files are just in subfolders of webapp, e.g
"src/main/webapp/js", what are the advantages of (or reasons behind)
putting js files in resources?

- Alex

On Jan 9, 3:04 am, Marius  wrote: > It is given by
LiftRules.resourceServe...

--
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to lift...@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.
-- 

You received this message because you are subscribed to the Google Groups "Lift" group.

To post to this group, send email to lift...@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: what provides classpath/jquery.js?

2010-01-10 Thread Alex Black
Hi Marius, I haven't heard of ResourceServer before, sounds
interesting.

Right now, our CSS and JS files are just in subfolders of webapp, e.g
"src/main/webapp/js", what are the advantages of (or reasons behind)
putting js files in resources?

- Alex

On Jan 9, 3:04 am, Marius  wrote:
> It is given by LiftRules.resourceServerPath. Resources places in /src/
> resources/toserve fodler are not served by container, but they are
> served by Lift. There is a ResourceServer class that manages that. if
> you put your own resources here you need to call ResourceServer.allow
> (in your boot) and grant access to those resources. This is a security
> related mechanism.
>
> Br's,
> Marius
>
> On Jan 9, 3:38 am, harmanjd  wrote:
>
> > I am working through the StartingWithLift document and saw that the
> > page includes /classpath/jquery.js.
>
> > Is that something that jetty supplies, or is that supplied by the lift
> > framework?  I didn't see that path mapped in the Boot class or
> > anything.
>
> > Thanks,
>
> > James
-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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 generation plugin for SBT

2010-01-10 Thread Timothy Perrett
Oh, my repo is here:

http://is.gd/619LT

Cheers, Tim

On Jan 10, 6:22 pm, Timothy Perrett  wrote:
> Hi all,
>
> I've started a little project to add code-generation to SBT and I
> would like to hear from anyone who wants to collaborate (and has time
> to).
>
> This could be very important for the lift community, and my aim is to
> make something like thus:
>
> > generate lift snippet WhateverName
>
> where generate is the sbt plugin command, lift is the "library"
> defined in the plugin/project def, snippet is the "action/template"
> and WhateverName is the args* that the action or template takes.
>
> Im thinking of producing template "libraries" as JARs and then they
> could just be distributed via the maven repository system.
>
> So, if you want to help out on this, id love to hear from you. If
> would be an extra bonus if you are an SBT master or have written other
> plugins as that is where my knowledge is weakest.
>
> Cheers, Tim
-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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] Code generation plugin for SBT

2010-01-10 Thread Timothy Perrett
Hi all,

I've started a little project to add code-generation to SBT and I
would like to hear from anyone who wants to collaborate (and has time
to).

This could be very important for the lift community, and my aim is to
make something like thus:

> generate lift snippet WhateverName

where generate is the sbt plugin command, lift is the "library"
defined in the plugin/project def, snippet is the "action/template"
and WhateverName is the args* that the action or template takes.

Im thinking of producing template "libraries" as JARs and then they
could just be distributed via the maven repository system.

So, if you want to help out on this, id love to hear from you. If
would be an extra bonus if you are an SBT master or have written other
plugins as that is where my knowledge is weakest.

Cheers, Tim
-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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: Ajax button + submitting a form

2010-01-10 Thread Marius

Sorry I think the syntax would be (I haven't tested it though):

 > JqAttr("value", "add"))
& SHtml.submitAjaxForm(form_ID)).toJsCmd}>add
 > JqAttr("value",
"edit")) & SHtml.submitAjaxForm(form_ID)).toJsCmd}>edit
 > JqAttr("value",
"delete")) & SHtml.submitAjaxForm(form_ID)).toJsCmd}>delete

Br's,
Marius

On Jan 10, 6:58 pm, Marius  wrote:
> On Jan 10, 5:20 pm, Adam Warski  wrote:
>
> > Hello,
>
> > > ajaxButton("Press me would ya'?", SHtml.submitAjaxForm
> > > (form_ID).toJsCmd, (some) => {
>
> > > do your stuff here
>
> > > })
>
> > Looking at the source code I think this might work, but I'm having trouble 
> > constructing the correct expression to pass to ajaxButton. The method 
> > signature requires a Call instance, and SHtml.submitAjaxForm results in a 
> > command (JsCmd). Is it possible to somehow combine the two?
>
> I was referring to this signature:
>
> def ajaxButton(text: NodeSeq, jsExp: JsExp, func: String => JsCmd,
> attrs: (String, String)*): Elem
>
> and not
>
> def ajaxButton(text: NodeSeq, jsFunc: Call, func: () => JsCmd, attrs:
> (String, String)*): Elem
>
> jsExp will be called before sending the actual ajax. But this may be a
> bit problematic if your jsExp sends the ajaxForm the ajax request is
> processed asynchronously at js level meaning the the button ajax
> request may be send before the actual ajax form processing is done.
> I'm not sure if this fits your needs
>
>
>
> > Or maybe there is some other, lift-idomatic way to solve my problem?
> > I want to create a form with a list of elements, with three ajax buttons: 
> > add, remove and save (adding/removing a row and persisting the list)
>
> The first solution I described involving hidden fields will definitely
> work. I don't think you need to do 2 ajax calls (one for the form and
> one for the button) but piggy back the button information into a
> hidden field and only submit the form:
>
> Perhaps something like:
>
> > JqAttr("value", "add")) +
> + SHtml.submitAjaxForm(form_ID).toJsCmd}>blah
>
>
>
> > By the way, I think there's a small inconsistency; there are 7 overloaded 
> > variants for ajaxButton:
>
> > ajaxButton(text: NodeSeq, func: () => JsCmd, attrs: (String, String)*): Elem
> > ajaxButton(text: String, func: () => JsCmd, attrs: (String, String)*): Elem
>
> > ajaxButton(text: NodeSeq, jsFunc: Call, func: () => JsCmd, attrs: (String, 
> > String)*): Elem
> > ajaxButton(text: String, jsFunc: Call, func: () => JsCmd, attrs: (String, 
> > String)*): Elem
>
> > ajaxButton(text: NodeSeq, jsExp: JsExp, func: String => JsCmd, attrs: 
> > (String, String)*): Elem
>
> > and the last one doesn't have a text: String counterpart. Also the javadoc 
> > for the last variant is missing information on what's "jsExp" and what's 
> > the argument passed to "func". My guess would be that jsExp is evaluated 
> > and the result passed to func on the server?
>
> Yes jsExp is being evaluated and its result is being sent to server.
> Please open a defect for this inconsistency.
>
>
>
> > --
> > Adam
-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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 and Akka Actors in comparison?

2010-01-10 Thread greekscala
Hello,

I read only little about AKKA, but I read that the Lift Actors are now
decopled and you can use AKKA
Actors or Scala Actors as implementation.

with best regards

On 9 Jan., 08:48, Franz Bettag  wrote:
> Hey guys,
>
> i was wondering if i can implement a real distributed application with
> lift and akka.
> Since akka actors can be forwarded (so that the actor can reply to the
> original sending actor),
> i thought it would be awesome if my akka-remoteActor could directly
> reply to a lift actor to interact
> with the user.
>
> On the google groups of akka i found out that this only works with
> akka-actors. Since my scala skill isn't that good and i don't
> understand the differences both, i hope that somebody here has done
> the comparison and can answer this question :)
>
> best regards
-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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: Ajax button + submitting a form

2010-01-10 Thread Marius


On Jan 10, 5:20 pm, Adam Warski  wrote:
> Hello,
>
> > ajaxButton("Press me would ya'?", SHtml.submitAjaxForm
> > (form_ID).toJsCmd, (some) => {
>
> > do your stuff here
>
> > })
>
> Looking at the source code I think this might work, but I'm having trouble 
> constructing the correct expression to pass to ajaxButton. The method 
> signature requires a Call instance, and SHtml.submitAjaxForm results in a 
> command (JsCmd). Is it possible to somehow combine the two?

I was referring to this signature:

def ajaxButton(text: NodeSeq, jsExp: JsExp, func: String => JsCmd,
attrs: (String, String)*): Elem

and not

def ajaxButton(text: NodeSeq, jsFunc: Call, func: () => JsCmd, attrs:
(String, String)*): Elem


jsExp will be called before sending the actual ajax. But this may be a
bit problematic if your jsExp sends the ajaxForm the ajax request is
processed asynchronously at js level meaning the the button ajax
request may be send before the actual ajax form processing is done.
I'm not sure if this fits your needs

>
> Or maybe there is some other, lift-idomatic way to solve my problem?
> I want to create a form with a list of elements, with three ajax buttons: 
> add, remove and save (adding/removing a row and persisting the list)

The first solution I described involving hidden fields will definitely
work. I don't think you need to do 2 ajax calls (one for the form and
one for the button) but piggy back the button information into a
hidden field and only submit the form:

Perhaps something like:

> JqAttr("value", "add")) +
+ SHtml.submitAjaxForm(form_ID).toJsCmd}>blah


>
> By the way, I think there's a small inconsistency; there are 7 overloaded 
> variants for ajaxButton:
>
> ajaxButton(text: NodeSeq, func: () => JsCmd, attrs: (String, String)*): Elem
> ajaxButton(text: String, func: () => JsCmd, attrs: (String, String)*): Elem
>
> ajaxButton(text: NodeSeq, jsFunc: Call, func: () => JsCmd, attrs: (String, 
> String)*): Elem
> ajaxButton(text: String, jsFunc: Call, func: () => JsCmd, attrs: (String, 
> String)*): Elem
>
> ajaxButton(text: NodeSeq, jsExp: JsExp, func: String => JsCmd, attrs: 
> (String, String)*): Elem
>
> and the last one doesn't have a text: String counterpart. Also the javadoc 
> for the last variant is missing information on what's "jsExp" and what's the 
> argument passed to "func". My guess would be that jsExp is evaluated and the 
> result passed to func on the server?

Yes jsExp is being evaluated and its result is being sent to server.
Please open a defect for this inconsistency.

>
> --
> Adam
-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: Ajax button + submitting a form

2010-01-10 Thread Adam Warski
Hello,

> ajaxButton("Press me would ya'?", SHtml.submitAjaxForm
> (form_ID).toJsCmd, (some) => {
> 
> do your stuff here
> 
> })

Looking at the source code I think this might work, but I'm having trouble 
constructing the correct expression to pass to ajaxButton. The method signature 
requires a Call instance, and SHtml.submitAjaxForm results in a command 
(JsCmd). Is it possible to somehow combine the two?

Or maybe there is some other, lift-idomatic way to solve my problem?
I want to create a form with a list of elements, with three ajax buttons: add, 
remove and save (adding/removing a row and persisting the list).

By the way, I think there's a small inconsistency; there are 7 overloaded 
variants for ajaxButton:

ajaxButton(text: NodeSeq, func: () => JsCmd, attrs: (String, String)*): Elem
ajaxButton(text: String, func: () => JsCmd, attrs: (String, String)*): Elem

ajaxButton(text: NodeSeq, jsFunc: Call, func: () => JsCmd, attrs: (String, 
String)*): Elem
ajaxButton(text: String, jsFunc: Call, func: () => JsCmd, attrs: (String, 
String)*): Elem

ajaxButton(text: NodeSeq, jsExp: JsExp, func: String => JsCmd, attrs: (String, 
String)*): Elem

and the last one doesn't have a text: String counterpart. Also the javadoc for 
the last variant is missing information on what's "jsExp" and what's the 
argument passed to "func". My guess would be that jsExp is evaluated and the 
result passed to func on the server?

-- 
Adam

-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: Lift Modules 1.1-M8 broken "mvn site"

2010-01-10 Thread Indrajit Raychaudhuri

Hmm, scala:doc doesn't like this.

Please do a mvn clean before doing the site generation.
"mvn clean site" should work.

Cheers, Indrajit

On 10/01/10 8:11 PM, JAZ wrote:

On Sat, Jan 9, 2010 at 8:55 PM, David Pollak
  wrote:


There is a known issue with the openjdk and the YUI compressor library.  If
it's possible for you to try the Sun JDK, I think things should work.


There is no problem in Mac OS-X 10.6.2, but it is in Ubuntu (I only
changed JAVA_HOME and PATH pointing to the latest Sun JDK)

$ java -version
java version "1.6.0_17"
Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01, mixed mode)


$ mvn -v
Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200)
Java version: 1.6.0_17
Java home: /opt/jdk1.6.0_17/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "2.6.28-11-server" arch: "amd64" Family: "unix"

$ uname -a
Linux Ubuntu-904-jaunty-64-minimal 2.6.28-11-server #42-Ubuntu SMP Fri
Apr 17 02:45:36 UTC 2009 x86_64 GNU/Linux


$ mvn site -e
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO]   Lift Web Framework
[INFO]   Lift Base Components
[INFO]   Lift Common
[INFO]   Lift Actor
[INFO]   Lift Json
[INFO]   Lift Util
[INFO]   Lift WebKit
[INFO]   Lift Persistence Components
[INFO]   Lift Mapper
[INFO]   Lift JPA
[INFO]   Lift Record
[INFO]   Lift Addon Modules
[INFO]   Lift TestKit
[INFO]   Lift OSGi
[INFO]   Lift Wizard
[INFO]   Lift Widgets
[INFO]   Lift Machine
[INFO]   Lift Textile
[INFO]   Lift Facebook
[INFO]   Lift AMQP
[INFO]   Lift XMPP
[INFO]   Lift OpenID
[INFO]   Lift OAuth
[INFO]   Lift PayPal
[INFO]   Lift JTA
[INFO]   Lift Core (full lift)
[INFO] 
[INFO] Building Lift Web Framework
[INFO]task-segment: [site]
[INFO] 
[INFO] Setting property: classpath.resource.loader.class =>
'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[INFO] Setting property: velocimacro.messages.on =>  'false'.
[INFO] Setting property: resource.loader =>  'classpath'.
[INFO] Setting property: resource.manager.logwhenfound =>  'false'.
[INFO] **
[INFO] Starting Jakarta Velocity v1.4
[INFO] RuntimeInstance initializing.
[INFO] Default Properties File:
org/apache/velocity/runtime/defaults/velocity.properties
[INFO] Default ResourceManager initializing. (class
org.apache.velocity.runtime.resource.ResourceManagerImpl)
[INFO] Resource Loader Instantiated:
org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader
[INFO] ClasspathResourceLoader : initialization starting.
[INFO] ClasspathResourceLoader : initialization complete.
[INFO] ResourceCache : initialized. (class
org.apache.velocity.runtime.resource.ResourceCacheImpl)
[INFO] Default ResourceManager initialization complete.
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Literal
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Macro
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Parse
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Include
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
[INFO] Created: 20 parsers.
[INFO] Velocimacro : initialization starting.
[INFO] Velocimacro : adding VMs from VM library template : VM_global_library.vm
[ERROR] ResourceManager : unable to find resource
'VM_global_library.vm' in any resource loader.
[INFO] Velocimacro : error using  VM library template
VM_global_library.vm :
org.apache.velocity.exception.ResourceNotFoundException: Unable to
find resource 'VM_global_library.vm'
[INFO] Velocimacro :  VM library template macro registration complete.
[INFO] Velocimacro : allowInline = true : VMs can be defined inline in templates
[INFO] Velocimacro : allowInlineToOverride = false : VMs defined
inline may NOT replace previous VM definitions
[INFO] Velocimacro : allowInlineLocal = false : VMs defined inline
will be  global in scope if allowed.
[INFO] Velocimacro : initialization complete.
[INFO] Velocity successfully started.
[INFO] Preparing javadoc:javadoc
[INFO] [enforcer:enforce {execution: default}]
[INFO] Preparing javadoc:test-javadoc
[INFO] [enforcer:enforce {execution: default}]
[INFO] [resources:copy-resources {execution: default-copy-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] [scala:compile {execution: default}]
[INFO] Checking for multiple versions of scala
[INFO] includes = [**/*.scala,**/*.java,]
[INFO] excludes = []
[WARNING] No source files found.
[INFO] Preparing surefire-report:report-only
[INFO] [enforcer:enforce {execution: default}]
[INFO] [site:site {execution: default-site}]
[INFO] Generating "Changes Report" report.
[WARNING] [XHTML Sink] Modified invalid anchor name: 'Changes in L

Re: [Lift] Re: Lift Modules 1.1-M8 broken "mvn site"

2010-01-10 Thread JAZ
On Sat, Jan 9, 2010 at 8:55 PM, David Pollak
 wrote:

> There is a known issue with the openjdk and the YUI compressor library.  If
> it's possible for you to try the Sun JDK, I think things should work.

There is no problem in Mac OS-X 10.6.2, but it is in Ubuntu (I only
changed JAVA_HOME and PATH pointing to the latest Sun JDK)

$ java -version
java version "1.6.0_17"
Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01, mixed mode)


$ mvn -v
Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200)
Java version: 1.6.0_17
Java home: /opt/jdk1.6.0_17/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "2.6.28-11-server" arch: "amd64" Family: "unix"

$ uname -a
Linux Ubuntu-904-jaunty-64-minimal 2.6.28-11-server #42-Ubuntu SMP Fri
Apr 17 02:45:36 UTC 2009 x86_64 GNU/Linux


$ mvn site -e
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO]   Lift Web Framework
[INFO]   Lift Base Components
[INFO]   Lift Common
[INFO]   Lift Actor
[INFO]   Lift Json
[INFO]   Lift Util
[INFO]   Lift WebKit
[INFO]   Lift Persistence Components
[INFO]   Lift Mapper
[INFO]   Lift JPA
[INFO]   Lift Record
[INFO]   Lift Addon Modules
[INFO]   Lift TestKit
[INFO]   Lift OSGi
[INFO]   Lift Wizard
[INFO]   Lift Widgets
[INFO]   Lift Machine
[INFO]   Lift Textile
[INFO]   Lift Facebook
[INFO]   Lift AMQP
[INFO]   Lift XMPP
[INFO]   Lift OpenID
[INFO]   Lift OAuth
[INFO]   Lift PayPal
[INFO]   Lift JTA
[INFO]   Lift Core (full lift)
[INFO] 
[INFO] Building Lift Web Framework
[INFO]task-segment: [site]
[INFO] 
[INFO] Setting property: classpath.resource.loader.class =>
'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[INFO] Setting property: velocimacro.messages.on => 'false'.
[INFO] Setting property: resource.loader => 'classpath'.
[INFO] Setting property: resource.manager.logwhenfound => 'false'.
[INFO] **
[INFO] Starting Jakarta Velocity v1.4
[INFO] RuntimeInstance initializing.
[INFO] Default Properties File:
org/apache/velocity/runtime/defaults/velocity.properties
[INFO] Default ResourceManager initializing. (class
org.apache.velocity.runtime.resource.ResourceManagerImpl)
[INFO] Resource Loader Instantiated:
org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader
[INFO] ClasspathResourceLoader : initialization starting.
[INFO] ClasspathResourceLoader : initialization complete.
[INFO] ResourceCache : initialized. (class
org.apache.velocity.runtime.resource.ResourceCacheImpl)
[INFO] Default ResourceManager initialization complete.
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Literal
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Macro
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Parse
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Include
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
[INFO] Created: 20 parsers.
[INFO] Velocimacro : initialization starting.
[INFO] Velocimacro : adding VMs from VM library template : VM_global_library.vm
[ERROR] ResourceManager : unable to find resource
'VM_global_library.vm' in any resource loader.
[INFO] Velocimacro : error using  VM library template
VM_global_library.vm :
org.apache.velocity.exception.ResourceNotFoundException: Unable to
find resource 'VM_global_library.vm'
[INFO] Velocimacro :  VM library template macro registration complete.
[INFO] Velocimacro : allowInline = true : VMs can be defined inline in templates
[INFO] Velocimacro : allowInlineToOverride = false : VMs defined
inline may NOT replace previous VM definitions
[INFO] Velocimacro : allowInlineLocal = false : VMs defined inline
will be  global in scope if allowed.
[INFO] Velocimacro : initialization complete.
[INFO] Velocity successfully started.
[INFO] Preparing javadoc:javadoc
[INFO] [enforcer:enforce {execution: default}]
[INFO] Preparing javadoc:test-javadoc
[INFO] [enforcer:enforce {execution: default}]
[INFO] [resources:copy-resources {execution: default-copy-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] [scala:compile {execution: default}]
[INFO] Checking for multiple versions of scala
[INFO] includes = [**/*.scala,**/*.java,]
[INFO] excludes = []
[WARNING] No source files found.
[INFO] Preparing surefire-report:report-only
[INFO] [enforcer:enforce {execution: default}]
[INFO] [site:site {execution: default-site}]
[INFO] Generating "Changes Report" report.
[WARNING] [XHTML Sink] Modified invalid anchor name: 'Changes in Lift
Web Framework' to 'Changes_in_Lift_Web_Framework'
[WARNING] [XHTML Sink] Modified invalid anchor name: 'Release History'
to 'Release_History'
[INFO] Generating "Dependency 

Re: [Lift] Lift WebKit 1.1-M8 - broken mvn site

2010-01-10 Thread David Bernard
The version of yuicompressor-maven-plugin used is not compatible with
openjdk. (see mailing list archive).

On Sat, Jan 9, 2010 at 21:06, Jaroslaw Zabiello  wrote:
> $ uname -a
> Linux Ubuntu-904-jaunty-64-minimal 2.6.28-11-server #42-Ubuntu SMP Fri
> Apr 17 02:45:36 UTC 2009 x86_64 GNU/Linux
>
> $ mvn -v
> Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200)
> Java version: 1.6.0_0
> Java home: /usr/lib/jvm/java-6-openjdk/jre
> Default locale: en_US, platform encoding: UTF-8
> OS name: "linux" version: "2.6.28-11-server" arch: "amd64" Family:
> "unix"
>
> /home/httpd/liftweb.org/app/ror/public/1.1-M8/lift-base/lift-webkit$
> mvn site
> [INFO] Scanning for projects...
> [INFO]
> 
> [INFO] Building Lift WebKit
> [INFO]    task-segment: [site]
> [INFO]
> 
> [INFO] [resources:copy-resources {execution: default-copy-resources}]
> [INFO] Using 'UTF-8' encoding to copy filtered resources.
> [INFO] Copying 1 resource
> [INFO] Setting property: classpath.resource.loader.class =>
> 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
> [INFO] Setting property: velocimacro.messages.on => 'false'.
> [INFO] Setting property: resource.loader => 'classpath'.
> [INFO] Setting property: resource.manager.logwhenfound => 'false'.
> [INFO] **
> [INFO] Starting Jakarta Velocity v1.4
> [INFO] RuntimeInstance initializing.
> [INFO] Default Properties File: org/apache/velocity/runtime/defaults/
> velocity.properties
> [INFO] Default ResourceManager initializing. (class
> org.apache.velocity.runtime.resource.ResourceManagerImpl)
> [INFO] Resource Loader Instantiated:
> org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader
> [INFO] ClasspathResourceLoader : initialization starting.
> [INFO] ClasspathResourceLoader : initialization complete.
> [INFO] ResourceCache : initialized. (class
> org.apache.velocity.runtime.resource.ResourceCacheImpl)
> [INFO] Default ResourceManager initialization complete.
> [INFO] Loaded System Directive:
> org.apache.velocity.runtime.directive.Literal
> [INFO] Loaded System Directive:
> org.apache.velocity.runtime.directive.Macro
> [INFO] Loaded System Directive:
> org.apache.velocity.runtime.directive.Parse
> [INFO] Loaded System Directive:
> org.apache.velocity.runtime.directive.Include
> [INFO] Loaded System Directive:
> org.apache.velocity.runtime.directive.Foreach
> [INFO] Created: 20 parsers.
> [INFO] Velocimacro : initialization starting.
> [INFO] Velocimacro : adding VMs from VM library template :
> VM_global_library.vm
> [ERROR] ResourceManager : unable to find resource
> 'VM_global_library.vm' in any resource loader.
> [INFO] Velocimacro : error using  VM library template
> VM_global_library.vm :
> org.apache.velocity.exception.ResourceNotFoundException: Unable to
> find resource 'VM_global_library.vm'
> [INFO] Velocimacro :  VM library template macro registration complete.
> [INFO] Velocimacro : allowInline = true : VMs can be defined inline in
> templates
> [INFO] Velocimacro : allowInlineToOverride = false : VMs defined
> inline may NOT replace previous VM definitions
> [INFO] Velocimacro : allowInlineLocal = false : VMs defined inline
> will be  global in scope if allowed.
> [INFO] Velocimacro : initialization complete.
> [INFO] Velocity successfully started.
> [INFO] Preparing javadoc:javadoc
> [INFO] [enforcer:enforce {execution: default-enforce}]
> [INFO] Preparing javadoc:test-javadoc
> [INFO] [enforcer:enforce {execution: default-enforce}]
> [INFO] [resources:resources {execution: default-resources}]
> [INFO] Using 'UTF-8' encoding to copy filtered resources.
> [INFO] Copying 33 resources
> [INFO] [scala:compile {execution: scala-compile}]
> [INFO] Checking for multiple versions of scala
> [INFO] includes = [**/*.scala,**/*.java,]
> [INFO] excludes = []
> [INFO] Compiling 0 source files to /home/httpd/liftweb.org/app/ror/
> public/1.1-M8/lift-base/lift-webkit/target/classes
> [INFO] Nothing to compile - all classes are up to date
> [INFO] [yuicompressor:compress {execution: default}]
> [INFO]
> 
> [ERROR] FATAL ERROR
> [INFO]
> 
> [INFO] null
> [INFO]
> 
> [INFO] Trace
> java.lang.RuntimeException
>        at
> com.yahoo.platform.yui.compressor.JavaScriptCompressor.printSourceNumber
> (JavaScriptCompressor.java:299)
>        at com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse
> (JavaScriptCompressor.java:335)
>        at com.yahoo.platform.yui.compressor.JavaScriptCompressor.
> (JavaScriptCompressor.java:532)
>        at net.sf.alchim.mojo.yuicompressor.YuiCompressorMojo.processFile
> (YuiCompressorMojo.java:178)
>        at net.sf.alchim.

[Lift] Re: JNDI error when switching to M8 ?

2010-01-10 Thread Neil.Lv

  Here is the test code .

  g...@github.com:anim510/two_db_demo.git

  It works fine when using only one database, it failed when using two
db connection.

  Thanks.!

Cheers,
  Neil

On Jan 10, 5:04 pm, "Neil.Lv"  wrote:
> Hi all,
>
>    There is a problem that i switch the M7 to M8, the JNDI is error.
>
>    I didn't change anything before moving M7 to M8.
>
>    It seems that the Lift looks for the lift ConnectionIdentifier not
> the OneDB or TwoDB.
>
> ###
> java.lang.NullPointerException: Looking for Connection Identifier
> ConnectionIden
> tifier(lift) but failed to find either a JNDI data source with the
> name lift or
> a lift connection manager with the correct name
> ###
>
>   I have two DB connection, in the Boot.scala
> ###
> object OneDB extends ConnectionIdentifier {
>  def jndiName = "one"}
>
> object TwoDB extends ConnectionIdentifier {
>  def jndiName = "two"}
>
> ---
> class Boot {
>   def boot {
>     if (!DB.jndiJdbcConnAvailable_?) {
>        DB.defineConnectionManager(OneDB, DBVendor)
>        DB.defineConnectionManager(TwoDB, DBVendor_2)
>     }
>   }}
>
> ###
>
>   This work fine under the M7, but is broken in the M8,
>
>   Does anyone know what's wrong with it ?
>
>   Thanks for any suggestion!
>
> Cheers,
>   Neil
-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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: Ajax button + submitting a form

2010-01-10 Thread Marius
Well you could have a hidden for field containing some information
about the submitter, thus when you click the button you first set the
value of the hidden field and then call submitAjaxForm

Or Try:

ajaxButton("Press me would ya'?", SHtml.submitAjaxForm
(form_ID).toJsCmd, (some) => {

 do your stuff here

})

Br's,
Marius

On Jan 10, 2:02 pm, Adam Warski  wrote:
> right, I wrote about that in my original post, but how can I execute a 
> button-specific method on the server-side?
>
> Thanks,
> Adam
>
> On Jan 10, 2010, at 12:15 PM, Marius wrote:
>
> > The ajax buttons doesn't have to be inside the form if you use
> > SHtml.submitAjaxForm(form_ID)
>
> > blah
>
> > Br's,
> > Marius
>
> > On Jan 10, 1:08 pm, Adam Warski  wrote:
> >> There is also a related problem:
> >> how can I have two ajax buttons on one form which submit the form and 
> >> execute different functions on the server?
>
> >> Using the "standard" trick:
> >> SHtml.ajaxForm(bind(...) ++ SHtml.hidden(submitFunction))
> >> won't work, as I want different functions executed for different buttons.
>
> >> Adam
>
> >> On Jan 10, 2010, at 10:42 AM, Adam Warski wrote:
>
> >>> Hello,
>
> >>> thanks, but my use-case is a bit different.
>
> >>> I want the whole form to be still submitted using a POST (the "normal" 
> >>> way), and only use ajax for a small fragment of the page (the element 
> >>> editor). So I can't use ajaxForm(...), as this would make all submit 
> >>> buttons use ajax.
>
> >>> Adam
>
> >>> On Jan 9, 2010, at 3:55 PM, greekscala wrote:
>
>  Hello,
>
>  I have a similar use case. For an AjaxForm you have to write:
>  SHtml.ajaxForm(
>      bind("mytags", xml,
>       // binding to your tags ...
>
>        "submit" -> SHtml.submit("do it", save),
>      ) ++ SHtml.hidden(save)
>    )
>
>  You dont need to have a form element in your templates for this to
>  work
>  because ajaxForm will wrap the result of the bind method.
>
>  For my listelements checkbox, I attach to the checkbox a function,
>  that adds an Id and the
>  checkbox value to a ListBuffer[(Boolean, String)]. (checked and not
>  checked boxes are submittet)
>
>  Then I filter the List for the selected values a do what I have to do
>  with them.
>  I the above code example, my save method does some db stuff and then
>  returning
>  a JsCmds.SetHtml("an html id", some html/snippet nodeseq) for a
>  redraw.
>
>  Hope this helps a little
>
>  with best regards
>
>  On 9 Jan., 10:48, Adam Warski  wrote:
> > Hello,
>
> > I have a regular form, which is submitted with a POST (no AJAX here 
> > yet). The form contains a list, to which you can add and remove 
> > elements using AJAX. So the add and remove buttons are:
>
> > "add" -> ajaxButton("Add element", () => { elements += new Element; 
> > reDraw })
>
> > The "reDraw" method is a SetHtml for the whole form. Now this almost 
> > works, with the exception that when I press the "add" button all other 
> > changes in the form are discarded, as the form is not submitted. So, 
> > when the button is pressed, I would need to submit the form using ajax 
> > and execute a given function on the server. In the archives I found 
> > SHtml.submitAjaxForm(formId) method, which I guess does what I need, 
> > but I don't know how to combine it with an ajaxButton?
>
> > --
> > Thanks,
> > Adam
>  --
>  You received this message because you are subscribed to the Google 
>  Groups "Lift" group.
>  To post to this group, send email to lift...@googlegroups.com.
>  To unsubscribe from this group, send email to 
>  liftweb+unsubscr...@googlegroups.com.
>  For more options, visit this group 
>  athttp://groups.google.com/group/liftweb?hl=en.
>
> >>> --
> >>> You received this message because you are subscribed to the Google Groups 
> >>> "Lift" group.
> >>> To post to this group, send email to lift...@googlegroups.com.
> >>> To unsubscribe from this group, send email to 
> >>> liftweb+unsubscr...@googlegroups.com.
> >>> For more options, visit this group 
> >>> athttp://groups.google.com/group/liftweb?hl=en.
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Lift" group.
> > To post to this group, send email to lift...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > liftweb+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/liftweb?hl=en.
-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: Ajax button + submitting a form

2010-01-10 Thread Adam Warski
right, I wrote about that in my original post, but how can I execute a 
button-specific method on the server-side?

Thanks,
Adam

On Jan 10, 2010, at 12:15 PM, Marius wrote:

> The ajax buttons doesn't have to be inside the form if you use
> SHtml.submitAjaxForm(form_ID)
> 
> blah
> 
> Br's,
> Marius
> 
> On Jan 10, 1:08 pm, Adam Warski  wrote:
>> There is also a related problem:
>> how can I have two ajax buttons on one form which submit the form and 
>> execute different functions on the server?
>> 
>> Using the "standard" trick:
>> SHtml.ajaxForm(bind(...) ++ SHtml.hidden(submitFunction))
>> won't work, as I want different functions executed for different buttons.
>> 
>> Adam
>> 
>> On Jan 10, 2010, at 10:42 AM, Adam Warski wrote:
>> 
>>> Hello,
>> 
>>> thanks, but my use-case is a bit different.
>> 
>>> I want the whole form to be still submitted using a POST (the "normal" 
>>> way), and only use ajax for a small fragment of the page (the element 
>>> editor). So I can't use ajaxForm(...), as this would make all submit 
>>> buttons use ajax.
>> 
>>> Adam
>> 
>>> On Jan 9, 2010, at 3:55 PM, greekscala wrote:
>> 
 Hello,
>> 
 I have a similar use case. For an AjaxForm you have to write:
 SHtml.ajaxForm(
 bind("mytags", xml,
  // binding to your tags ...
>> 
   "submit" -> SHtml.submit("do it", save),
 ) ++ SHtml.hidden(save)
   )
>> 
 You dont need to have a form element in your templates for this to
 work
 because ajaxForm will wrap the result of the bind method.
>> 
 For my listelements checkbox, I attach to the checkbox a function,
 that adds an Id and the
 checkbox value to a ListBuffer[(Boolean, String)]. (checked and not
 checked boxes are submittet)
>> 
 Then I filter the List for the selected values a do what I have to do
 with them.
 I the above code example, my save method does some db stuff and then
 returning
 a JsCmds.SetHtml("an html id", some html/snippet nodeseq) for a
 redraw.
>> 
 Hope this helps a little
>> 
 with best regards
>> 
 On 9 Jan., 10:48, Adam Warski  wrote:
> Hello,
>> 
> I have a regular form, which is submitted with a POST (no AJAX here yet). 
> The form contains a list, to which you can add and remove elements using 
> AJAX. So the add and remove buttons are:
>> 
> "add" -> ajaxButton("Add element", () => { elements += new Element; 
> reDraw })
>> 
> The "reDraw" method is a SetHtml for the whole form. Now this almost 
> works, with the exception that when I press the "add" button all other 
> changes in the form are discarded, as the form is not submitted. So, when 
> the button is pressed, I would need to submit the form using ajax and 
> execute a given function on the server. In the archives I found 
> SHtml.submitAjaxForm(formId) method, which I guess does what I need, but 
> I don't know how to combine it with an ajaxButton?
>> 
> --
> Thanks,
> Adam
 --
 You received this message because you are subscribed to the Google Groups 
 "Lift" group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group 
 athttp://groups.google.com/group/liftweb?hl=en.
>> 
>>> --
>>> You received this message because you are subscribed to the Google Groups 
>>> "Lift" group.
>>> To post to this group, send email to lift...@googlegroups.com.
>>> To unsubscribe from this group, send email to 
>>> liftweb+unsubscr...@googlegroups.com.
>>> For more options, visit this group 
>>> athttp://groups.google.com/group/liftweb?hl=en.
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Lift" group.
> To post to this group, send email to lift...@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.
> 
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Mapper: Hook into owner lifecycle from field

2010-01-10 Thread Jeppe Nejsum Madsen
Naftoli Gugenheim  writes:

> How would this be implemented in terms of database table structure?

Something like this:

CREATE TABLE person (name VARCHAR(20) , id BIGINT NOT NULL
AUTO_INCREMENT) 

CREATE TABLE address (id BIGINT NOT NULL AUTO_INCREMENT , street
VARCHAR(20) , valid_to DATE , valid_from DATE , person BIGINT) 

/Jeppe
-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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: Ajax button + submitting a form

2010-01-10 Thread Marius
The ajax buttons doesn't have to be inside the form if you use
SHtml.submitAjaxForm(form_ID)

blah

Br's,
Marius

On Jan 10, 1:08 pm, Adam Warski  wrote:
> There is also a related problem:
> how can I have two ajax buttons on one form which submit the form and execute 
> different functions on the server?
>
> Using the "standard" trick:
> SHtml.ajaxForm(bind(...) ++ SHtml.hidden(submitFunction))
> won't work, as I want different functions executed for different buttons.
>
> Adam
>
> On Jan 10, 2010, at 10:42 AM, Adam Warski wrote:
>
> > Hello,
>
> > thanks, but my use-case is a bit different.
>
> > I want the whole form to be still submitted using a POST (the "normal" 
> > way), and only use ajax for a small fragment of the page (the element 
> > editor). So I can't use ajaxForm(...), as this would make all submit 
> > buttons use ajax.
>
> > Adam
>
> > On Jan 9, 2010, at 3:55 PM, greekscala wrote:
>
> >> Hello,
>
> >> I have a similar use case. For an AjaxForm you have to write:
> >> SHtml.ajaxForm(
> >>     bind("mytags", xml,
> >>      // binding to your tags ...
>
> >>       "submit" -> SHtml.submit("do it", save),
> >>     ) ++ SHtml.hidden(save)
> >>   )
>
> >> You dont need to have a form element in your templates for this to
> >> work
> >> because ajaxForm will wrap the result of the bind method.
>
> >> For my listelements checkbox, I attach to the checkbox a function,
> >> that adds an Id and the
> >> checkbox value to a ListBuffer[(Boolean, String)]. (checked and not
> >> checked boxes are submittet)
>
> >> Then I filter the List for the selected values a do what I have to do
> >> with them.
> >> I the above code example, my save method does some db stuff and then
> >> returning
> >> a JsCmds.SetHtml("an html id", some html/snippet nodeseq) for a
> >> redraw.
>
> >> Hope this helps a little
>
> >> with best regards
>
> >> On 9 Jan., 10:48, Adam Warski  wrote:
> >>> Hello,
>
> >>> I have a regular form, which is submitted with a POST (no AJAX here yet). 
> >>> The form contains a list, to which you can add and remove elements using 
> >>> AJAX. So the add and remove buttons are:
>
> >>> "add" -> ajaxButton("Add element", () => { elements += new Element; 
> >>> reDraw })
>
> >>> The "reDraw" method is a SetHtml for the whole form. Now this almost 
> >>> works, with the exception that when I press the "add" button all other 
> >>> changes in the form are discarded, as the form is not submitted. So, when 
> >>> the button is pressed, I would need to submit the form using ajax and 
> >>> execute a given function on the server. In the archives I found 
> >>> SHtml.submitAjaxForm(formId) method, which I guess does what I need, but 
> >>> I don't know how to combine it with an ajaxButton?
>
> >>> --
> >>> Thanks,
> >>> Adam
> >> --
> >> You received this message because you are subscribed to the Google Groups 
> >> "Lift" group.
> >> To post to this group, send email to lift...@googlegroups.com.
> >> To unsubscribe from this group, send email to 
> >> liftweb+unsubscr...@googlegroups.com.
> >> For more options, visit this group 
> >> athttp://groups.google.com/group/liftweb?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Lift" group.
> > To post to this group, send email to lift...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > liftweb+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/liftweb?hl=en.
-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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: Can lift strip all the leading and trailing blank characters?

2010-01-10 Thread Marius
No problem Tim, thanks for reminding me. Either way I think having the
issue there (defect OR feature doesn't really matter) is good for
tracking purposes that people would like to see this in. If this will
be fixed or rejected is a different story IMO.

Br's,
Marius

On Jan 10, 11:46 am, Timothy Perrett  wrote:
> Marius,
>
> I dont mean to butt in, but this has been discussed on the list before and 
> DPP rejected it as a requirement because of the performance impact it would 
> have on lifts rendering pipeline?
>
> Either way, I would say this is a feature request, not a defect ;-)
>
> Cheers, Tim
>
> On 10 Jan 2010, at 09:36, daiwhea wrote:
>
> > Here it is.http://github.com/dpp/liftweb/issues/#issue/278
>
> > Thanks *_*
>
> > On Jan 10, 4:43 pm, Marius  wrote:
> >> Could you please open a defect here?http://github.com/dpp/liftweb/issues
>
> >> Br's,
> >> Marius
>
> >> On Jan 10, 5:15 am, daiwhea  wrote:
>
> >>> I saw the html source generated by the lift both in dev and production
> >>> mode, there are many leading and trailing blank characters and new
> >>> lines. Is it possible to make lift strip all these blank characters?
>
> >>> Thanks. ->_<-
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Lift" group.
> > To post to this group, send email to lift...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > liftweb+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/liftweb?hl=en.
-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: Ajax button + submitting a form

2010-01-10 Thread Adam Warski
There is also a related problem:
how can I have two ajax buttons on one form which submit the form and execute 
different functions on the server?

Using the "standard" trick:
SHtml.ajaxForm(bind(...) ++ SHtml.hidden(submitFunction)) 
won't work, as I want different functions executed for different buttons.

Adam

On Jan 10, 2010, at 10:42 AM, Adam Warski wrote:

> Hello,
> 
> thanks, but my use-case is a bit different.
> 
> I want the whole form to be still submitted using a POST (the "normal" way), 
> and only use ajax for a small fragment of the page (the element editor). So I 
> can't use ajaxForm(...), as this would make all submit buttons use ajax.
> 
> Adam
> 
> On Jan 9, 2010, at 3:55 PM, greekscala wrote:
> 
>> Hello,
>> 
>> I have a similar use case. For an AjaxForm you have to write:
>> SHtml.ajaxForm(
>> bind("mytags", xml,
>>  // binding to your tags ...
>> 
>>   "submit" -> SHtml.submit("do it", save),
>> ) ++ SHtml.hidden(save)
>>   )
>> 
>> You dont need to have a form element in your templates for this to
>> work
>> because ajaxForm will wrap the result of the bind method.
>> 
>> For my listelements checkbox, I attach to the checkbox a function,
>> that adds an Id and the
>> checkbox value to a ListBuffer[(Boolean, String)]. (checked and not
>> checked boxes are submittet)
>> 
>> Then I filter the List for the selected values a do what I have to do
>> with them.
>> I the above code example, my save method does some db stuff and then
>> returning
>> a JsCmds.SetHtml("an html id", some html/snippet nodeseq) for a
>> redraw.
>> 
>> Hope this helps a little
>> 
>> with best regards
>> 
>> On 9 Jan., 10:48, Adam Warski  wrote:
>>> Hello,
>>> 
>>> I have a regular form, which is submitted with a POST (no AJAX here yet). 
>>> The form contains a list, to which you can add and remove elements using 
>>> AJAX. So the add and remove buttons are:
>>> 
>>> "add" -> ajaxButton("Add element", () => { elements += new Element; reDraw 
>>> })
>>> 
>>> The "reDraw" method is a SetHtml for the whole form. Now this almost works, 
>>> with the exception that when I press the "add" button all other changes in 
>>> the form are discarded, as the form is not submitted. So, when the button 
>>> is pressed, I would need to submit the form using ajax and execute a given 
>>> function on the server. In the archives I found 
>>> SHtml.submitAjaxForm(formId) method, which I guess does what I need, but I 
>>> don't know how to combine it with an ajaxButton?
>>> 
>>> --
>>> Thanks,
>>> Adam
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Lift" group.
>> To post to this group, send email to lift...@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.
>> 
>> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Lift" group.
> To post to this group, send email to lift...@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.
> 
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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: Is this correct way to handle RESTful like URL in Lift Framework?

2010-01-10 Thread Marius
You can use LiftRules.statelessRewrite which is processed very early
before the SiteMap comes into the picture. Hence you can rewrite at
this level. LiftRules.statefulRewrite is processed a little later on
(but you have full S context) but still before SiteMap is processed.

If this doesn't fit your needs, using your approach is not bad either.
Not sure where the boilerplate is as RESTfulLoc  looks like a generic
one.

Br's,
Marius

On Jan 10, 11:39 am, Brian Hsu  wrote:
> Thanks for your reply,
>
> But I would like them combine with Menu tightly, so I could setup them
> only in my Model, just like CRUDify trait.
>
> In the end, I created a Loc subclass myself, and use it to handle all
> the rewrite stuff, it seems works pretty
> well and make thing much simpler (at least for me), so I post the code
> here.
>
> Feel free to use it if anybody need this.
>
> /**
>  *  A RESTful-like URL handling Loc
>  *
>  *  If you have the following templates:
>  *
>  *    * webapps/item/edit.html
>  *    * webapps/item/view.html
>  *
>  *  You want the following URL map to corresponding template with
>  *  last path component as a S parameter.
>  *
>  *    http://localhost/item/edit/1 to  http://localhost/item/edit
>  *    http://localhost/item/view/1 to  http://localhost/item/view
>  *
>  *  You could create a Menu with this Loc class in your Model object.
>  *
>  *  
>  *  object Item extends Item with LongKeyedMetaMapper[Item]
>  *  {
>  *      // Other methods here...
>  *
>  *      def menu () {
>  *
>  *          // What methods do we have?
>  *          val methods = List ("view", "edit")
>  *
>  *          val parameterName = "itemID"
>  *          val itemLoc = new RESTfulLoc("Item", List("item"),
> "Item",
>  *                                       methods, parameterName)
>  *
>  *          Menu (itemLoc)
>  *      }
>  *  }
>  *  
>  *
>  *  Now add the menu to SiteMap in Boot.boot
>  *
>  *  
>  *  class Boot {
>  *      def boot () {
>  *
>  *          val entries = Item.menu ::  Nil
>  *
>  *          LiftRules.setSiteMap(SiteMap(entries:_*))
>  *      }
>  *  }
>  *  
>  *
>  *
>  *  Finally, You could access the parameter in your snippet with
>  *  S.param("itemID")
>  *
>  */
> class RESTfulLoc (val name: String, val path: List[String],
>                   val text: LinkText[Unit], val methods: List[String],
>                   val parameterName: String,
>                   val locParams: LocParam[Unit]*) extends Loc[Unit]
> {
>     override val defaultValue = Full(())
>     override val params = locParams.toList
>     override val link: Link[Unit] = (List(path.first), true)
>
>     def this (name: String, path: List[String], text: LinkText[Unit],
>               methods: List[String], locParams: LocParam[Unit]*) =
>     {
>         this (name, path, text, methods, "id", locParams:_*)
>     }
>
>     private def isTarget (path: ParsePath) =
>     {
>         path.partPath -- this.path match {
>             case List (action, id) => {
>                 (methods contains action) && id != "index"
>             }
>             case _ => false
>         }
>     }
>
>     override def rewrite = Full (NamedPF("RESTfulLoc")
>     {
>         case RewriteRequest (path, _, _) if isTarget(path) => {
>              val parameter = path.partPath.last
>              val action    = path.partPath.init
>              val data      = Map (parameterName -> parameter)
>
>              RewriteResponse(action, data) -> ()
>         }
>     })
>
> }
>
> On 1月10日, 下午4時55分, Marius  wrote:
>
> > Or you could use something like if you'r building REST API's:
>
> > LiftRules.dispatch.append {
>
> >    case Req("test" :: _, suffix, reqType) => // return a () =>
> > LiftResponse
>
> > }
>
> > or for non REST API you could use
>
> > LiftRules.statefulRewrite.append {
>
> > case RewriteRequest(ParsePath("test" :: _, _, _, _), reqType, request)
> > => ...
>
> > }
>
> > Br's,
> > Marius
>
> > On Jan 10, 7:32 am, Brian Hsu  wrote:
-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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: Is this correct way to handle RESTful like URL in Lift Framework?

2010-01-10 Thread Brian Hsu
Thanks for your reply,

But I would like them combine with Menu tightly, so I could setup them
only in my Model, just like CRUDify trait.

In the end, I created a Loc subclass myself, and use it to handle all
the rewrite stuff, it seems works pretty
well and make thing much simpler (at least for me), so I post the code
here.

Feel free to use it if anybody need this.

/**
 *  A RESTful-like URL handling Loc
 *
 *  If you have the following templates:
 *
 ** webapps/item/edit.html
 ** webapps/item/view.html
 *
 *  You want the following URL map to corresponding template with
 *  last path component as a S parameter.
 *
 *http://localhost/item/edit/1  to  http://localhost/item/edit
 *http://localhost/item/view/1  to  http://localhost/item/view
 *
 *  You could create a Menu with this Loc class in your Model object.
 *
 *  
 *  object Item extends Item with LongKeyedMetaMapper[Item]
 *  {
 *  // Other methods here...
 *
 *  def menu () {
 *
 *  // What methods do we have?
 *  val methods = List ("view", "edit")
 *
 *  val parameterName = "itemID"
 *  val itemLoc = new RESTfulLoc("Item", List("item"),
"Item",
 *   methods, parameterName)
 *
 *  Menu (itemLoc)
 *  }
 *  }
 *  
 *
 *  Now add the menu to SiteMap in Boot.boot
 *
 *  
 *  class Boot {
 *  def boot () {
 *
 *  val entries = Item.menu ::  Nil
 *
 *  LiftRules.setSiteMap(SiteMap(entries:_*))
 *  }
 *  }
 *  
 *
 *
 *  Finally, You could access the parameter in your snippet with
 *  S.param("itemID")
 *
 */
class RESTfulLoc (val name: String, val path: List[String],
  val text: LinkText[Unit], val methods: List[String],
  val parameterName: String,
  val locParams: LocParam[Unit]*) extends Loc[Unit]
{
override val defaultValue = Full(())
override val params = locParams.toList
override val link: Link[Unit] = (List(path.first), true)

def this (name: String, path: List[String], text: LinkText[Unit],
  methods: List[String], locParams: LocParam[Unit]*) =
{
this (name, path, text, methods, "id", locParams:_*)
}

private def isTarget (path: ParsePath) =
{
path.partPath -- this.path match {
case List (action, id) => {
(methods contains action) && id != "index"
}
case _ => false
}
}

override def rewrite = Full (NamedPF("RESTfulLoc")
{
case RewriteRequest (path, _, _) if isTarget(path) => {
 val parameter = path.partPath.last
 val action= path.partPath.init
 val data  = Map (parameterName -> parameter)

 RewriteResponse(action, data) -> ()
}
})
}







On 1月10日, 下午4時55分, Marius  wrote:
> Or you could use something like if you'r building REST API's:
>
> LiftRules.dispatch.append {
>
>    case Req("test" :: _, suffix, reqType) => // return a () =>
> LiftResponse
>
> }
>
> or for non REST API you could use
>
> LiftRules.statefulRewrite.append {
>
> case RewriteRequest(ParsePath("test" :: _, _, _, _), reqType, request)
> => ...
>
> }
>
> Br's,
> Marius
>
> On Jan 10, 7:32 am, Brian Hsu  wrote:
>
-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: Can lift strip all the leading and trailing blank characters?

2010-01-10 Thread Timothy Perrett
Marius,

I dont mean to butt in, but this has been discussed on the list before and DPP 
rejected it as a requirement because of the performance impact it would have on 
lifts rendering pipeline? 

Either way, I would say this is a feature request, not a defect ;-)

Cheers, Tim

On 10 Jan 2010, at 09:36, daiwhea wrote:

> Here it is. http://github.com/dpp/liftweb/issues/#issue/278
> 
> Thanks *_*
> 
> On Jan 10, 4:43 pm, Marius  wrote:
>> Could you please open a defect here?http://github.com/dpp/liftweb/issues
>> 
>> Br's,
>> Marius
>> 
>> On Jan 10, 5:15 am, daiwhea  wrote:
>> 
>>> I saw the html source generated by the lift both in dev and production
>>> mode, there are many leading and trailing blank characters and new
>>> lines. Is it possible to make lift strip all these blank characters?
>> 
>>> Thanks. ->_<-
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Lift" group.
> To post to this group, send email to lift...@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.
> 
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: Ajax button + submitting a form

2010-01-10 Thread Adam Warski
Hello,

thanks, but my use-case is a bit different.

I want the whole form to be still submitted using a POST (the "normal" way), 
and only use ajax for a small fragment of the page (the element editor). So I 
can't use ajaxForm(...), as this would make all submit buttons use ajax.

Adam

On Jan 9, 2010, at 3:55 PM, greekscala wrote:

> Hello,
> 
> I have a similar use case. For an AjaxForm you have to write:
>  SHtml.ajaxForm(
>  bind("mytags", xml,
>   // binding to your tags ...
> 
>"submit" -> SHtml.submit("do it", save),
>  ) ++ SHtml.hidden(save)
>)
> 
> You dont need to have a form element in your templates for this to
> work
> because ajaxForm will wrap the result of the bind method.
> 
> For my listelements checkbox, I attach to the checkbox a function,
> that adds an Id and the
> checkbox value to a ListBuffer[(Boolean, String)]. (checked and not
> checked boxes are submittet)
> 
> Then I filter the List for the selected values a do what I have to do
> with them.
> I the above code example, my save method does some db stuff and then
> returning
> a JsCmds.SetHtml("an html id", some html/snippet nodeseq) for a
> redraw.
> 
> Hope this helps a little
> 
> with best regards
> 
> On 9 Jan., 10:48, Adam Warski  wrote:
>> Hello,
>> 
>> I have a regular form, which is submitted with a POST (no AJAX here yet). 
>> The form contains a list, to which you can add and remove elements using 
>> AJAX. So the add and remove buttons are:
>> 
>> "add" -> ajaxButton("Add element", () => { elements += new Element; reDraw })
>> 
>> The "reDraw" method is a SetHtml for the whole form. Now this almost works, 
>> with the exception that when I press the "add" button all other changes in 
>> the form are discarded, as the form is not submitted. So, when the button is 
>> pressed, I would need to submit the form using ajax and execute a given 
>> function on the server. In the archives I found SHtml.submitAjaxForm(formId) 
>> method, which I guess does what I need, but I don't know how to combine it 
>> with an ajaxButton?
>> 
>> --
>> Thanks,
>> Adam
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Lift" group.
> To post to this group, send email to lift...@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.
> 
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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: Can lift strip all the leading and trailing blank characters?

2010-01-10 Thread daiwhea
Here it is. http://github.com/dpp/liftweb/issues/#issue/278

Thanks *_*

On Jan 10, 4:43 pm, Marius  wrote:
> Could you please open a defect here?http://github.com/dpp/liftweb/issues
>
> Br's,
> Marius
>
> On Jan 10, 5:15 am, daiwhea  wrote:
>
> > I saw the html source generated by the lift both in dev and production
> > mode, there are many leading and trailing blank characters and new
> > lines. Is it possible to make lift strip all these blank characters?
>
> > Thanks. ->_<-
-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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] JNDI error when switching to M8 ?

2010-01-10 Thread Neil.Lv
Hi all,

   There is a problem that i switch the M7 to M8, the JNDI is error.

   I didn't change anything before moving M7 to M8.

   It seems that the Lift looks for the lift ConnectionIdentifier not
the OneDB or TwoDB.

###
java.lang.NullPointerException: Looking for Connection Identifier
ConnectionIden
tifier(lift) but failed to find either a JNDI data source with the
name lift or
a lift connection manager with the correct name
###

  I have two DB connection, in the Boot.scala
###
object OneDB extends ConnectionIdentifier {
 def jndiName = "one"
}
object TwoDB extends ConnectionIdentifier {
 def jndiName = "two"
}
---
class Boot {
  def boot {
if (!DB.jndiJdbcConnAvailable_?) {
   DB.defineConnectionManager(OneDB, DBVendor)
   DB.defineConnectionManager(TwoDB, DBVendor_2)
}
  }
}
###

  This work fine under the M7, but is broken in the M8,

  Does anyone know what's wrong with it ?

  Thanks for any suggestion!

Cheers,
  Neil

-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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: Is this correct way to handle RESTful like URL in Lift Framework?

2010-01-10 Thread Marius
Or you could use something like if you'r building REST API's:

LiftRules.dispatch.append {

   case Req("test" :: _, suffix, reqType) => // return a () =>
LiftResponse

}

or for non REST API you could use

LiftRules.statefulRewrite.append {

case RewriteRequest(ParsePath("test" :: _, _, _, _), reqType, request)
=> ...
}

Br's,
Marius

On Jan 10, 7:32 am, Brian Hsu  wrote:
> If I have a URL likehttp://localhost/Test/edit/{id} and I would like
> the {id} transform to a parameter instead of URL path part.
>
> The problem is that if I have a template named edit.html under webapp/
> Test, which is the template I use to edit an item.
>
> And I have a Menu instance like the following:
>
> 
> Menu (Loc("Test", List("Test") -> true, "Test"))
> 
>
> It would only match URL likehttp://localhost/Test/edit, not anything
> likehttp://localhost/Test/edit/1
>
> Is it best way to do it by create a menu with RewriteRequest? Because
> I found it a little boilerplate if I have lot URL pattern like this.
>
> 
> val menu = Menu(new Loc[Unit] {
>
>     override def name = "Test"
>     override def text = "Test"
>     override def link = (List ("Test"), true)
>     override def params = Nil
>     override def defaultValue = Full(())
>
>     def isTarget (path: ParsePath) = path match {
>         case ParsePath (List("Test", "edit", id), _, _, _) => true
>
>         case _ => false
>     }
>
>     override def rewrite = Full ( NamedPF("Test") {
>         case RewriteRequest (path, _, _) if isTarget(path) =>
>              RewriteResponse(List("Test", "edit"),
>                              Map("id" -> "1024")) -> ()
>
>     })})
>
> 
-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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: Can lift strip all the leading and trailing blank characters?

2010-01-10 Thread Marius
Could you please open a defect here? http://github.com/dpp/liftweb/issues

Br's,
Marius

On Jan 10, 5:15 am, daiwhea  wrote:
> I saw the html source generated by the lift both in dev and production
> mode, there are many leading and trailing blank characters and new
> lines. Is it possible to make lift strip all these blank characters?
>
> Thanks. ->_<-
-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.