[Lift] Lift 2.0M2 LiftMerge order?

2010-03-02 Thread Rick R
I have a pair of templates which rely on both a Snippet and a
CometActor. There appears to be a dependency injection process of
sorts where lift_page is defined and liftAjax.js is included. However,
it looks like the list of things is being included in reverse order.
The results seem to be the same whether I just return a NodeSeq from
CometActor.render or if I return a RenderOut defined with  NodeSeq and
JsCmd.

I'm not doing anything too crazy, I do Rewrite urls for the pages used
by the cometactors, but it's pretty standard.
(On a side note, is there any way to get GET params from a Rewrite to
the render function in a CometActor?, I tried a sessionVar but it
didn't work. What I ended up doing was getting the param in a snippet.
Setting it as a js variable on the page, then having the js use that
value to make a JsonCmd  to the cometActor, it should work provided I
can fix the code represented below)


For example:  (my comments -- inline)

-- This is the start of the template: adminchat.html

  h2Welcome to The Interview Tool./h2
p
  div id=F1040260232478N4M_outer style=display: inlinediv
id=F1040260232478N4M style=display: inlinediv
  pspan id=info/span/p
  p !-- A place to put stuff --

-- the following is the result of including : Script(JsonInCode)  from
render in my CometActor. This makes sense that we need to define the
callback before using it. Note, however, that it's referencing
liftAjax.lift  but we haven't included liftAjax.js yet.

script type=text/javascript
// ![CDATA[
/* JSON Func Other $$ F104026023248133W */function
F104026023248133W(obj)
{liftAjax.lift_ajaxHandler('F104026023248133W='+
encodeURIComponent(JSON.stringify(obj)), null,null);}
// ]]

/script
input type=textarea
onkeypress=processKeyPress(event.which, function(a)
{F104026023248133W({'command': quot;pressedquot;, 'params':a});})
id=txt1 /
  /p
/divscript type=text/javascript
// ![CDATA[

F104026023248133W({'command': connect, 'params':chatKey});

-- okay.. we define this function again, I'm not sure why and I didn't
ask it to, but no real harm done.

/* JSON Func Other $$ F104026023248133W */function
F104026023248133W(obj)
{liftAjax.lift_ajaxHandler('F104026023248133W='+
encodeURIComponent(JSON.stringify(obj)), null,null);}
// ]]
/script/divscript type=text/javascript
// ![CDATA[
var destroy_F1040260232478N4M = function() {}
// ]]
/script/div

-- this is the end of the output from the CometACtor

/p

 -- this is the end of output from the template.

  /div

  hr /
/div

-- this should be the end of output from default.html, but I'm
guessing this is where stuff gets merged in.
-- Here we include liftAjax, it's a bit late, but it's still wrong
because it relies on lift_page.

  script type=text/javascript src=/ajax_request/liftAjax.js/script
script type=text/javascript
src=/comet_request/xkvbzq4ueltw/cometAjax.js/script

-- here's where we finally define the vars needed by liftAjax et al.

script type=text/javascript
// ![CDATA[
var lift_toWatch = {F1040260232478N4M: 1040260232480};
// ]]
/script
script type=text/javascript
// ![CDATA[

var lift_page = F1040260232477ZYH;
// ]]
/script/body
/html

-- 
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] Lift 2.0M2 LiftMerge order?

2010-03-02 Thread Rick R

 On Tue, Mar 2, 2010 at 11:07 AM, Rick R rick.richard...@gmail.com wrote:

 I have a pair of templates which rely on both a Snippet and a
 CometActor. There appears to be a dependency injection

 Dependency injection is an entirely different concept.  Lift rewrites the
 page as it goes out to insure comet and ajax support.


Yes,  that was the reason for the quotes.  I am referring to the
mechanism by which lift determines that a page required ajax, so it
makes sure to include liftAjax.js.


 process of
 sorts where lift_page is defined and liftAjax.js is included. However,
 it looks like the list of things is being included in reverse order.

 What do you mean reverse order?  Are you seeing an actual error?  Is
 something actually failing?

Yes.  As I indicate below (albeit in a messy fashion)  the callbacks
which use liftAjax are defined before liftAjax.js is included.
Further, the variables which are needed by liftAjax.js, such as
lift_page, are defined *after* liftAjax.js is
included.

This is what lead me to believe that these three sections are being
rendered in reverse.
What I would expect to see is lift_page being rendered before the
inclusion of liftAjax.js which occurs before
the definition of the functions which rely on liftAjax.


 (On a side note, is there any way to get GET params from a Rewrite to
 the render function in a CometActor?

 You can't.  CometActors are not rendered in response to an HTTP request and
 have no access to specific request state.

That is fine, should one expect a SessionVar to work for a CometActor
when it is set in response to a RewriteRequest?



 For example:  (my comments -- inline)

 -- This is the start of the template: adminchat.html

  h2Welcome to The Interview Tool./h2
                p
      div id=F1040260232478N4M_outer style=display: inlinediv
 id=F1040260232478N4M style=display: inlinediv
      pspan id=info/span/p
      p !-- A place to put stuff --

 -- the following is the result of including : Script(JsonInCode)  from
 render in my CometActor. This makes sense that we need to define the
 callback before using it. Note, however, that it's referencing
 liftAjax.lift  but we haven't included liftAjax.js yet.

        script type=text/javascript
 // ![CDATA[
 /* JSON Func Other $$ F104026023248133W */function
 F104026023248133W(obj)
 {liftAjax.lift_ajaxHandler('F104026023248133W='+
 encodeURIComponent(JSON.stringify(obj)), null,null);}
 // ]]

 /script
        input type=textarea
 onkeypress=processKeyPress(event.which, function(a)
 {F104026023248133W({'command': quot;pressedquot;, 'params':a});})
 id=txt1 /
      /p
    /divscript type=text/javascript
 // ![CDATA[

 F104026023248133W({'command': connect, 'params':chatKey});

 -- okay.. we define this function again, I'm not sure why and I didn't
 ask it to, but no real harm done.

 /* JSON Func Other $$ F104026023248133W */function
 F104026023248133W(obj)
 {liftAjax.lift_ajaxHandler('F104026023248133W='+
 encodeURIComponent(JSON.stringify(obj)), null,null);}
 // ]]
 /script/divscript type=text/javascript
 // ![CDATA[
 var destroy_F1040260232478N4M = function() {}
 // ]]
 /script/div

 -- this is the end of the output from the CometACtor

    /p

  -- this is the end of output from the template.

      /div

      hr /
    /div

 -- this should be the end of output from default.html, but I'm
 guessing this is where stuff gets merged in.
 -- Here we include liftAjax, it's a bit late, but it's still wrong
 because it relies on lift_page.

  script type=text/javascript src=/ajax_request/liftAjax.js/script
 script type=text/javascript
 src=/comet_request/xkvbzq4ueltw/cometAjax.js/script

 -- here's where we finally define the vars needed by liftAjax et al.

 script type=text/javascript
 // ![CDATA[
 var lift_toWatch = {F1040260232478N4M: 1040260232480};
 // ]]
 /script
 script type=text/javascript
 // ![CDATA[

 var lift_page = F1040260232477ZYH;
 // ]]
 /script/body
 /html

 --
 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, the simply functional web framework http://liftweb.net
 Beginning Scala http://www.apress.com/book/view/1430219890
 Follow me: http://twitter.com/dpp
 Surf the harmonics

 --
 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

Re: [Lift] Lift 2.0M2 LiftMerge order?

2010-03-02 Thread Rick R
 They are not being rendered in reverse.  There is no problem.  The code
 works correctly.
 Why?
 First, the code in the CometActor is a call a function in response to an
 event.  The page will be loaded before you can press the button or otherwise
 cause the event to be dispatched.
 Second, as I said in my first response, the code in liftAjax only gets
 executed after the page is loaded... that means if there's some random event
 that causes the page parsing to be delayed until after the liftAjax.js file
 is loaded and parsed, the calls in liftAjax that reference the variables on
 the page is not going to get executed until after the page is completely
 loaded (which also means the page is parsed and the inline JavaScript code
 is executed.)

Thanks for clarifying.  Upon page load, I am attempting to make a
JsonCall connect to the CometActor. This is how I intend to get the
parameter created by the RewriteRequest function to the CometActor.
So that it can use that param to fetch a previously allocated
resource.

I noticed a failure, which is why I posted to the list. The failure
was that my call to to the comet server occurred before liftAjax.js
was loaded. Thus causing javascript to stop evaluating and my json
call to not occur.

Thanks to your explanation above, I now realize that I should probably
use some mechanism to specify that my jsonCall occurs on the
body.onLoad event, or something like it, rather than being executed
inline.

Could you provide guidance in this area? Because I can't find anything
in the docs that would allow me to specify such a task from scala
source.  I could just hack something $(document).ready, but I was
hoping to go for as much Lift as possible.

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.



Re: [Lift] RPC from Javascript/JQuery?

2010-02-25 Thread Rick R
That's funny, because I'm a Haskell coder. As soon as I hit
Javascript, both sides of my brain turn off. I think it's the curly
braces that do it.

-- 
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] Using existing Javascript

2010-02-25 Thread Rick R
On Thu, Feb 25, 2010 at 12:40 PM, Richard richard.m.willi...@gmail.com wrote:
 I have pages that I've created with standard HTML forms and javascript
 validation. What is the fastest or best way to use them in my Lift
 app? Do I have to completely rewrite in Lift snippets using JsCmds in
 order to tie into the already named fields and form, or is there
 something I'm missing?


You can retrieve values from legacy forms using the S.param function.
In order to ensure that the appropriate session data is transmitted, I
would convert the key bits of your legacy HTML into templates.

IMO, you might be better off just converting the rest of the way to
Lift and use the bind function to tie your form values to lift
variables, you also gain security from replay and xss attacks, because
the field names are randomized.

You can still use your custom validators, you will just have to
specify that the jsCmds call your validators.
(It is easy to call legacy functions by name via lift js, it's just
rather difficult to do the opposite, because the lift generated
function names are random strings)

See http://wiki.liftweb.net/index.php/Hello_Darwin#add_form for a
brief comparison between the two options.

Hope that helps.

-- 
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] RPC from Javascript/JQuery?

2010-02-24 Thread Rick R
I have a textarea in which I process onKeyUp and onKeyDown commands.
The handlers for such things are custom javascript.
I would like to invoke functions in a Comet LiftActor /
ListenerManager via these custom javascript functions. Is there
documentation on the recommended way to do so?

It looks like I will have to define the functions within a render call
and use the SHtml.ajaxCall function, since the destination url is
randomized.  I am just wondering what would be the idiomatic way to do
this.

This is for a chat style app which processes/distributes data by the
keystroke rather than by a  line/post command.


I'm open to any ideas / alternate suggestions.

Thanks,
Rick

-- 
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] RPC from Javascript/JQuery?

2010-02-24 Thread Rick R
That works beautifully, thanks.

With regards to using custom javascript functions,  I have a function
processKeyPress. It's role is to filter key presses, only send events
to the server upon certain key presses.

I guess the easiest way to handle this would be to pass the function created by:
 {jsonCall(pressed, JsRaw(event.which)).toJsCmd}

into processKeyPress so that it can invoke it if the event.which is
the correct type.

Unfortunately, I can't come up with a way to describe this in inline XML.

input type=textarea onkeypress=processKeyPress(event.which,
{jsonCall(pressed, JsRaw(event.which)).toJsCmd})/

leaving out the  causes a parse error.. adding the  cause it to be
evaulated as a string.

Any ideas?



On Wed, Feb 24, 2010 at 2:57 PM, David Pollak
feeder.of.the.be...@gmail.com wrote:
 Rick,

 Here's a simple example:

 import net.liftweb._
 import util._
 import http._
 import js._
 import JsCmds._
 import JE._
 import scala.xml.NodeSeq

 class Evently extends CometActor {

   // handle an incoming JSON event
   override def handleJson(in: Any): JsCmd = in match {
     case JsonCmd(pressed, _, key, _) = SetHtml(info, bYou pressed
 {key}/b)
     case _ = Noop
   }

   def render =
   div
   span id=info/ !-- A place to put stuff --
   {
     Script(jsonInCode) // include the JSON callback
   }
    input type=text onkeypress={jsonCall(pressed,
 JsRaw(event.which)).toJsCmd}/
   /div
 }

 So, the handleJson message gets called on the server whenever a key is
 pressed on the client (this example works in non-IE browsers, but that's
 just 'cause I'm using event.which rather than event.keyCode).

 Hope this helps.

 Thanks,

 David


 On Wed, Feb 24, 2010 at 8:23 AM, Rick R rick.richard...@gmail.com wrote:

 I have a textarea in which I process onKeyUp and onKeyDown commands.
 The handlers for such things are custom javascript.
 I would like to invoke functions in a Comet LiftActor /
 ListenerManager via these custom javascript functions. Is there
 documentation on the recommended way to do so?

 It looks like I will have to define the functions within a render call
 and use the SHtml.ajaxCall function, since the destination url is
 randomized.  I am just wondering what would be the idiomatic way to do
 this.

 This is for a chat style app which processes/distributes data by the
 keystroke rather than by a  line/post command.


 I'm open to any ideas / alternate suggestions.

 Thanks,
 Rick

 --
 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, the simply functional web framework http://liftweb.net
 Beginning Scala http://www.apress.com/book/view/1430219890
 Follow me: http://twitter.com/dpp
 Surf the harmonics

 --
 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] RPC from Javascript/JQuery?

2010-02-24 Thread Rick R
That compiles, which is a great step. However, the resulting javascript is
onkeypress=processKeyPress(event.which, F379516302547JMS({'command':
quot;pressedquot;, 'params':event.which});)

so it's attempting to execute the F37...
also, I don't know if the semicolon is allowed inside the parens.

Is there a way I can pass the function pointer separate from its params?



On Wed, Feb 24, 2010 at 6:41 PM, Ross Mellgren dri...@gmail.com wrote:
 input type=text onkeypress={ processKeyPress(event.which,  + 
 jsonCall(pressed, JsRaw(event.which)).toJsCmd + ) } /

 -Ross

 On Feb 24, 2010, at 6:38 PM, Rick R wrote:

 That works beautifully, thanks.

 With regards to using custom javascript functions,  I have a function
 processKeyPress. It's role is to filter key presses, only send events
 to the server upon certain key presses.

 I guess the easiest way to handle this would be to pass the function created 
 by:
 {jsonCall(pressed, JsRaw(event.which)).toJsCmd}

 into processKeyPress so that it can invoke it if the event.which is
 the correct type.

 Unfortunately, I can't come up with a way to describe this in inline XML.

 input type=textarea onkeypress=processKeyPress(event.which,
 {jsonCall(pressed, JsRaw(event.which)).toJsCmd})/

 leaving out the  causes a parse error.. adding the  cause it to be
 evaulated as a string.

 Any ideas?



 On Wed, Feb 24, 2010 at 2:57 PM, David Pollak
 feeder.of.the.be...@gmail.com wrote:
 Rick,

 Here's a simple example:

 import net.liftweb._
 import util._
 import http._
 import js._
 import JsCmds._
 import JE._
 import scala.xml.NodeSeq

 class Evently extends CometActor {

   // handle an incoming JSON event
   override def handleJson(in: Any): JsCmd = in match {
     case JsonCmd(pressed, _, key, _) = SetHtml(info, bYou pressed
 {key}/b)
     case _ = Noop
   }

   def render =
   div
   span id=info/ !-- A place to put stuff --
   {
     Script(jsonInCode) // include the JSON callback
   }
    input type=text onkeypress={jsonCall(pressed,
 JsRaw(event.which)).toJsCmd}/
   /div
 }

 So, the handleJson message gets called on the server whenever a key is
 pressed on the client (this example works in non-IE browsers, but that's
 just 'cause I'm using event.which rather than event.keyCode).

 Hope this helps.

 Thanks,

 David


 On Wed, Feb 24, 2010 at 8:23 AM, Rick R rick.richard...@gmail.com wrote:

 I have a textarea in which I process onKeyUp and onKeyDown commands.
 The handlers for such things are custom javascript.
 I would like to invoke functions in a Comet LiftActor /
 ListenerManager via these custom javascript functions. Is there
 documentation on the recommended way to do so?

 It looks like I will have to define the functions within a render call
 and use the SHtml.ajaxCall function, since the destination url is
 randomized.  I am just wondering what would be the idiomatic way to do
 this.

 This is for a chat style app which processes/distributes data by the
 keystroke rather than by a  line/post command.


 I'm open to any ideas / alternate suggestions.

 Thanks,
 Rick

 --
 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, the simply functional web framework http://liftweb.net
 Beginning Scala http://www.apress.com/book/view/1430219890
 Follow me: http://twitter.com/dpp
 Surf the harmonics

 --
 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.



-- 
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] Welcome John De Goes as a Lift committer

2010-02-22 Thread Rick R
John De Goes as in the author of Cutting-Edge 3d Game Programming With C++ ?
That book convinced me that I could be a professional computer (and
game) programmer.
I still have that book on my bookshelf  :)


I look forward to seeing what you can do with Lift. I might decide to
become a web programmer ;)




The greatest obstacle to discovering the shape of the earth, the
continents, and the oceans was not ignorance but the illusion of
knowledge.
- Daniel J. Boorstin




On Mon, Feb 22, 2010 at 3:55 PM, David Pollak
feeder.of.the.be...@gmail.com wrote:
 Folks,

 Please join me in welcoming John De Goes as a Lift committer.  John burst
 onto the Lift scene a week or so ago with some excellent enhancements to the
 Lift-json stuff and the rest is history.

 Welcome John... looking forward to excellent contributions from you and your
 latest partner in crime, Kris Nuttycombe, a long-time Lift committer.

 Thanks,

 David

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

 --
 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] What am I doing wrong?

2009-10-06 Thread Rick R
I have added a mapping of game_state to the DispatchSnippet GameState.
This works for game_state.list, but fails for game_state.addGame,
shown below.
What did I screw up this time?


WARN - Snippet Failure: SnippetFailure(/ -
ParsePath(List(index),,true,false),Full(game_store.addGame),Stateful
Snippet: Dispatch Not Matched)


lift:surround with=default at=content
  lift:game_store.list
  div id=game_list
ul
  game:list
 ligame:idgid/game:id game:namegname/game:name/li
  /game:list
/ul
  /div
  /lift:game_store.list
  lift:game_store.addGame form=post
div
  hr/
p
  Create a new game:
/p
pName
  game:nomName/game:nom
/p
p
  game:submit
buttonCreate/button
  /game:submit
/p
/div
  /lift:game_store.addGame

/lift:surround




class Boot {
  def boot {
// where to search snippet
LiftRules.addToPackages(com.redlemurgames)

LiftRules.snippetDispatch.append(
  Map(game_store - GameStore)
)

val entries = Menu(Loc(Home, List(index), Home)) :: Nil
LiftRules.setSiteMap(SiteMap(entries:_*))

  }


object GameStore extends DispatchSnippet {

  private val gameMap = new HashMap[String, Game]

  def dispatch = {
case list = list
  }

  def list(html: NodeSeq) : NodeSeq =
bind(game, html,
   list - gameMap.values.toList.flatMap
{ gm = bind(game, html, id - Text(gm.getId), name
- Text(gm.getName) ) }
)


  def addGame(form: NodeSeq) : NodeSeq = {
val id = randomString(12)
var gname : String = 


def checkAndSave(): Unit =  if (gname.isEmpty)
   {  S.error(String cannot be
empty) ; S.mapSnippet(game_store.add, doBind) }
   {  val ngame = new Game(id, gname,
new HashSet[(String, Actor)]);
  gameMap += id - ngame;
  ngame ! Init();
  S.notice(Added + ngame.getName) }


def doBind(form: NodeSeq) : NodeSeq = {
  println(doBind was called)
  bind(game, form,
   nom - text(gname, gname = _),
   submit - submit(New, checkAndSave))
}
doBind(form)
  }

--~--~-~--~~~---~--~~
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: What am I doing wrong?

2009-10-06 Thread Rick R
Geez. I knew I was overlooking something stupid. Thanks for your help.



On Tue, Oct 6, 2009 at 11:49 AM, Ross Mellgren dri...@gmail.com wrote:


 You are using a dispatch snippet, which means the name after . in
 the lift tag is passed to the dispatch method of your snippet, rather
 than using reflection to find a method with the same name. So, you
 need to add:

 case addGame = addGame

 to your  def dispatch

 -Ross

 On Oct 6, 2009, at 11:19 AM, Rick R wrote:

  I have added a mapping of game_state to the DispatchSnippet
  GameState. This works for game_state.list, but fails for
  game_state.addGame, shown below.
  What did I screw up this time?
 
 
  WARN - Snippet Failure: SnippetFailure(/ - ParsePath(List
  (index),,true,false),Full(game_store.addGame),Stateful Snippet:
  Dispatch Not Matched)
 
 
 
  lift:surround with=default at=content
 
lift:game_store.list
div id=game_list
 
  ul
game:list
 ligame:idgid/game:id game:namegname/game:name/li
 
/game:list
  /ul
/div
 
/lift:game_store.list
lift:game_store.addGame form=post
 
  div
hr/
  p
 
  Create a new game:
  /p
  pName
 
  game:nomName/game:nom
  /p
 
p
game:submit
  buttonCreate/button
 
  /game:submit
  /p
  /div
 
/lift:game_store.addGame
 
  /lift:surround
 
 
 
 
 
  class Boot {
def boot {
  // where to search snippet
 
  LiftRules.addToPackages(com.redlemurgames)
 
  LiftRules.snippetDispatch.append(
 
Map(game_store - GameStore)
  )
 
 
  val entries = Menu(Loc(Home, List(index), Home)) :: Nil
 
  LiftRules.setSiteMap(SiteMap(entries:_*))
 
 
}
 
 
  object GameStore extends DispatchSnippet {
 
private val gameMap = new HashMap[String, Game]
 
 
def dispatch = {
  case list = list
 
}
 
def list(html: NodeSeq) : NodeSeq =
 
  bind(game, html,
   list - gameMap.values.toList.flatMap
 
  { gm = bind(game, html, id - Text(gm.getId),
  name - Text(gm.getName) ) }
 
  )
 
 
def addGame(form: NodeSeq) : NodeSeq = {
 
  val id = randomString(12)
  var gname : String = 
 
 
 
  def checkAndSave(): Unit =  if (gname.isEmpty)
 
 {  S.error(String cannot be
  empty) ; S.mapSnippet(game_store.add, doBind) }
 
 {  val ngame = new Game(id,
  gname, new HashSet[(String, Actor)]);
 
gameMap += id - ngame;
ngame ! Init();
 
S.notice(Added +
  ngame.getName) }
 
 
 
  def doBind(form: NodeSeq) : NodeSeq = {
 
println(doBind was called)
bind(game, form,
 
 nom - text(gname, gname = _),
 
 submit - submit(New, checkAndSave))
 
  }
  doBind(form)
}
 
  


 


--~--~-~--~~~---~--~~
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: Removing Scala Actors from Lift

2009-09-29 Thread Rick R
lift-webutil


On Tue, Sep 29, 2009 at 2:11 PM, David Pollak feeder.of.the.be...@gmail.com
 wrote:



 On Tue, Sep 29, 2009 at 11:08 AM, Timothy Perrett timo...@getintheloop.eu
  wrote:


 OK - that I can understand.

 Could I suggest however that we find a different name? Both myself and
 Marius were a little confused by that - nothing springs to mind, but
 perhaps lets bounce around some names.


 Sure.  Now's the time.  In a week or so, I want to get the naming and the
 interfaces clean so people something stable to code against.



 Cheers, Tim

 On 29 Sep 2009, at 18:41, David Pollak wrote:

  lift-util is weighted very much toward web development.  lift-base
  will be generic.
 






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

 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---